Histogram: ensure y axis is unit-less (#54667)

This commit is contained in:
Leon Sorokin 2022-09-02 13:50:01 -05:00 committed by GitHub
parent aa897e4f40
commit 8273839539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,7 +220,7 @@ export function buildHistogram(frames: DataFrame[], options?: HistogramTransform
...field,
config: {
...field.config,
unit: undefined,
unit: field.config.unit === 'short' ? 'short' : undefined,
},
});
if (!config && field.config.unit) {
@ -371,6 +371,13 @@ export function histogramFieldsToFrame(info: HistogramFields, theme?: GrafanaThe
info.bucketMin.display = display;
info.bucketMax.display = display;
}
// ensure updated units are reflected on the count field used for y axis formatting
info.counts[0].display = getDisplayProcessor({
field: info.counts[0],
theme: theme ?? createTheme(),
});
return {
fields: [info.bucketMin, info.bucketMax, ...info.counts],
length: info.bucketMin.values.length,