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

Class TimelineModel

src/component/timeline/TimelineModel.ts:173–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171 data?: (OptionDataValue | TimelineDataItemOption)[]
172}
173class TimelineModel extends ComponentModel<TimelineOption> {
174
175 static type = 'timeline';
176 type = TimelineModel.type;
177
178 layoutMode = 'box';
179
180 private _data: SeriesData<TimelineModel>;
181
182 private _names: string[];
183
184 /**
185 * @override
186 */
187 init(option: TimelineOption, parentModel: Model, ecModel: GlobalModel) {
188 this.mergeDefaultAndTheme(option, ecModel);
189 this._initData();
190 }
191
192 /**
193 * @override
194 */
195 mergeOption(option: TimelineOption) {
196 super.mergeOption.apply(this, arguments as any);
197 this._initData();
198 }
199
200 setCurrentIndex(currentIndex: number) {
201 if (currentIndex == null) {
202 currentIndex = this.option.currentIndex;
203 }
204 const count = this._data.count();
205
206 if (this.option.loop) {
207 currentIndex = (currentIndex % count + count) % count;
208 }
209 else {
210 currentIndex >= count && (currentIndex = count - 1);
211 currentIndex < 0 && (currentIndex = 0);
212 }
213
214 this.option.currentIndex = currentIndex;
215 }
216
217 /**
218 * @return {number} currentIndex
219 */
220 getCurrentIndex() {
221 return this.option.currentIndex;
222 }
223
224 /**
225 * @return {boolean}
226 */
227 isIndexMax() {
228 return this.getCurrentIndex() >= this._data.count() - 1;
229 }
230

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…