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

Method renderInner

src/component/legend/LegendView.ts:174–325  ·  view source on GitHub ↗
(
        itemAlign: LegendOption['align'],
        legendModel: LegendModel,
        ecModel: GlobalModel,
        api: ExtensionAPI,
        selector: LegendSelectorButtonOption[],
        orient: LegendOption['orient'],
        selectorPosition: LegendOption['selectorPosition']
    )

Source from the content-addressed store, hash-verified

172 }
173
174 protected renderInner(
175 itemAlign: LegendOption['align'],
176 legendModel: LegendModel,
177 ecModel: GlobalModel,
178 api: ExtensionAPI,
179 selector: LegendSelectorButtonOption[],
180 orient: LegendOption['orient'],
181 selectorPosition: LegendOption['selectorPosition']
182 ) {
183 const contentGroup = this.getContentGroup();
184 const legendDrawnMap = zrUtil.createHashMap();
185 const selectMode = legendModel.get('selectedMode');
186 const triggerEvent = legendModel.get('triggerEvent');
187
188 const excludeSeriesId: string[] = [];
189 ecModel.eachRawSeries(function (seriesModel) {
190 !seriesModel.get('legendHoverLink') && excludeSeriesId.push(seriesModel.id);
191 });
192
193 each(legendModel.getData(), function (legendItemModel, dataIndex) {
194 const name = legendItemModel.get('name');
195
196 // Use empty string or \n as a newline string
197 if (!this.newlineDisabled && (name === '' || name === '\n')) {
198 const g = new Group();
199 // @ts-ignore
200 g.newline = true;
201 contentGroup.add(g);
202 return;
203 }
204
205 // Representitive series.
206 const seriesModel = ecModel.getSeriesByName(name)[0] as
207 SeriesModel<SeriesOption & SymbolOptionMixin>;
208
209 if (legendDrawnMap.get(name)) {
210 // Have been drawn
211 return;
212 }
213
214 // Legend to control series.
215 if (seriesModel) {
216 const data = seriesModel.getData();
217 const lineVisualStyle = data.getVisual('legendLineStyle') || {};
218 const legendIcon = data.getVisual('legendIcon');
219
220 /**
221 * `data.getVisual('style')` may be the color from the register
222 * in series. For example, for line series,
223 */
224 const style = data.getVisual('style');
225
226 const itemGroup = this._createItem(
227 seriesModel, name, dataIndex,
228 legendItemModel, legendModel, itemAlign,
229 lineVisualStyle, style, legendIcon, selectMode, api
230 );
231

Callers 1

renderMethod · 0.95

Calls 15

getContentGroupMethod · 0.95
_createItemMethod · 0.95
packEventDataMethod · 0.95
_createSelectorMethod · 0.95
parseFunction · 0.85
eachRawSeriesMethod · 0.80
getSeriesByNameMethod · 0.80
containNameMethod · 0.80
getDataMethod · 0.65
getVisualMethod · 0.65
eachFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected