first commit

This commit is contained in:
jefferyzhao
2025-07-31 17:44:12 +08:00
commit b9bdc8598b
42390 changed files with 4467935 additions and 0 deletions

120
node_modules/echarts/lib/chart/radar/RadarSeries.js generated vendored Normal file
View File

@ -0,0 +1,120 @@
/*
* 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.
*/
var SeriesModel = require("../../model/Series");
var createListSimply = require("../helper/createListSimply");
var zrUtil = require("zrender/lib/core/util");
var _format = require("../../util/format");
var encodeHTML = _format.encodeHTML;
var LegendVisualProvider = require("../../visual/LegendVisualProvider");
/*
* 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.
*/
var RadarSeries = SeriesModel.extend({
type: 'series.radar',
dependencies: ['radar'],
// Overwrite
init: function (option) {
RadarSeries.superApply(this, 'init', arguments); // Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this));
},
getInitialData: function (option, ecModel) {
return createListSimply(this, {
generateCoord: 'indicator_',
generateCoordCount: Infinity
});
},
formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
var data = this.getData();
var coordSys = this.coordinateSystem;
var indicatorAxes = coordSys.getIndicatorAxes();
var name = this.getData().getName(dataIndex);
var newLine = renderMode === 'html' ? '<br/>' : '\n';
return encodeHTML(name === '' ? this.name : name) + newLine + zrUtil.map(indicatorAxes, function (axis, idx) {
var val = data.get(data.mapDimension(axis.dim), dataIndex);
return encodeHTML(axis.name + ' : ' + val);
}).join(newLine);
},
/**
* @implement
*/
getTooltipPosition: function (dataIndex) {
if (dataIndex != null) {
var data = this.getData();
var coordSys = this.coordinateSystem;
var values = data.getValues(zrUtil.map(coordSys.dimensions, function (dim) {
return data.mapDimension(dim);
}), dataIndex, true);
for (var i = 0, len = values.length; i < len; i++) {
if (!isNaN(values[i])) {
var indicatorAxes = coordSys.getIndicatorAxes();
return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);
}
}
}
},
defaultOption: {
zlevel: 0,
z: 2,
coordinateSystem: 'radar',
legendHoverLink: true,
radarIndex: 0,
lineStyle: {
width: 2,
type: 'solid'
},
label: {
position: 'top'
},
// areaStyle: {
// },
// itemStyle: {}
symbol: 'emptyCircle',
symbolSize: 4 // symbolRotate: null
}
});
var _default = RadarSeries;
module.exports = _default;

219
node_modules/echarts/lib/chart/radar/RadarView.js generated vendored Normal file
View File

