@pioneer-code/pioneer-charts 22.2.11 → 22.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1969,7 +1969,8 @@ class PcacLineAreaChartConfig extends PcacAxisChartConfig {
|
|
|
1969
1969
|
enableZoomX = false;
|
|
1970
1970
|
enableZoomY = false;
|
|
1971
1971
|
/**
|
|
1972
|
-
* Hex color codes to override the default colors
|
|
1972
|
+
* Hex color codes to override the default colors, one per series in order. Repeats from the
|
|
1973
|
+
* start when there are more series than colors, as the default palette does.
|
|
1973
1974
|
*/
|
|
1974
1975
|
colorOverride = [];
|
|
1975
1976
|
/**
|
|
@@ -2641,9 +2642,13 @@ class PlaChartBuilder extends PcacChart {
|
|
|
2641
2642
|
}
|
|
2642
2643
|
// `?.length`, not a bare truthiness check: PcacLineAreaChartConfig defaults colorOverride to
|
|
2643
2644
|
// `[]`, and an empty array is truthy - a config built with `new` would otherwise replace the
|
|
2644
|
-
// theme palette with nothing and every series would render with no color at all.
|
|
2645
|
-
|
|
2646
|
-
|
|
2645
|
+
// theme palette with nothing and every series would render with no color at all. Cycled out to
|
|
2646
|
+
// as many entries as `initializeChartState` gave the theme palette, the same way that palette
|
|
2647
|
+
// cycles its own colors, so an override shorter than the data repeats rather than leaving every
|
|
2648
|
+
// series past its end with an `undefined` color (and so no line, dot stroke or range).
|
|
2649
|
+
const override = this.config.colorOverride;
|
|
2650
|
+
if (override?.length) {
|
|
2651
|
+
this.colors = Array.from({ length: Math.max(this.colors.length, override.length) }, (_, i) => override[i % override.length]);
|
|
2647
2652
|
}
|
|
2648
2653
|
this.scales = new PlaChartScalesBuilder().build(this.xAxis, this.yAxis, this.config.data, this.width, this.height);
|
|
2649
2654
|
this.lineGenerator = buildLineGenerator(this.xAxis.format, this.scales);
|