BarchartPanel: Fix color from thresholds show incorrectly (#52038)

Signed-off-by:  Kyle Cunningham <kyle.cunningham@grafana.com>
This commit is contained in:
mingozh 2022-07-29 04:56:12 +08:00 committed by GitHub
parent 273c37c27d
commit 11c79cd6da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,7 +205,7 @@ export const BarChartPanel: React.FunctionComponent<Props> = ({
};
// 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;
@ -214,7 +214,7 @@ export const BarChartPanel: React.FunctionComponent<Props> = ({
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) => {