(
dataInterval: number[],
opts: {
forceState?: ContinuousModel['stateList'][number]
convertOpacityToAlpha?: boolean
}
)
| 529 | } |
| 530 | |
| 531 | private _makeColorGradient( |
| 532 | dataInterval: number[], |
| 533 | opts: { |
| 534 | forceState?: ContinuousModel['stateList'][number] |
| 535 | convertOpacityToAlpha?: boolean |
| 536 | } |
| 537 | ) { |
| 538 | // Considering colorHue, which is not linear, so we have to sample |
| 539 | // to calculate gradient color stops, but not only calculate head |
| 540 | // and tail. |
| 541 | const sampleNumber = 100; // Arbitrary value. |
| 542 | const colorStops: LinearGradientObject['colorStops'] = []; |
| 543 | const step = (dataInterval[1] - dataInterval[0]) / sampleNumber; |
| 544 | |
| 545 | colorStops.push({ |
| 546 | color: this.getControllerVisual(dataInterval[0], 'color', opts) as ColorString, |
| 547 | offset: 0 |
| 548 | }); |
| 549 | |
| 550 | for (let i = 1; i < sampleNumber; i++) { |
| 551 | const currValue = dataInterval[0] + step * i; |
| 552 | if (currValue > dataInterval[1]) { |
| 553 | break; |
| 554 | } |
| 555 | colorStops.push({ |
| 556 | color: this.getControllerVisual(currValue, 'color', opts) as ColorString, |
| 557 | offset: i / sampleNumber |
| 558 | }); |
| 559 | } |
| 560 | |
| 561 | colorStops.push({ |
| 562 | color: this.getControllerVisual(dataInterval[1], 'color', opts) as ColorString, |
| 563 | offset: 1 |
| 564 | }); |
| 565 | |
| 566 | return colorStops; |
| 567 | } |
| 568 | |
| 569 | private _createBarPoints(handleEnds: number[], symbolSizes: number[]) { |
| 570 | const itemSize = this.visualMapModel.itemSize; |
no test coverage detected