@ -0,0 +1,219 @@
/*
* 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.
*/
var echarts = require("../../echarts");
var graphic = require("../../util/graphic");
var zrUtil = require("zrender/lib/core/util");
var symbolUtil = require("../../util/symbol");
/*
* 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.
*/
function normalizeSymbolSize(symbolSize) {
if (!zrUtil.isArray(symbolSize)) {
symbolSize = [+symbolSize, +symbolSize];
}
return symbolSize;
}
var _default = echarts.extendChartView({
type: 'radar',
render: function (seriesModel, ecModel, api) {
var polar = seriesModel.coordinateSystem;
var group = this.group;
var data = seriesModel.getData();
var oldData = this._data;
function createSymbol(data, idx) {
var symbolType = data.getItemVisual(idx, 'symbol') || 'circle';
var color = data.getItemVisual(idx, 'color');
if (symbolType === 'none') {
return;
}
var symbolSize = normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
var symbolPath = symbolUtil.createSymbol(symbolType, -1, -1, 2, 2, color);
var symbolRotate = data.getItemVisual(idx, 'symbolRotate') || 0;
symbolPath.attr({
style: {
strokeNoScale: true
},
z2: 100,
scale: [symbolSize[0] / 2, symbolSize[1] / 2],
rotation: symbolRotate * Math.PI / 180 || 0
});
return symbolPath;
}
function updateSymbols(oldPoints, newPoints, symbolGroup, data, idx, isInit) {
// Simply rerender all
symbolGroup.removeAll();
for (var i = 0; i < newPoints.length - 1; i++) {
var symbolPath = createSymbol(data, idx);
if (symbolPath) {
symbolPath.__dimIdx = i;
if (oldPoints[i]) {
symbolPath.attr('position', oldPoints[i]);
graphic[isInit ? 'initProps' : 'updateProps'](symbolPath, {
position: newPoints[i]
}, seriesModel, idx);
} else {
symbolPath.attr('position', newPoints[i]);
}
symbolGroup.add(symbolPath);
}
}
}
function getInitialPoints(points) {
return zrUtil.map(points, function (pt) {
return [polar.cx, polar.cy];
});
}
data.diff(oldData).add(function (idx) {
var points = data.getItemLayout(idx);
if (!points) {
return;
}
var polygon = new graphic.Polygon();
var polyline = new graphic.Polyline();
var target = {
shape: {
points: points
}
};
polygon.shape.points = getInitialPoints(points);
polyline.shape.points = getInitialPoints(points);
graphic.initProps(polygon, target, seriesModel, idx);
graphic.initProps(polyline, target, seriesModel, idx);
var itemGroup = new graphic.Group();
var symbolGroup = new graphic.Group();
itemGroup.add(polyline);
itemGroup.add(polygon);
itemGroup.add(symbolGroup);
updateSymbols(polyline.shape.points, points, symbolGroup, data, idx, true);
data.setItemGraphicEl(idx, itemGroup);
}).update(function (newIdx, oldIdx) {
var itemGroup = oldData.getItemGraphicEl(oldIdx);
var polyline = itemGroup.childAt(0);
var polygon = itemGroup.childAt(1);
var symbolGroup = itemGroup.childAt(2);
var target = {
shape: {
points: data.getItemLayout(newIdx)
}
};
if (!target.shape.points) {
return;
}
updateSymbols(polyline.shape.points, target.shape.points, symbolGroup, data, newIdx, false);
graphic.updateProps(polyline, target, seriesModel);
graphic.updateProps(polygon, target, seriesModel);
data.setItemGraphicEl(newIdx, itemGroup);
}).remove(function (idx) {
group.remove(oldData.getItemGraphicEl(idx));
}).execute();
data.eachItemGraphicEl(function (itemGroup, idx) {
var itemModel = data.getItemModel(idx);
var polyline = itemGroup.childAt(0);
var polygon = itemGroup.childAt(1);
var symbolGroup = itemGroup.childAt(2);
var color = data.getItemVisual(idx, 'color');
group.add(itemGroup);
polyline.useStyle(zrUtil.defaults(itemModel.getModel('lineStyle').getLineStyle(), {
fill: 'none',
stroke: color
}));
polyline.hoverStyle = itemModel.getModel('emphasis.lineStyle').getLineStyle();
var areaStyleModel = itemModel.getModel('areaStyle');
var hoverAreaStyleModel = itemModel.getModel('emphasis.areaStyle');
var polygonIgnore = areaStyleModel.isEmpty() && areaStyleModel.parentModel.isEmpty();
var hoverPolygonIgnore = hoverAreaStyleModel.isEmpty() && hoverAreaStyleModel.parentModel.isEmpty();
hoverPolygonIgnore = hoverPolygonIgnore && polygonIgnore;
polygon.ignore = polygonIgnore;
polygon.useStyle(zrUtil.defaults(areaStyleModel.getAreaStyle(), {
fill: color,
opacity: 0.7
}));
polygon.hoverStyle = hoverAreaStyleModel.getAreaStyle();
var itemStyle = itemModel.getModel('itemStyle').getItemStyle(['color']);
var itemHoverStyle = itemModel.getModel('emphasis.itemStyle').getItemStyle();
var labelModel = itemModel.getModel('label');
var labelHoverModel = itemModel.getModel('emphasis.label');
symbolGroup.eachChild(function (symbolPath) {
symbolPath.setStyle(itemStyle);
symbolPath.hoverStyle = zrUtil.clone(itemHoverStyle);
var defaultText = data.get(data.dimensions[symbolPath.__dimIdx], idx);
(defaultText == null || isNaN(defaultText)) && (defaultText = '');
graphic.setLabelStyle(symbolPath.style, symbolPath.hoverStyle, labelModel, labelHoverModel, {
labelFetcher: data.hostModel,
labelDataIndex: idx,
labelDimIndex: symbolPath.__dimIdx,
defaultText: defaultText,
autoColor: color,
isRectText: true
});
});
itemGroup.highDownOnUpdate = function (fromState, toState) {
polygon.attr('ignore', toState === 'emphasis' ? hoverPolygonIgnore : polygonIgnore);
};
graphic.setHoverStyle(itemGroup);
});
this._data = data;
},
remove: function () {
this.group.removeAll();
this._data = null;
},
dispose: function () {}
});
module.exports = _default;

