[v10.0.x] XYChart: Fix formatting of axis ticks (units, decimals) (#70193)

XYChart: Fix formatting of axis ticks (units, decimals) (#70190)

(cherry picked from commit 94881597d8)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2023-06-15 16:46:42 +00:00
committed by GitHub
co-authored by Leon Sorokin
parent e9a8bc8b2e
commit 18303f09b3
+3 -1
View File
@@ -5,6 +5,7 @@ import {
DataFrame,
FieldColorModeId,
fieldColorModeRegistry,
formattedValueToString,
getDisplayProcessor,
getFieldColorModeForField,
getFieldDisplayName,
@@ -620,6 +621,7 @@ const prepConfig = (
xAxisLabel == null || xAxisLabel === ''
? getFieldDisplayName(xField, scatterSeries[0].frame(frames), frames)
: xAxisLabel,
formatValue: (v, decimals) => formattedValueToString(xField.display!(v, decimals)),
});
scatterSeries.forEach((s, si) => {
@@ -653,7 +655,7 @@ const prepConfig = (
yAxisLabel == null || yAxisLabel === ''
? getFieldDisplayName(field, scatterSeries[si].frame(frames), frames)
: yAxisLabel,
values: (u, splits) => splits.map((s) => field.display!(s).text),
formatValue: (v, decimals) => formattedValueToString(field.display!(v, decimals)),
});
}