逐步完成前后端服务器

This commit is contained in:
2025-09-09 15:00:30 +08:00
parent fcb09432e9
commit c7dfa1e9fc
2937 changed files with 1477567 additions and 0 deletions

View File

@ -0,0 +1,111 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { __extends } from "tslib";
import * as textContain from 'zrender/lib/contain/text.js';
import Axis from '../Axis.js';
import { makeInner } from '../../util/model.js';
var inner = makeInner();
var AngleAxis = /** @class */function (_super) {
__extends(AngleAxis, _super);
function AngleAxis(scale, angleExtent) {
return _super.call(this, 'angle', scale, angleExtent || [0, 360]) || this;
}
AngleAxis.prototype.pointToData = function (point, clamp) {
return this.polar.pointToData(point, clamp)[this.dim === 'radius' ? 0 : 1];
};
/**
* Only be called in category axis.
* Angle axis uses text height to decide interval
*
* @override
* @return {number} Auto interval for cateogry axis tick and label
*/
AngleAxis.prototype.calculateCategoryInterval = function () {
var axis = this;
var labelModel = axis.getLabelModel();
var ordinalScale = axis.scale;
var ordinalExtent = ordinalScale.getExtent();
// Providing this method is for optimization:
// avoid generating a long array by `getTicks`
// in large category data case.
var tickCount = ordinalScale.count();
if (ordinalExtent[1] - ordinalExtent[0] < 1) {
return 0;
}
var tickValue = ordinalExtent[0];
var unitSpan = axis.dataToCoord(tickValue + 1) - axis.dataToCoord(tickValue);
var unitH = Math.abs(unitSpan);
// Not precise, just use height as text width
// and each distance from axis line yet.
var rect = textContain.getBoundingRect(tickValue == null ? '' : tickValue + '', labelModel.getFont(), 'center', 'top');
var maxH = Math.max(rect.height, 7);
var dh = maxH / unitH;
// 0/0 is NaN, 1/0 is Infinity.
isNaN(dh) && (dh = Infinity);
var interval = Math.max(0, Math.floor(dh));
var cache = inner(axis.model);
var lastAutoInterval = cache.lastAutoInterval;
var lastTickCount = cache.lastTickCount;
// Use cache to keep interval stable while moving zoom window,
// otherwise the calculated interval might jitter when the zoom
// window size is close to the interval-changing size.
if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1
// Always choose the bigger one, otherwise the critical
// point is not the same when zooming in or zooming out.
&& lastAutoInterval > interval) {
interval = lastAutoInterval;
}
// Only update cache if cache not used, otherwise the
// changing of interval is too insensitive.
else {
cache.lastTickCount = tickCount;
cache.lastAutoInterval = interval;
}
return interval;
};
return AngleAxis;
}(Axis);
AngleAxis.prototype.dataToAngle = Axis.prototype.dataToCoord;
AngleAxis.prototype.angleToData = Axis.prototype.coordToData;
export default AngleAxis;

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { __extends } from "tslib";
import * as zrUtil from 'zrender/lib/core/util.js';
import ComponentModel from '../../model/Component.js';
import { AxisModelCommonMixin } from '../axisModelCommonMixin.js';
import { SINGLE_REFERRING } from '../../util/model.js';
var PolarAxisModel = /** @class */function (_super) {
__extends(PolarAxisModel, _super);
function PolarAxisModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
PolarAxisModel.prototype.getCoordSysModel = function () {
return this.getReferringComponents('polar', SINGLE_REFERRING).models[0];
};
PolarAxisModel.type = 'polarAxis';
return PolarAxisModel;
}(ComponentModel);
zrUtil.mixin(PolarAxisModel, AxisModelCommonMixin);
export { PolarAxisModel };
var AngleAxisModel = /** @class */function (_super) {
__extends(AngleAxisModel, _super);
function AngleAxisModel() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = AngleAxisModel.type;
return _this;
}
AngleAxisModel.type = 'angleAxis';
return AngleAxisModel;
}(PolarAxisModel);
export { AngleAxisModel };
var RadiusAxisModel = /** @class */function (_super) {
__extends(RadiusAxisModel, _super);
function RadiusAxisModel() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = RadiusAxisModel.type;
return _this;
}
RadiusAxisModel.type = 'radiusAxis';
return RadiusAxisModel;
}(PolarAxisModel);
export { RadiusAxisModel };

218
frontend/node_modules/echarts/lib/coord/polar/Polar.js generated vendored Normal file
View File

