From 8b9bc9a9193c4743a7bbc22f2313aef8546f5356 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Wed, 6 Mar 2024 12:50:28 -0600 Subject: [PATCH] Histogram: Fix 'combine' option & legend rendering (#84026) --- .../src/transformations/transformers/histogram.ts | 7 ++++++- public/app/plugins/panel/histogram/Histogram.tsx | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/grafana-data/src/transformations/transformers/histogram.ts b/packages/grafana-data/src/transformations/transformers/histogram.ts index ea5ea3c9770..39d54ffeda9 100644 --- a/packages/grafana-data/src/transformations/transformers/histogram.ts +++ b/packages/grafana-data/src/transformations/transformers/histogram.ts @@ -482,7 +482,12 @@ export function buildHistogram(frames: DataFrame[], options?: HistogramTransform name: 'count', values: vals, type: FieldType.number, - state: undefined, + state: { + ...counts[0].state, + displayName: 'Count', + multipleFrames: false, + origin: { frameIndex: 0, fieldIndex: 2 }, + }, }, ]; } else { diff --git a/public/app/plugins/panel/histogram/Histogram.tsx b/public/app/plugins/panel/histogram/Histogram.tsx index a2bb2ae2783..160db11fe36 100644 --- a/public/app/plugins/panel/histogram/Histogram.tsx +++ b/public/app/plugins/panel/histogram/Histogram.tsx @@ -312,7 +312,9 @@ export class Histogram extends React.Component { return null; } - return ; + const frames = this.props.options.combine ? [this.props.alignedFrame] : this.props.rawSeries!; + + return ; } componentDidUpdate(prevProps: HistogramProps) {