From a8dea8ef7e6aff4c9b9ea18079e6dc8713712a1e Mon Sep 17 00:00:00 2001 From: Harold Agudelo Date: Mon, 6 Feb 2023 11:28:17 -0500 Subject: [PATCH] Stacked Bars Colors Fix (#343) * Stacked Bars COlors FIx * Workaround source map warning * No multicolor on singles * fix on long lists --- src/chart/bar/BarChart.tsx | 8 ++++---- webpack.config.js | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/chart/bar/BarChart.tsx b/src/chart/bar/BarChart.tsx index 3802cda85..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 } = bar; - let colorIndex = index; - if (index >= chartColorsByScheme.length) { - colorIndex = index % chartColorsByScheme.length; + let { data, id } = bar; + let colorIndex = Object.keys(data).indexOf(id); + if (colorIndex >= chartColorsByScheme.length) { + colorIndex %= chartColorsByScheme.length; } const dict = {}; 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/], }; };