78
node_modules/echarts/lib/chart/radar/backwardCompat.js generated vendored Normal file
View File

@ -0,0 +1,78 @@
/*
* 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.
*/
var zrUtil = require("zrender/lib/core/util");
/*
* 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.
*/
// Backward compat for radar chart in 2
function _default(option) {
var polarOptArr = option.polar;
if (polarOptArr) {
if (!zrUtil.isArray(polarOptArr)) {
polarOptArr = [polarOptArr];
}
var polarNotRadar = [];
zrUtil.each(polarOptArr, function (polarOpt, idx) {
if (polarOpt.indicator) {
if (polarOpt.type && !polarOpt.shape) {
polarOpt.shape = polarOpt.type;
}
option.radar = option.radar || [];
if (!zrUtil.isArray(option.radar)) {
option.radar = [option.radar];
}
option.radar.push(polarOpt);
} else {
polarNotRadar.push(polarOpt);
}
});
option.polar = polarNotRadar;
}
zrUtil.each(option.series, function (seriesOpt) {
if (seriesOpt && seriesOpt.type === 'radar' && seriesOpt.polarIndex) {
seriesOpt.radarIndex = seriesOpt.polarIndex;
}
});
}
module.exports = _default;

84
node_modules/echarts/lib/chart/radar/radarLayout.js generated vendored Normal file
View File

@ -0,0 +1,84 @@
/*
* 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.
*/
var zrUtil = require("zrender/lib/core/util");
/*
* 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.
*/
function _default(ecModel) {
ecModel.eachSeriesByType('radar', function (seriesModel) {
var data = seriesModel.getData();
var points = [];
var coordSys = seriesModel.coordinateSystem;
if (!coordSys) {
return;
}
var axes = coordSys.getIndicatorAxes();
zrUtil.each(axes, function (axis, axisIndex) {
data.each(data.mapDimension(axes[axisIndex].dim), function (val, dataIndex) {
points[dataIndex] = points[dataIndex] || [];
var point = coordSys.dataToPoint(val, axisIndex);
points[dataIndex][axisIndex] = isValidPoint(point) ? point : getValueMissingPoint(coordSys);
});
}); // Close polygon
data.each(function (idx) {
// TODO
// Is it appropriate to connect to the next data when some data is missing?
// Or, should trade it like `connectNull` in line chart?
var firstPoint = zrUtil.find(points[idx], function (point) {
return isValidPoint(point);
}) || getValueMissingPoint(coordSys); // Copy the first actual point to the end of the array
points[idx].push(firstPoint.slice());
data.setItemLayout(idx, points[idx]);
});
});
}
function isValidPoint(point) {
return !isNaN(point[0]) && !isNaN(point[1]);
}
function getValueMissingPoint(coordSys) {
// It is error-prone to input [NaN, NaN] into polygon, polygon.
// (probably cause problem when refreshing or animating)
return [coordSys.cx, coordSys.cy];
}
module.exports = _default;