mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Histogram Panel: Take decimal into consideration (#47330)
This commit is contained in:
parent
0845ba1abb
commit
0639ccbdff
@ -159,7 +159,9 @@ export function buildHistogram(frames: DataFrame[], options?: HistogramTransform
|
||||
for (const frame of frames) {
|
||||
for (const field of frame.fields) {
|
||||
if (field.type === FieldType.number) {
|
||||
allValues = allValues.concat(field.values.toArray());
|
||||
allValues = allValues.concat(
|
||||
field.values.toArray().map((val: number) => Number(val.toFixed(field.config.decimals ?? 0)))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,7 +219,7 @@ export function buildHistogram(frames: DataFrame[], options?: HistogramTransform
|
||||
unit: undefined,
|
||||
},
|
||||
});
|
||||
if (!config && field.config.unit) {
|
||||
if (!config && Object.keys(field.config).length) {
|
||||
config = field.config;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user