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

(cherry picked from commit 8273839539)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2022-09-02 15:05:17 -04:00
committed by GitHub
co-authored by Leon Sorokin
parent c64cecda0c
commit e42f84f87d
@@ -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,