reCreateSeriesIndices = function (ecModel: GlobalModel): void { // 这里重新维护了要渲染的 series 列表(ecModel._seriesIndices) constseriesIndices: number[] = ecModel._seriesIndices = []; each(ecModel._componentsMap.get('series'), function (series) { // series may have been removed by `replaceMerge`. series && seriesIndices.push(series.componentIndex); }); ecModel._seriesIndicesMap = createHashMap(seriesIndices); };
const legendModels = ecModel.findComponents({ mainType: 'legend' }) asLegendModel[]; if (legendModels && legendModels.length) { // 这里根据 legendModel 对 Series 做了 filter ecModel.filterSeries(function (series: SeriesModel) { // If in any legend component the status is not selected. // Because in legend series is assumed selected when it is not in the legend data. for (let i = 0; i < legendModels.length; i++) { if (!legendModels[i].isSelected(series.name)) { returnfalse; } } returntrue; }); }