(
start: number,
end: number,
append?: boolean
)
| 379 | } |
| 380 | |
| 381 | private _initDataFromProvider( |
| 382 | start: number, |
| 383 | end: number, |
| 384 | append?: boolean |
| 385 | ): void { |
| 386 | const provider = this._provider; |
| 387 | const chunks = this._chunks; |
| 388 | const dimensions = this._dimensions; |
| 389 | const dimLen = dimensions.length; |
| 390 | const rawExtent = this._rawExtent; |
| 391 | const dimNames = map(dimensions, dim => dim.property); |
| 392 | |
| 393 | for (let i = 0; i < dimLen; i++) { |
| 394 | const dim = dimensions[i]; |
| 395 | if (!rawExtent[i]) { |
| 396 | rawExtent[i] = initExtentForUnion(); |
| 397 | } |
| 398 | prepareStore(chunks, i, dim.type, end, append); |
| 399 | } |
| 400 | |
| 401 | if (provider.fillStorage) { |
| 402 | provider.fillStorage(start, end, chunks, rawExtent); |
| 403 | } |
| 404 | else { |
| 405 | let dataItem = [] as OptionDataItem; |
| 406 | for (let idx = start; idx < end; idx++) { |
| 407 | // NOTICE: Try not to write things into dataItem |
| 408 | dataItem = provider.getItem(idx, dataItem); |
| 409 | // Each data item is value |
| 410 | // [1, 2] |
| 411 | // 2 |
| 412 | // Bar chart, line chart which uses category axis |
| 413 | // only gives the 'y' value. 'x' value is the indices of category |
| 414 | // Use a tempValue to normalize the value to be a (x, y) value |
| 415 | |
| 416 | // Store the data by dimensions |
| 417 | for (let dimIdx = 0; dimIdx < dimLen; dimIdx++) { |
| 418 | const dimStorage = chunks[dimIdx]; |
| 419 | // PENDING NULL is empty or zero |
| 420 | const val = this._dimValueGetter( |
| 421 | dataItem, dimNames[dimIdx], idx, dimIdx |
| 422 | ) as ParsedValueNumeric; |
| 423 | (dimStorage as ParsedValue[])[idx] = val; |
| 424 | |
| 425 | const dimRawExtent = rawExtent[dimIdx]; |
| 426 | val < dimRawExtent[0] && (dimRawExtent[0] = val); |
| 427 | val > dimRawExtent[1] && (dimRawExtent[1] = val); |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | if (!provider.persistent && provider.clean) { |
| 433 | // Clean unused data if data source is typed array. |
| 434 | provider.clean(); |
| 435 | } |
| 436 | |
| 437 | this._rawCount = this._count = end; |
| 438 | // Reset data extent |
no test coverage detected