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

Method init

src/model/Series.ts:225–265  ·  view source on GitHub ↗
(option: Opt, parentModel: Model, ecModel: GlobalModel)

Source from the content-addressed store, hash-verified

223
224
225 init(option: Opt, parentModel: Model, ecModel: GlobalModel) {
226
227 this.seriesIndex = this.componentIndex;
228
229 this.dataTask = createTask<SeriesTaskContext>({
230 count: dataTaskCount,
231 reset: dataTaskReset
232 });
233 this.dataTask.context = {model: this};
234
235 this.mergeDefaultAndTheme(option, ecModel);
236
237 const sourceManager = inner(this).sourceManager = new SourceManager(this);
238 sourceManager.prepareSource();
239
240 const data = this.getInitialData(option, ecModel);
241 wrapData(data, this);
242 this.dataTask.context.data = data;
243
244 if (__DEV__) {
245 zrUtil.assert(data, 'getInitialData returned invalid data.');
246 }
247
248 inner(this).dataBeforeProcessed = data;
249
250 // If we reverse the order (make data firstly, and then make
251 // dataBeforeProcessed by cloneShallow), cloneShallow will
252 // cause data.graph.data !== data when using
253 // module:echarts/data/Graph or module:echarts/data/Tree.
254 // See module:echarts/data/helper/linkSeriesData
255
256 // Theoretically, it is unreasonable to call `seriesModel.getData()` in the model
257 // init or merge stage, because the data can be restored. So we do not `restoreData`
258 // and `setData` here, which forbids calling `seriesModel.getData()` in this stage.
259 // Call `seriesModel.getRawData()` instead.
260 // this.restoreData();
261
262 autoSeriesName(this);
263
264 this._initSelectedMapFromData(data);
265 }
266
267 /**
268 * Util for merge default and theme to option

Callers

nothing calls this directly

Calls 8

mergeDefaultAndThemeMethod · 0.95
getInitialDataMethod · 0.95
createTaskFunction · 0.90
innerFunction · 0.85
wrapDataFunction · 0.85
autoSeriesNameFunction · 0.85
prepareSourceMethod · 0.80

Tested by

no test coverage detected