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

Class DataFormatMixin

src/model/mixin/dataFormat.ts:53–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53export class DataFormatMixin {
54
55 /**
56 * Get params for formatter
57 */
58 getDataParams(
59 dataIndex: number,
60 dataType?: SeriesDataType
61 ): CallbackDataParams {
62
63 const data = this.getData(dataType);
64 const rawValue = this.getRawValue(dataIndex, dataType);
65 const rawDataIndex = data.getRawIndex(dataIndex);
66 const name = data.getName(dataIndex);
67 const itemOpt = data.getRawDataItem(dataIndex);
68 const style = data.getItemVisual(dataIndex, 'style');
69 const color = style && style[data.getItemVisual(dataIndex, 'drawType') || 'fill'] as ZRColor;
70 const borderColor = style && style.stroke as ColorString;
71 const mainType = this.mainType;
72 const isSeries = mainType === 'series';
73 const userOutput = data.userOutput && data.userOutput.get();
74
75 return {
76 componentType: mainType,
77 componentSubType: this.subType,
78 componentIndex: this.componentIndex,
79 seriesType: isSeries ? this.subType : null,
80 seriesIndex: (this as any).seriesIndex,
81 seriesId: isSeries ? this.id : null,
82 seriesName: isSeries ? this.name : null,
83 name: name,
84 dataIndex: rawDataIndex,
85 data: itemOpt,
86 dataType: dataType,
87 value: rawValue,
88 color: color,
89 borderColor: borderColor,
90 dimensionNames: userOutput ? userOutput.fullDimensions : null,
91 encode: userOutput ? userOutput.encode : null,
92
93 // Param name list for mapping `a`, `b`, `c`, `d`, `e`
94 $vars: ['seriesName', 'name', 'value']
95 };
96 }
97
98 /**
99 * Format label
100 * @param dataIndex
101 * @param status 'normal' by default
102 * @param dataType
103 * @param labelDimIndex Only used in some chart that
104 * use formatter in different dimensions, like radar.
105 * @param formatter Formatter given outside.
106 * @return return null/undefined if no formatter
107 */
108 getFormattedLabel(
109 dataIndex: number,
110 status?: DisplayState,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…