From fbf1bb6895a506c01d5ae67c35be3f78635a5cf4 Mon Sep 17 00:00:00 2001 From: Bennu Date: Mon, 6 Feb 2023 15:39:39 +0100 Subject: [PATCH 1/4] Stacked Bars COlors FIx --- src/chart/bar/BarChart.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chart/bar/BarChart.tsx b/src/chart/bar/BarChart.tsx index 3802cda85..db82cfd1c 100644 --- a/src/chart/bar/BarChart.tsx +++ b/src/chart/bar/BarChart.tsx @@ -110,8 +110,8 @@ const NeoBarChart = (props: ChartProps) => { // Compute bar color based on rules - overrides default color scheme completely. const getBarColor = (bar) => { - let { index } = bar; - let colorIndex = index; + let { index, data, id } = bar; + let colorIndex = Object.keys(data).length > 2 ? Object.keys(data).indexOf(id) : index; if (index >= chartColorsByScheme.length) { colorIndex = index % chartColorsByScheme.length; } From 58a85bbe43fd0cc636f02d666431d31c6a638227 Mon Sep 17 00:00:00 2001 From: Bennu Date: Mon, 6 Feb 2023 15:49:22 +0100 Subject: [PATCH 2/4] Workaround source map warning --- webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/webpack.config.js b/webpack.config.js index 1c542a5d1..b2ac6dfe5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -44,5 +44,6 @@ module.exports = (env) => { hot: true, }, plugins: production ? [] : [new webpack.HotModuleReplacementPlugin()], + ignoreWarnings: [/Failed to parse source map/], }; }; From 44882b7722fa48da3a9ee91e55ebfab8a552077d Mon Sep 17 00:00:00 2001 From: Bennu Date: Mon, 6 Feb 2023 16:11:17 +0100 Subject: [PATCH 3/4] No multicolor on singles --- src/chart/bar/BarChart.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chart/bar/BarChart.tsx b/src/chart/bar/BarChart.tsx index db82cfd1c..c043cad79 100644 --- a/src/chart/bar/BarChart.tsx +++ b/src/chart/bar/BarChart.tsx @@ -111,7 +111,7 @@ const NeoBarChart = (props: ChartProps) => { // Compute bar color based on rules - overrides default color scheme completely. const getBarColor = (bar) => { let { index, data, id } = bar; - let colorIndex = Object.keys(data).length > 2 ? Object.keys(data).indexOf(id) : index; + let colorIndex = Object.keys(data).indexOf(id); if (index >= chartColorsByScheme.length) { colorIndex = index % chartColorsByScheme.length; } From 6fc93081cd7b055ea6dfa8e00f635fe9124f717d Mon Sep 17 00:00:00 2001 From: Bennu Date: Mon, 6 Feb 2023 16:48:18 +0100 Subject: [PATCH 4/4] fix on long lists --- src/chart/bar/BarChart.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chart/bar/BarChart.tsx b/src/chart/bar/BarChart.tsx index c043cad79..7aa6e194b 100644 --- a/src/chart/bar/BarChart.tsx +++ b/src/chart/bar/BarChart.tsx @@ -110,10 +110,10 @@ const NeoBarChart = (props: ChartProps) => { // Compute bar color based on rules - overrides default color scheme completely. const getBarColor = (bar) => { - let { index, data, id } = bar; + let { data, id } = bar; let colorIndex = Object.keys(data).indexOf(id); - if (index >= chartColorsByScheme.length) { - colorIndex = index % chartColorsByScheme.length; + if (colorIndex >= chartColorsByScheme.length) { + colorIndex %= chartColorsByScheme.length; } const dict = {};