From fe7b594bbd7d73961a8af4f3a19421024be6c132 Mon Sep 17 00:00:00 2001 From: Leon Sorokin <leeoniya@gmail.com> Date: Mon, 25 Apr 2022 23:57:59 -0500 Subject: [PATCH] TimeSeries: update frame.length when syncing bar widths (#48223) --- packages/grafana-ui/src/components/GraphNG/utils.test.ts | 2 +- packages/grafana-ui/src/components/GraphNG/utils.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/grafana-ui/src/components/GraphNG/utils.test.ts b/packages/grafana-ui/src/components/GraphNG/utils.test.ts index 31a4bb00209..23efa7a7726 100644 --- a/packages/grafana-ui/src/components/GraphNG/utils.test.ts +++ b/packages/grafana-ui/src/components/GraphNG/utils.test.ts @@ -499,7 +499,7 @@ describe('GraphNG utils', () => { ], }, ], - "length": 10, + "length": 12, } `); }); diff --git a/packages/grafana-ui/src/components/GraphNG/utils.ts b/packages/grafana-ui/src/components/GraphNG/utils.ts index 3abea36bb97..5d35a8e3926 100644 --- a/packages/grafana-ui/src/components/GraphNG/utils.ts +++ b/packages/grafana-ui/src/components/GraphNG/utils.ts @@ -13,7 +13,9 @@ import { nullToUndefThreshold } from './nullToUndefThreshold'; import { XYFieldMatchers } from './types'; function isVisibleBarField(f: Field) { - return f.config.custom?.drawStyle === GraphDrawStyle.Bars && !f.config.custom?.hideFrom?.viz; + return ( + f.type === FieldType.number && f.config.custom?.drawStyle === GraphDrawStyle.Bars && !f.config.custom?.hideFrom?.viz + ); } // will mutate the DataFrame's fields' values @@ -105,6 +107,8 @@ export function preparePlotFrame(frames: DataFrame[], dimFields: XYFieldMatchers vals.push(undefined, undefined); } }); + + alignedFrame.length += 2; } return alignedFrame;