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