@ -0,0 +1,218 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import RadiusAxis from './RadiusAxis.js';
import AngleAxis from './AngleAxis.js';
export var polarDimensions = ['radius', 'angle'];
var Polar = /** @class */function () {
function Polar(name) {
this.dimensions = polarDimensions;
this.type = 'polar';
/**
* x of polar center
*/
this.cx = 0;
/**
* y of polar center
*/
this.cy = 0;
this._radiusAxis = new RadiusAxis();
this._angleAxis = new AngleAxis();
this.axisPointerEnabled = true;
this.name = name || '';
this._radiusAxis.polar = this._angleAxis.polar = this;
}
/**
* If contain coord
*/
Polar.prototype.containPoint = function (point) {
var coord = this.pointToCoord(point);
return this._radiusAxis.contain(coord[0]) && this._angleAxis.contain(coord[1]);
};
/**
* If contain data
*/
Polar.prototype.containData = function (data) {
return this._radiusAxis.containData(data[0]) && this._angleAxis.containData(data[1]);
};
Polar.prototype.getAxis = function (dim) {
var key = '_' + dim + 'Axis';
return this[key];
};
Polar.prototype.getAxes = function () {
return [this._radiusAxis, this._angleAxis];
};
/**
* Get axes by type of scale
*/
Polar.prototype.getAxesByScale = function (scaleType) {
var axes = [];
var angleAxis = this._angleAxis;
var radiusAxis = this._radiusAxis;
angleAxis.scale.type === scaleType && axes.push(angleAxis);
radiusAxis.scale.type === scaleType && axes.push(radiusAxis);
return axes;
};
Polar.prototype.getAngleAxis = function () {
return this._angleAxis;
};
Polar.prototype.getRadiusAxis = function () {
return this._radiusAxis;
};
Polar.prototype.getOtherAxis = function (axis) {
var angleAxis = this._angleAxis;
return axis === angleAxis ? this._radiusAxis : angleAxis;
};
/**
* Base axis will be used on stacking.
*
*/
Polar.prototype.getBaseAxis = function () {
return this.getAxesByScale('ordinal')[0] || this.getAxesByScale('time')[0] || this.getAngleAxis();
};
Polar.prototype.getTooltipAxes = function (dim) {
var baseAxis = dim != null && dim !== 'auto' ? this.getAxis(dim) : this.getBaseAxis();
return {
baseAxes: [baseAxis],
otherAxes: [this.getOtherAxis(baseAxis)]
};
};
/**
* Convert a single data item to (x, y) point.
* Parameter data is an array which the first element is radius and the second is angle
*/
Polar.prototype.dataToPoint = function (data, clamp) {
return this.coordToPoint([this._radiusAxis.dataToRadius(data[0], clamp), this._angleAxis.dataToAngle(data[1], clamp)]);
};
/**
* Convert a (x, y) point to data
*/
Polar.prototype.pointToData = function (point, clamp) {
var coord = this.pointToCoord(point);
return [this._radiusAxis.radiusToData(coord[0], clamp), this._angleAxis.angleToData(coord[1], clamp)];
};
/**
* Convert a (x, y) point to (radius, angle) coord
*/
Polar.prototype.pointToCoord = function (point) {
var dx = point[0] - this.cx;
var dy = point[1] - this.cy;
var angleAxis = this.getAngleAxis();
var extent = angleAxis.getExtent();
var minAngle = Math.min(extent[0], extent[1]);
var maxAngle = Math.max(extent[0], extent[1]);
// Fix fixed extent in polarCreator
// FIXME
angleAxis.inverse ? minAngle = maxAngle - 360 : maxAngle = minAngle + 360;
var radius = Math.sqrt(dx * dx + dy * dy);
dx /= radius;
dy /= radius;
var radian = Math.atan2(-dy, dx) / Math.PI * 180;
// move to angleExtent
var dir = radian < minAngle ? 1 : -1;
while (radian < minAngle || radian > maxAngle) {
radian += dir * 360;
}
return [radius, radian];
};
/**
* Convert a (radius, angle) coord to (x, y) point
*/
Polar.prototype.coordToPoint = function (coord) {
var radius = coord[0];
var radian = coord[1] / 180 * Math.PI;
var x = Math.cos(radian) * radius + this.cx;
// Inverse the y
var y = -Math.sin(radian) * radius + this.cy;
return [x, y];
};
/**
* Get ring area of cartesian.
* Area will have a contain function to determine if a point is in the coordinate system.
*/
Polar.prototype.getArea = function () {
var angleAxis = this.getAngleAxis();
var radiusAxis = this.getRadiusAxis();
var radiusExtent = radiusAxis.getExtent().slice();
radiusExtent[0] > radiusExtent[1] && radiusExtent.reverse();
var angleExtent = angleAxis.getExtent();
var RADIAN = Math.PI / 180;
var EPSILON = 1e-4;
return {
cx: this.cx,
cy: this.cy,
r0: radiusExtent[0],
r: radiusExtent[1],
startAngle: -angleExtent[0] * RADIAN,
endAngle: -angleExtent[1] * RADIAN,
clockwise: angleAxis.inverse,
contain: function (x, y) {
// It's a ring shape.
// Start angle and end angle don't matter
var dx = x - this.cx;
var dy = y - this.cy;
var d2 = dx * dx + dy * dy;
var r = this.r;
var r0 = this.r0;
// minus a tiny value 1e-4 in double side to avoid being clipped unexpectedly
// r == r0 contain nothing
return r !== r0 && d2 - EPSILON <= r * r && d2 + EPSILON >= r0 * r0;
}
};
};
Polar.prototype.convertToPixel = function (ecModel, finder, value) {
var coordSys = getCoordSys(finder);
return coordSys === this ? this.dataToPoint(value) : null;
};
Polar.prototype.convertFromPixel = function (ecModel, finder, pixel) {
var coordSys = getCoordSys(finder);
return coordSys === this ? this.pointToData(pixel) : null;
};
return Polar;
}();
function getCoordSys(finder) {
var seriesModel = finder.seriesModel;
var polarModel = finder.polarModel;
return polarModel && polarModel.coordinateSystem || seriesModel && seriesModel.coordinateSystem;
}
export default Polar;

