From ab18953eb60f5456c2930ef5a21dc7e89361af6a 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) (cherry picked from commit fb091de2c7c819118d49f1ec3d6dbabbaff2c360) --- 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 973bac8ac38ac..64db72fc03635 100644 --- a/public/app/plugins/panel/barchart/utils.ts +++ b/public/app/plugins/panel/barchart/utils.ts @@ -253,10 +253,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: {