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

Method init

src/component/dataZoom/DataZoomModel.ts:199–229  ·  view source on GitHub ↗
(option: Opts, parentModel: Model, ecModel: GlobalModel)

Source from the content-addressed store, hash-verified

197 settledOption: Opts;
198
199 init(option: Opts, parentModel: Model, ecModel: GlobalModel): void {
200
201 const inputRawOption = retrieveRawOption(option);
202
203 /**
204 * Suppose a "main process" start at the point that model prepared (that is,
205 * model initialized or merged or method called in `action`).
206 * We should keep the `main process` idempotent, that is, given a set of values
207 * on `option`, we get the same result.
208 *
209 * But sometimes, values on `option` will be updated for providing users
210 * a "final calculated value" (`dataZoomProcessor` will do that). Those value
211 * should not be the base/input of the `main process`.
212 *
213 * So in that case we should save and keep the input of the `main process`
214 * separately, called `settledOption`.
215 *
216 * For example, consider the case:
217 * (Step_1) brush zoom the grid by `toolbox.dataZoom`,
218 * where the original input `option.startValue`, `option.endValue` are earsed by
219 * calculated value.
220 * (Step)2) click the legend to hide and show a series,
221 * where the new range is calculated by the earsed `startValue` and `endValue`,
222 * which brings incorrect result.
223 */
224 this.settledOption = inputRawOption;
225
226 this.mergeDefaultAndTheme(option, ecModel);
227
228 this._doInit(inputRawOption);
229 }
230
231 mergeOption(newOption: Opts): void {
232 const inputRawOption = retrieveRawOption(newOption);

Callers

nothing calls this directly

Calls 3

_doInitMethod · 0.95
retrieveRawOptionFunction · 0.85
mergeDefaultAndThemeMethod · 0.45

Tested by

no test coverage detected