(
stateList: readonly VisualState[],
visualMappings: VisualMappingCollection<VisualState>,
getValueState: (valueOrIndex: ParsedValue | number) => VisualState,
dim?: DimensionLoose
)
| 197 | * @param dim dimension or dimension index. |
| 198 | */ |
| 199 | export function incrementalApplyVisual<VisualState extends string>( |
| 200 | stateList: readonly VisualState[], |
| 201 | visualMappings: VisualMappingCollection<VisualState>, |
| 202 | getValueState: (valueOrIndex: ParsedValue | number) => VisualState, |
| 203 | dim?: DimensionLoose |
| 204 | ): StageHandlerProgressExecutor { |
| 205 | const visualTypesMap: Partial<Record<VisualState, BuiltinVisualProperty[]>> = {}; |
| 206 | zrUtil.each(stateList, function (state) { |
| 207 | const visualTypes = VisualMapping.prepareVisualTypes(visualMappings[state]); |
| 208 | visualTypesMap[state] = visualTypes; |
| 209 | }); |
| 210 | |
| 211 | return { |
| 212 | progress: function progress(params, data) { |
| 213 | let dimIndex: DimensionIndex; |
| 214 | if (dim != null) { |
| 215 | dimIndex = data.getDimensionIndex(dim); |
| 216 | } |
| 217 | |
| 218 | function getVisual(key: string) { |
| 219 | return getItemVisualFromData(data, dataIndex, key) as string | number; |
| 220 | } |
| 221 | |
| 222 | function setVisual(key: string, value: any) { |
| 223 | setItemVisualFromData(data, dataIndex, key, value); |
| 224 | } |
| 225 | |
| 226 | let dataIndex: number; |
| 227 | const store = data.getStore(); |
| 228 | while ((dataIndex = params.next()) != null) { |
| 229 | const rawDataItem = data.getRawDataItem(dataIndex); |
| 230 | |
| 231 | // Consider performance |
| 232 | // @ts-ignore |
| 233 | if (rawDataItem && rawDataItem.visualMap === false) { |
| 234 | continue; |
| 235 | } |
| 236 | |
| 237 | const value = dim != null |
| 238 | ? store.get(dimIndex, dataIndex) |
| 239 | : dataIndex; |
| 240 | |
| 241 | const valueState = getValueState(value); |
| 242 | const mappings = visualMappings[valueState]; |
| 243 | const visualTypes = visualTypesMap[valueState]; |
| 244 | |
| 245 | for (let i = 0, len = visualTypes.length; i < len; i++) { |
| 246 | const type = visualTypes[i]; |
| 247 | mappings[type] && mappings[type].applyVisual(value, getVisual, setVisual); |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | }; |
| 252 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…