(ecModel: GlobalModel)
| 28 | export const radarLayoutStageHandler = createSimpleOverallStageHandler(SERIES_TYPE_RADAR, radarLayout); |
| 29 | |
| 30 | function radarLayout(ecModel: GlobalModel) { |
| 31 | ecModel.eachSeriesByType(SERIES_TYPE_RADAR, function (seriesModel: RadarSeriesModel) { |
| 32 | const data = seriesModel.getData(); |
| 33 | const points: Point[][] = []; |
| 34 | const coordSys = seriesModel.coordinateSystem; |
| 35 | if (!coordSys) { |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | const axes = coordSys.getIndicatorAxes(); |
| 40 | |
| 41 | zrUtil.each(axes, function (axis, axisIndex) { |
| 42 | data.each(data.mapDimension(axes[axisIndex].dim), function (val, dataIndex) { |
| 43 | points[dataIndex] = points[dataIndex] || []; |
| 44 | const point = coordSys.dataToPoint(val, axisIndex); |
| 45 | points[dataIndex][axisIndex] = isValidPoint(point) |
| 46 | ? point : getValueMissingPoint(coordSys); |
| 47 | }); |
| 48 | }); |
| 49 | |
| 50 | // Close polygon |
| 51 | data.each(function (idx) { |
| 52 | // TODO |
| 53 | // Is it appropriate to connect to the next data when some data is missing? |
| 54 | // Or, should trade it like `connectNull` in line chart? |
| 55 | const firstPoint = zrUtil.find(points[idx], function (point) { |
| 56 | return isValidPoint(point); |
| 57 | }) || getValueMissingPoint(coordSys); |
| 58 | |
| 59 | // Copy the first actual point to the end of the array |
| 60 | points[idx].push(firstPoint.slice()); |
| 61 | data.setItemLayout(idx, points[idx]); |
| 62 | }); |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | function isValidPoint(point: Point) { |
| 67 | return !isNaN(point[0]) && !isNaN(point[1]); |
nothing calls this directly
no test coverage detected
searching dependent graphs…