逐步完成前后端服务器
This commit is contained in:
133
frontend/node_modules/echarts/lib/chart/radar/RadarSeries.js
generated
vendored
Normal file
133
frontend/node_modules/echarts/lib/chart/radar/RadarSeries.js
generated
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
|
||||
/*
|
||||
* 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 SeriesModel from '../../model/Series.js';
|
||||
import createSeriesDataSimply from '../helper/createSeriesDataSimply.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import LegendVisualProvider from '../../visual/LegendVisualProvider.js';
|
||||
import { createTooltipMarkup, retrieveVisualColorForTooltipMarker } from '../../component/tooltip/tooltipMarkup.js';
|
||||
var RadarSeriesModel = /** @class */function (_super) {
|
||||
__extends(RadarSeriesModel, _super);
|
||||
function RadarSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = RadarSeriesModel.type;
|
||||
_this.hasSymbolVisual = true;
|
||||
return _this;
|
||||
}
|
||||
// Overwrite
|
||||
RadarSeriesModel.prototype.init = function (option) {
|
||||
_super.prototype.init.apply(this, 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));
|
||||
};
|
||||
RadarSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
return createSeriesDataSimply(this, {
|
||||
generateCoord: 'indicator_',
|
||||
generateCoordCount: Infinity
|
||||
});
|
||||
};
|
||||
RadarSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
|
||||
var data = this.getData();
|
||||
var coordSys = this.coordinateSystem;
|
||||
var indicatorAxes = coordSys.getIndicatorAxes();
|
||||
var name = this.getData().getName(dataIndex);
|
||||
var nameToDisplay = name === '' ? this.name : name;
|
||||
var markerColor = retrieveVisualColorForTooltipMarker(this, dataIndex);
|
||||
return createTooltipMarkup('section', {
|
||||
header: nameToDisplay,
|
||||
sortBlocks: true,
|
||||
blocks: zrUtil.map(indicatorAxes, function (axis) {
|
||||
var val = data.get(data.mapDimension(axis.dim), dataIndex);
|
||||
return createTooltipMarkup('nameValue', {
|
||||
markerType: 'subItem',
|
||||
markerColor: markerColor,
|
||||
name: axis.name,
|
||||
value: val,
|
||||
sortParam: val
|
||||
});
|
||||
})
|
||||
});
|
||||
};
|
||||
RadarSeriesModel.prototype.getTooltipPosition = function (dataIndex) {
|
||||
if (dataIndex != null) {
|
||||
var data_1 = this.getData();
|
||||
var coordSys = this.coordinateSystem;
|
||||
var values = data_1.getValues(zrUtil.map(coordSys.dimensions, function (dim) {
|
||||
return data_1.mapDimension(dim);
|
||||
}), dataIndex);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
RadarSeriesModel.type = 'series.radar';
|
||||
RadarSeriesModel.dependencies = ['radar'];
|
||||
RadarSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
colorBy: 'data',
|
||||
coordinateSystem: 'radar',
|
||||
legendHoverLink: true,
|
||||
radarIndex: 0,
|
||||
lineStyle: {
|
||||
width: 2,
|
||||
type: 'solid',
|
||||
join: 'round'
|
||||
},
|
||||
label: {
|
||||
position: 'top'
|
||||
},
|
||||
// areaStyle: {
|
||||
// },
|
||||
// itemStyle: {}
|
||||
symbolSize: 8
|
||||
// symbolRotate: null
|
||||
};
|
||||
return RadarSeriesModel;
|
||||
}(SeriesModel);
|
||||
export default RadarSeriesModel;
|
225
frontend/node_modules/echarts/lib/chart/radar/RadarView.js
generated
vendored
Normal file
225
frontend/node_modules/echarts/lib/chart/radar/RadarView.js
generated
vendored
Normal file
@ -0,0 +1,225 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import * as symbolUtil from '../../util/symbol.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
import ZRImage from 'zrender/lib/graphic/Image.js';
|
||||
import { saveOldStyle } from '../../animation/basicTransition.js';
|
||||
var RadarView = /** @class */function (_super) {
|
||||
__extends(RadarView, _super);
|
||||
function RadarView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = RadarView.type;
|
||||
return _this;
|
||||
}
|
||||
RadarView.prototype.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';
|
||||
if (symbolType === 'none') {
|
||||
return;
|
||||
}
|
||||
var symbolSize = symbolUtil.normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
|
||||
var symbolPath = symbolUtil.createSymbol(symbolType, -1, -1, 2, 2);
|
||||
var symbolRotate = data.getItemVisual(idx, 'symbolRotate') || 0;
|
||||
symbolPath.attr({
|
||||
style: {
|
||||
strokeNoScale: true
|
||||
},
|
||||
z2: 100,
|
||||
scaleX: symbolSize[0] / 2,
|
||||
scaleY: 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.setPosition(oldPoints[i]);
|
||||
graphic[isInit ? 'initProps' : 'updateProps'](symbolPath, {
|
||||
x: newPoints[i][0],
|
||||
y: newPoints[i][1]
|
||||
}, seriesModel, idx);
|
||||
} else {
|
||||
symbolPath.setPosition(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);
|
||||
saveOldStyle(polygon);
|
||||
saveOldStyle(polyline);
|
||||
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);
|
||||
// Radar uses the visual encoded from itemStyle.
|
||||
var itemStyle = data.getItemVisual(idx, 'style');
|
||||
var color = itemStyle.fill;
|
||||
group.add(itemGroup);
|
||||
polyline.useStyle(zrUtil.defaults(itemModel.getModel('lineStyle').getLineStyle(), {
|
||||
fill: 'none',
|
||||
stroke: color
|
||||
}));
|
||||
setStatesStylesFromModel(polyline, itemModel, 'lineStyle');
|
||||
setStatesStylesFromModel(polygon, itemModel, 'areaStyle');
|
||||
var areaStyleModel = itemModel.getModel('areaStyle');
|
||||
var polygonIgnore = areaStyleModel.isEmpty() && areaStyleModel.parentModel.isEmpty();
|
||||
polygon.ignore = polygonIgnore;
|
||||
zrUtil.each(['emphasis', 'select', 'blur'], function (stateName) {
|
||||
var stateModel = itemModel.getModel([stateName, 'areaStyle']);
|
||||
var stateIgnore = stateModel.isEmpty() && stateModel.parentModel.isEmpty();
|
||||
// Won't be ignore if normal state is not ignore.
|
||||
polygon.ensureState(stateName).ignore = stateIgnore && polygonIgnore;
|
||||
});
|
||||
polygon.useStyle(zrUtil.defaults(areaStyleModel.getAreaStyle(), {
|
||||
fill: color,
|
||||
opacity: 0.7,
|
||||
decal: itemStyle.decal
|
||||
}));
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
var itemHoverStyle = emphasisModel.getModel('itemStyle').getItemStyle();
|
||||
symbolGroup.eachChild(function (symbolPath) {
|
||||
if (symbolPath instanceof ZRImage) {
|
||||
var pathStyle = symbolPath.style;
|
||||
symbolPath.useStyle(zrUtil.extend({
|
||||
// TODO other properties like x, y ?
|
||||
image: pathStyle.image,
|
||||
x: pathStyle.x,
|
||||
y: pathStyle.y,
|
||||
width: pathStyle.width,
|
||||
height: pathStyle.height
|
||||
}, itemStyle));
|
||||
} else {
|
||||
symbolPath.useStyle(itemStyle);
|
||||
symbolPath.setColor(color);
|
||||
symbolPath.style.strokeNoScale = true;
|
||||
}
|
||||
var pathEmphasisState = symbolPath.ensureState('emphasis');
|
||||
pathEmphasisState.style = zrUtil.clone(itemHoverStyle);
|
||||
var defaultText = data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx);
|
||||
(defaultText == null || isNaN(defaultText)) && (defaultText = '');
|
||||
setLabelStyle(symbolPath, getLabelStatesModels(itemModel), {
|
||||
labelFetcher: data.hostModel,
|
||||
labelDataIndex: idx,
|
||||
labelDimIndex: symbolPath.__dimIdx,
|
||||
defaultText: defaultText,
|
||||
inheritColor: color,
|
||||
defaultOpacity: itemStyle.opacity
|
||||
});
|
||||
});
|
||||
toggleHoverEmphasis(itemGroup, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
|
||||
});
|
||||
this._data = data;
|
||||
};
|
||||
RadarView.prototype.remove = function () {
|
||||
this.group.removeAll();
|
||||
this._data = null;
|
||||
};
|
||||
RadarView.type = 'radar';
|
||||
return RadarView;
|
||||
}(ChartView);
|
||||
export default RadarView;
|
75
frontend/node_modules/echarts/lib/chart/radar/backwardCompat.js
generated
vendored
Normal file
75
frontend/node_modules/echarts/lib/chart/radar/backwardCompat.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// @ts-nocheck
|
||||
// Backward compat for radar chart in 2
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
export default function radarBackwardCompat(option) {
|
||||
var polarOptArr = option.polar;
|
||||
if (polarOptArr) {
|
||||
if (!zrUtil.isArray(polarOptArr)) {
|
||||
polarOptArr = [polarOptArr];
|
||||
}
|
||||
var polarNotRadar_1 = [];
|
||||
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_1.push(polarOpt);
|
||||
}
|
||||
});
|
||||
option.polar = polarNotRadar_1;
|
||||
}
|
||||
zrUtil.each(option.series, function (seriesOpt) {
|
||||
if (seriesOpt && seriesOpt.type === 'radar' && seriesOpt.polarIndex) {
|
||||
seriesOpt.radarIndex = seriesOpt.polarIndex;
|
||||
}
|
||||
});
|
||||
}
|
58
frontend/node_modules/echarts/lib/chart/radar/install.js
generated
vendored
Normal file
58
frontend/node_modules/echarts/lib/chart/radar/install.js
generated
vendored
Normal 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 { use } from '../../extension.js';
|
||||
import radarLayout from '../radar/radarLayout.js';
|
||||
import dataFilter from '../../processor/dataFilter.js';
|
||||
import backwardCompat from '../radar/backwardCompat.js';
|
||||
import RadarView from './RadarView.js';
|
||||
import RadarSeriesModel from './RadarSeries.js';
|
||||
import { install as installRadarComponent } from '../../component/radar/install.js';
|
||||
export function install(registers) {
|
||||
use(installRadarComponent);
|
||||
registers.registerChartView(RadarView);
|
||||
registers.registerSeriesModel(RadarSeriesModel);
|
||||
registers.registerLayout(radarLayout);
|
||||
registers.registerProcessor(dataFilter('radar'));
|
||||
registers.registerPreprocessor(backwardCompat);
|
||||
}
|
82
frontend/node_modules/echarts/lib/chart/radar/radarLayout.js
generated
vendored
Normal file
82
frontend/node_modules/echarts/lib/chart/radar/radarLayout.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
export default function radarLayout(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];
|
||||
}
|
Reference in New Issue
Block a user