* Travel data for one time, get activeState of each data item. * @param start the start dataIndex that travel from. * @param end the next dataIndex of the last dataIndex will be travel.
(
data: SeriesData,
callback: (activeState: ParallelActiveState, dataIndex: number) => void,
start?: number,
end?: number
)
| 333 | * @param end the next dataIndex of the last dataIndex will be travel. |
| 334 | */ |
| 335 | eachActiveState( |
| 336 | data: SeriesData, |
| 337 | callback: (activeState: ParallelActiveState, dataIndex: number) => void, |
| 338 | start?: number, |
| 339 | end?: number |
| 340 | ): void { |
| 341 | start == null && (start = 0); |
| 342 | end == null && (end = data.count()); |
| 343 | |
| 344 | const axesMap = this._axesMap; |
| 345 | const dimensions = this.dimensions; |
| 346 | const dataDimensions = [] as DimensionName[]; |
| 347 | const axisModels = [] as ParallelAxisModel[]; |
| 348 | |
| 349 | each(dimensions, function (axisDim) { |
| 350 | dataDimensions.push(data.mapDimension(axisDim)); |
| 351 | axisModels.push(axesMap.get(axisDim).model); |
| 352 | }); |
| 353 | |
| 354 | const hasActiveSet = this.hasAxisBrushed(); |
| 355 | |
| 356 | for (let dataIndex = start; dataIndex < end; dataIndex++) { |
| 357 | let activeState: ParallelActiveState; |
| 358 | |
| 359 | if (!hasActiveSet) { |
| 360 | activeState = 'normal'; |
| 361 | } |
| 362 | else { |
| 363 | activeState = 'active'; |
| 364 | const values = data.getValues(dataDimensions, dataIndex); |
| 365 | for (let j = 0, lenj = dimensions.length; j < lenj; j++) { |
| 366 | const state = axisModels[j].getActiveState(values[j]); |
| 367 | |
| 368 | if (state === 'inactive') { |
| 369 | activeState = 'inactive'; |
| 370 | break; |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | callback(activeState, dataIndex); |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * Whether has any activeSet. |
no test coverage detected