MCPcopy
hub / github.com/apache/echarts / _renderSymbols

Method _renderSymbols

src/chart/map/MapView.ts:116–206  ·  view source on GitHub ↗
(mapModel: MapSeries)

Source from the content-addressed store, hash-verified

114 }
115
116 private _renderSymbols(mapModel: MapSeries): void {
117 const originalData = mapModel.originalData;
118 const group = this.group;
119
120 originalData.each(originalData.mapDimension('value'), function (value, originalDataIndex) {
121 if (isNaN(value as number)) {
122 return;
123 }
124
125 const layout = originalData.getItemLayout(originalDataIndex);
126
127 if (!layout || !layout.point) {
128 // Not exists in map
129 return;
130 }
131
132 const point = layout.point;
133 const offset = layout.offset;
134
135 const circle = new graphic.Circle({
136 style: {
137 // Because the special of map draw.
138 // Which needs statistic of multiple series and draw on one map.
139 // And each series also need a symbol with legend color
140 //
141 // Layout and visual are put one the different data
142 // TODO
143 fill: mapModel.getData().getVisual('style').fill
144 },
145 shape: {
146 cx: point[0] + offset * 9,
147 cy: point[1],
148 r: 3
149 },
150 silent: true,
151 // Do not overlap the first series, on which labels are displayed.
152 z2: 8 + (!offset ? Z2_EMPHASIS_LIFT + 1 : 0)
153 });
154
155 // Only the series that has the first value on the same region is in charge of rendering the label.
156 // But consider the case:
157 // series: [
158 // {id: 'X', type: 'map', map: 'm', {data: [{name: 'A', value: 11}, {name: 'B', {value: 22}]},
159 // {id: 'Y', type: 'map', map: 'm', {data: [{name: 'A', value: 21}, {name: 'C', {value: 33}]}
160 // ]
161 // The offset `0` of item `A` is at series `X`, but of item `C` is at series `Y`.
162 // For backward compatibility, we follow the rule that render label `A` by the
163 // settings on series `X` but render label `C` by the settings on series `Y`.
164 if (!offset) {
165 // `mapModel.seriesGroup.f` must not be empty here.
166 const fullData = getMainMapSeries(mapModel.seriesGroup).getData();
167 const name = originalData.getName(originalDataIndex);
168
169 const fullIndex = fullData.indexOfName(name);
170
171 const itemModel = originalData.getItemModel<MapDataItemOption>(originalDataIndex);
172 const labelModel = itemModel.getModel('label');
173

Callers 1

renderMethod · 0.95

Calls 15

getMainMapSeriesFunction · 0.90
setLabelStyleFunction · 0.90
getLabelStatesModelsFunction · 0.90
setStatesFlagFunction · 0.90
mapDimensionMethod · 0.80
getItemLayoutMethod · 0.80
getNameMethod · 0.80
getItemModelMethod · 0.80
getItemGraphicElMethod · 0.80
getVisualMethod · 0.65
getDataMethod · 0.65
eachMethod · 0.45

Tested by

no test coverage detected