Histogram Panel: Take decimal into consideration (#47330)
This commit is contained in:
@@ -159,7 +159,9 @@ export function buildHistogram(frames: DataFrame[], options?: HistogramTransform
|
|||||||
for (const frame of frames) {
|
for (const frame of frames) {
|
||||||
for (const field of frame.fields) {
|
for (const field of frame.fields) {
|
||||||
if (field.type === FieldType.number) {
|
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,
|
unit: undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!config && field.config.unit) {
|
if (!config && Object.keys(field.config).length) {
|
||||||
config = field.config;
|
config = field.config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user