MCPcopy Index your code
hub / github.com/apache/echarts / incrementalApplyVisual

Function incrementalApplyVisual

src/visual/visualSolution.ts:199–252  ·  view source on GitHub ↗
(
    stateList: readonly VisualState[],
    visualMappings: VisualMappingCollection<VisualState>,
    getValueState: (valueOrIndex: ParsedValue | number) => VisualState,
    dim?: DimensionLoose
)

Source from the content-addressed store, hash-verified

197 * @param dim dimension or dimension index.
198 */
199export 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}

Callers

nothing calls this directly

Calls 8

prepareVisualTypesMethod · 0.80
getDimensionIndexMethod · 0.80
getStoreMethod · 0.80
nextMethod · 0.80
applyVisualMethod · 0.80
eachMethod · 0.45
getRawDataItemMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…