View File

@ -0,0 +1,73 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { __extends } from "tslib";
import ComponentModel from '../../model/Component.js';
var PolarModel = /** @class */function (_super) {
__extends(PolarModel, _super);
function PolarModel() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = PolarModel.type;
return _this;
}
PolarModel.prototype.findAxisModel = function (axisType) {
var foundAxisModel;
var ecModel = this.ecModel;
ecModel.eachComponent(axisType, function (axisModel) {
if (axisModel.getCoordSysModel() === this) {
foundAxisModel = axisModel;
}
}, this);
return foundAxisModel;
};
PolarModel.type = 'polar';
PolarModel.dependencies = ['radiusAxis', 'angleAxis'];
PolarModel.defaultOption = {
// zlevel: 0,
z: 0,
center: ['50%', '50%'],
radius: '80%'
};
return PolarModel;
}(ComponentModel);
export default PolarModel;

View File

@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { __extends } from "tslib";
import Axis from '../Axis.js';
var RadiusAxis = /** @class */function (_super) {
__extends(RadiusAxis, _super);
function RadiusAxis(scale, radiusExtent) {
return _super.call(this, 'radius', scale, radiusExtent) || this;
}
RadiusAxis.prototype.pointToData = function (point, clamp) {
return this.polar.pointToData(point, clamp)[this.dim === 'radius' ? 0 : 1];
};
return RadiusAxis;
}(Axis);
RadiusAxis.prototype.dataToRadius = Axis.prototype.dataToCoord;
RadiusAxis.prototype.radiusToData = Axis.prototype.coordToData;
export default RadiusAxis;

View File

