* Group series into two types * 1. on category axis, like line, bar * 2. others, like scatter, pie
(ecModel: GlobalModel)
| 68 | * 2. others, like scatter, pie |
| 69 | */ |
| 70 | function groupSeries(ecModel: GlobalModel) { |
| 71 | const seriesGroupByCategoryAxis: Dictionary<SeriesGroup> = {}; |
| 72 | const otherSeries: SeriesModel[] = []; |
| 73 | const meta: SeriesGroupMeta[] = []; |
| 74 | ecModel.eachRawSeries(function (seriesModel) { |
| 75 | const coordSys = seriesModel.coordinateSystem; |
| 76 | |
| 77 | if (coordSys && (coordSys.type === 'cartesian2d' || coordSys.type === 'polar')) { |
| 78 | // TODO: TYPE Consider polar? Include polar may increase unnecessary bundle size. |
| 79 | const baseAxis = (coordSys as Cartesian2D).getBaseAxis(); |
| 80 | if (baseAxis.type === 'category') { |
| 81 | const key = getCartesianAxisHashKey(baseAxis); |
| 82 | if (!seriesGroupByCategoryAxis[key]) { |
| 83 | seriesGroupByCategoryAxis[key] = { |
| 84 | categoryAxis: baseAxis, |
| 85 | valueAxis: coordSys.getOtherAxis(baseAxis), |
| 86 | series: [] |
| 87 | }; |
| 88 | meta.push({ |
| 89 | axisDim: baseAxis.dim, |
| 90 | axisIndex: baseAxis.index |
| 91 | }); |
| 92 | } |
| 93 | seriesGroupByCategoryAxis[key].series.push(seriesModel); |
| 94 | } |
| 95 | else { |
| 96 | otherSeries.push(seriesModel); |
| 97 | } |
| 98 | } |
| 99 | else { |
| 100 | otherSeries.push(seriesModel); |
| 101 | } |
| 102 | }); |
| 103 | |
| 104 | return { |
| 105 | seriesGroupByCategoryAxis: seriesGroupByCategoryAxis, |
| 106 | other: otherSeries, |
| 107 | meta: meta |
| 108 | }; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Assemble content of series on cateogory axis |
no test coverage detected
searching dependent graphs…