(
seriesModel: SeriesModel,
mpModel: MarkPointModel,
ecModel: GlobalModel,
api: ExtensionAPI
)
| 112 | } |
| 113 | |
| 114 | renderSeries( |
| 115 | seriesModel: SeriesModel, |
| 116 | mpModel: MarkPointModel, |
| 117 | ecModel: GlobalModel, |
| 118 | api: ExtensionAPI |
| 119 | ) { |
| 120 | const coordSys = seriesModel.coordinateSystem; |
| 121 | const seriesId = seriesModel.id; |
| 122 | const seriesData = seriesModel.getData(); |
| 123 | |
| 124 | const symbolDrawMap = this.markerGroupMap; |
| 125 | const symbolDraw = symbolDrawMap.get(seriesId) |
| 126 | || symbolDrawMap.set(seriesId, new SymbolDraw()); |
| 127 | |
| 128 | const mpData = createData(coordSys, seriesModel, mpModel); |
| 129 | |
| 130 | // FIXME |
| 131 | mpModel.setData(mpData); |
| 132 | |
| 133 | updateMarkerLayout(mpModel.getData(), seriesModel, api); |
| 134 | |
| 135 | mpData.each(function (idx) { |
| 136 | const itemModel = mpData.getItemModel<MarkPointDataItemOption>(idx); |
| 137 | let symbol = itemModel.getShallow('symbol'); |
| 138 | let symbolSize = itemModel.getShallow('symbolSize'); |
| 139 | let symbolRotate = itemModel.getShallow('symbolRotate'); |
| 140 | let symbolOffset = itemModel.getShallow('symbolOffset'); |
| 141 | const symbolKeepAspect = itemModel.getShallow('symbolKeepAspect'); |
| 142 | |
| 143 | // TODO: refactor needed: single data item should not support callback function |
| 144 | if (isFunction(symbol) || isFunction(symbolSize) || isFunction(symbolRotate) || isFunction(symbolOffset)) { |
| 145 | const rawIdx = mpModel.getRawValue(idx); |
| 146 | const dataParams = mpModel.getDataParams(idx); |
| 147 | if (isFunction(symbol)) { |
| 148 | symbol = symbol(rawIdx, dataParams); |
| 149 | } |
| 150 | if (isFunction(symbolSize)) { |
| 151 | // FIXME 这里不兼容 ECharts 2.x,2.x 貌似参数是整个数据? |
| 152 | symbolSize = symbolSize(rawIdx, dataParams); |
| 153 | } |
| 154 | if (isFunction(symbolRotate)) { |
| 155 | symbolRotate = symbolRotate(rawIdx, dataParams); |
| 156 | } |
| 157 | if (isFunction(symbolOffset)) { |
| 158 | symbolOffset = symbolOffset(rawIdx, dataParams); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | const style = itemModel.getModel('itemStyle').getItemStyle(); |
| 163 | const z2 = itemModel.get('z2'); |
| 164 | const color = getVisualFromData(seriesData, 'color') as ZRColor; |
| 165 | if (!style.fill) { |
| 166 | style.fill = color; |
| 167 | } |
| 168 | |
| 169 | mpData.setItemVisual(idx, { |
| 170 | z2: retrieve2(z2, 0), |
| 171 | symbol: symbol, |
nothing calls this directly
no test coverage detected