From fb091de2c7c819118d49f1ec3d6dbabbaff2c360 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Wed, 15 Sep 2021 13:10:26 -0500 Subject: [PATCH] BarChart: Fix legend and tooltip colors off by 1 after data refresh (#39234) --- public/app/plugins/panel/barchart/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/app/plugins/panel/barchart/utils.ts b/public/app/plugins/panel/barchart/utils.ts index d4ddf052ec9..893e0e90df0 100644 --- a/public/app/plugins/panel/barchart/utils.ts +++ b/public/app/plugins/panel/barchart/utils.ts @@ -246,10 +246,16 @@ export function prepareGraphableFrames( }; } + let seriesIndex = 0; + for (let frame of series) { const fields: Field[] = []; for (const field of frame.fields) { if (field.type === FieldType.number) { + field.state = field.state ?? {}; + + field.state.seriesIndex = seriesIndex++; + let copy = { ...field, config: {