123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- var zrUtil = require("zrender/lib/core/util");
- 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);
- });
- });
- data.each(function (idx) {
-
-
-
- var firstPoint = zrUtil.find(points[idx], function (point) {
- return isValidPoint(point);
- }) || getValueMissingPoint(coordSys);
- points[idx].push(firstPoint.slice());
- data.setItemLayout(idx, points[idx]);
- });
- });
- }
- function isValidPoint(point) {
- return !isNaN(point[0]) && !isNaN(point[1]);
- }
- function getValueMissingPoint(coordSys) {
-
-
- return [coordSys.cx, coordSys.cy];
- }
- module.exports = _default;
|