From 9c779fd805bd519b9f7bf31261287d84c8167add Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 1 Aug 2022 05:00:13 -0400 Subject: [PATCH] BarchartPanel: Fix color from thresholds show incorrectly (#52038) (#52968) Signed-off-by: Kyle Cunningham (cherry picked from commit 11c79cd6da1cf4824e1a48d98d0b5935b1a22351) Co-authored-by: mingozh <77652617+mingozh@users.noreply.github.com> --- public/app/plugins/panel/barchart/BarChartPanel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/barchart/BarChartPanel.tsx b/public/app/plugins/panel/barchart/BarChartPanel.tsx index ed92a49d1db..3b8a5411b48 100755 --- a/public/app/plugins/panel/barchart/BarChartPanel.tsx +++ b/public/app/plugins/panel/barchart/BarChartPanel.tsx @@ -188,7 +188,7 @@ export const BarChartPanel: React.FunctionComponent = ({ data, options, w }; // Color by value - let getColor: ((seriesIdx: number, valueIdx: number) => string) | undefined = undefined; + let getColor: ((seriesIdx: number, valueIdx: number, value: any) => string) | undefined = undefined; let fillOpacity = 1; @@ -197,7 +197,7 @@ export const BarChartPanel: React.FunctionComponent = ({ data, options, w const disp = colorByField.display!; fillOpacity = (colorByField.config.custom.fillOpacity ?? 100) / 100; // gradientMode? ignore? - getColor = (seriesIdx: number, valueIdx: number) => disp(colorByField.values.get(valueIdx)).color!; + getColor = (seriesIdx: number, valueIdx: number, value: any) => disp(value).color!; } const prepConfig = (alignedFrame: DataFrame, allFrames: DataFrame[], getTimeRange: () => TimeRange) => {