From 0857a0a1713f0d7cfa61eaa845cf9f782246a8ee Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 1 Aug 2022 05:04:57 -0400 Subject: [PATCH] BarchartPanel: Fix color from thresholds show incorrectly (#52038) (#52969) 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 7072eae680f..1a7fde5392e 100644 --- a/public/app/plugins/panel/barchart/BarChartPanel.tsx +++ b/public/app/plugins/panel/barchart/BarChartPanel.tsx @@ -208,7 +208,7 @@ export const BarChartPanel: React.FunctionComponent = ({ }; // Color by value - let getColor: ((seriesIdx: number, valueIdx: number) => string) | undefined = undefined; + let getColor: ((seriesIdx: number, valueIdx: number, value: number) => string) | undefined = undefined; let fillOpacity = 1; @@ -217,7 +217,7 @@ export const BarChartPanel: React.FunctionComponent = ({ 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: number) => disp(value).color!; } const prepConfig = (alignedFrame: DataFrame, allFrames: DataFrame[], getTimeRange: () => TimeRange) => {