* @private
()
| 363 | * @private |
| 364 | */ |
| 365 | _dataCheck() { |
| 366 | const dataset = this.getDataset(); |
| 367 | const data = dataset.data || (dataset.data = []); |
| 368 | const _data = this._data; |
| 369 | |
| 370 | // In order to correctly handle data addition/deletion animation (and thus simulate |
| 371 | // real-time charts), we need to monitor these data modifications and synchronize |
| 372 | // the internal metadata accordingly. |
| 373 | |
| 374 | if (isObject(data)) { |
| 375 | const meta = this._cachedMeta; |
| 376 | this._data = convertObjectDataToArray(data, meta); |
| 377 | } else if (_data !== data) { |
| 378 | if (_data) { |
| 379 | // This case happens when the user replaced the data array instance. |
| 380 | unlistenArrayEvents(_data, this); |
| 381 | // Discard old parsed data and stacks |
| 382 | const meta = this._cachedMeta; |
| 383 | clearStacks(meta); |
| 384 | meta._parsed = []; |
| 385 | } |
| 386 | if (data && Object.isExtensible(data)) { |
| 387 | listenArrayEvents(data, this); |
| 388 | } |
| 389 | this._syncList = []; |
| 390 | this._data = data; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | addElements() { |
| 395 | const meta = this._cachedMeta; |
no test coverage detected