@ -0,0 +1,158 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// TODO Axis scale
import * as zrUtil from 'zrender/lib/core/util.js';
import Polar, { polarDimensions } from './Polar.js';
import { parsePercent } from '../../util/number.js';
import { createScaleByModel, niceScaleExtent, getDataDimensionsOnAxis } from '../../coord/axisHelper.js';
import { SINGLE_REFERRING } from '../../util/model.js';
/**
* Resize method bound to the polar
*/
function resizePolar(polar, polarModel, api) {
var center = polarModel.get('center');
var width = api.getWidth();
var height = api.getHeight();
polar.cx = parsePercent(center[0], width);
polar.cy = parsePercent(center[1], height);
var radiusAxis = polar.getRadiusAxis();
var size = Math.min(width, height) / 2;
var radius = polarModel.get('radius');
if (radius == null) {
radius = [0, '100%'];
} else if (!zrUtil.isArray(radius)) {
// r0 = 0
radius = [0, radius];
}
var parsedRadius = [parsePercent(radius[0], size), parsePercent(radius[1], size)];
radiusAxis.inverse ? radiusAxis.setExtent(parsedRadius[1], parsedRadius[0]) : radiusAxis.setExtent(parsedRadius[0], parsedRadius[1]);
}
/**
* Update polar
*/
function updatePolarScale(ecModel, api) {
var polar = this;
var angleAxis = polar.getAngleAxis();
var radiusAxis = polar.getRadiusAxis();
// Reset scale
angleAxis.scale.setExtent(Infinity, -Infinity);
radiusAxis.scale.setExtent(Infinity, -Infinity);
ecModel.eachSeries(function (seriesModel) {
if (seriesModel.coordinateSystem === polar) {
var data_1 = seriesModel.getData();
zrUtil.each(getDataDimensionsOnAxis(data_1, 'radius'), function (dim) {
radiusAxis.scale.unionExtentFromData(data_1, dim);
});
zrUtil.each(getDataDimensionsOnAxis(data_1, 'angle'), function (dim) {
angleAxis.scale.unionExtentFromData(data_1, dim);
});
}
});
niceScaleExtent(angleAxis.scale, angleAxis.model);
niceScaleExtent(radiusAxis.scale, radiusAxis.model);
// Fix extent of category angle axis
if (angleAxis.type === 'category' && !angleAxis.onBand) {
var extent = angleAxis.getExtent();
var diff = 360 / angleAxis.scale.count();
angleAxis.inverse ? extent[1] += diff : extent[1] -= diff;
angleAxis.setExtent(extent[0], extent[1]);
}
}
function isAngleAxisModel(axisModel) {
return axisModel.mainType === 'angleAxis';
}
/**
* Set common axis properties
*/
function setAxis(axis, axisModel) {
var _a;
axis.type = axisModel.get('type');
axis.scale = createScaleByModel(axisModel);
axis.onBand = axisModel.get('boundaryGap') && axis.type === 'category';
axis.inverse = axisModel.get('inverse');
if (isAngleAxisModel(axisModel)) {
axis.inverse = axis.inverse !== axisModel.get('clockwise');
var startAngle = axisModel.get('startAngle');
var endAngle = (_a = axisModel.get('endAngle')) !== null && _a !== void 0 ? _a : startAngle + (axis.inverse ? -360 : 360);
axis.setExtent(startAngle, endAngle);
}
// Inject axis instance
axisModel.axis = axis;
axis.model = axisModel;
}
var polarCreator = {
dimensions: polarDimensions,
create: function (ecModel, api) {
var polarList = [];
ecModel.eachComponent('polar', function (polarModel, idx) {
var polar = new Polar(idx + '');
// Inject resize and update method
polar.update = updatePolarScale;
var radiusAxis = polar.getRadiusAxis();
var angleAxis = polar.getAngleAxis();
var radiusAxisModel = polarModel.findAxisModel('radiusAxis');
var angleAxisModel = polarModel.findAxisModel('angleAxis');
setAxis(radiusAxis, radiusAxisModel);
setAxis(angleAxis, angleAxisModel);
resizePolar(polar, polarModel, api);
polarList.push(polar);
polarModel.coordinateSystem = polar;
polar.model = polarModel;
});
// Inject coordinateSystem to series
ecModel.eachSeries(function (seriesModel) {
if (seriesModel.get('coordinateSystem') === 'polar') {
var polarModel = seriesModel.getReferringComponents('polar', SINGLE_REFERRING).models[0];
if (process.env.NODE_ENV !== 'production') {
if (!polarModel) {
throw new Error('Polar "' + zrUtil.retrieve(seriesModel.get('polarIndex'), seriesModel.get('polarId'), 0) + '" not found');
}
}
seriesModel.coordinateSystem = polarModel.coordinateSystem;
}
});
return polarList;
}
};
export default polarCreator;

View File

@ -0,0 +1,86 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* AUTO-GENERATED FILE. DO NOT MODIFY.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import * as zrUtil from 'zrender/lib/core/util.js';
// import AngleAxis from './AngleAxis.js';
function dataToCoordSize(dataSize, dataItem) {
// dataItem is necessary in log axis.
dataItem = dataItem || [0, 0];
return zrUtil.map(['Radius', 'Angle'], function (dim, dimIdx) {
var getterName = 'get' + dim + 'Axis';
// TODO: TYPE Check Angle Axis
var axis = this[getterName]();
var val = dataItem[dimIdx];
var halfSize = dataSize[dimIdx] / 2;
var result = axis.type === 'category' ? axis.getBandWidth() : Math.abs(axis.dataToCoord(val - halfSize) - axis.dataToCoord(val + halfSize));
if (dim === 'Angle') {
result = result * Math.PI / 180;
}
return result;
}, this);
}
export default function polarPrepareCustom(coordSys) {
var radiusAxis = coordSys.getRadiusAxis();
var angleAxis = coordSys.getAngleAxis();
var radius = radiusAxis.getExtent();
radius[0] > radius[1] && radius.reverse();
return {
coordSys: {
type: 'polar',
cx: coordSys.cx,
cy: coordSys.cy,
r: radius[1],
r0: radius[0]
},
api: {
coord: function (data) {
var radius = radiusAxis.dataToRadius(data[0]);
var angle = angleAxis.dataToAngle(data[1]);
var coord = coordSys.coordToPoint([radius, angle]);
coord.push(radius, angle * Math.PI / 180);
return coord;
},
size: zrUtil.bind(dataToCoordSize, coordSys)
}
};
}