Histogram: Fix 'combine' option & legend rendering (#84026)

This commit is contained in:
Leon Sorokin 2024-03-06 12:50:28 -06:00 committed by GitHub
parent 61f6c4f84d
commit 8b9bc9a919
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -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 {

View File

@ -312,7 +312,9 @@ export class Histogram extends React.Component<HistogramProps, State> {
return null;
}
return <PlotLegend data={this.props.rawSeries!} config={config} maxHeight="35%" maxWidth="60%" {...legend} />;
const frames = this.props.options.combine ? [this.props.alignedFrame] : this.props.rawSeries!;
return <PlotLegend data={frames} config={config} maxHeight="35%" maxWidth="60%" {...legend} />;
}
componentDidUpdate(prevProps: HistogramProps) {