@gravity-ui/charts 1.34.6 → 1.34.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -62,7 +62,8 @@ export const prepareLineData = async (args) => {
|
|
|
62
62
|
for (let index = 0; index < points.length; index++) {
|
|
63
63
|
const point = points[index];
|
|
64
64
|
if (point.y !== null && point.x !== null) {
|
|
65
|
-
const
|
|
65
|
+
const labelValue = (_b = point.data.label) !== null && _b !== void 0 ? _b : point.data.y;
|
|
66
|
+
const text = getFormattedValue(Object.assign({ value: labelValue }, s.dataLabels));
|
|
66
67
|
const labelSize = await getTextSize(text);
|
|
67
68
|
const style = s.dataLabels.style;
|
|
68
69
|
const y = Math.max(yAxisTop, point.y - s.dataLabels.padding - labelSize.height);
|
|
@@ -21,7 +21,10 @@ export function getFormattedValue(args) {
|
|
|
21
21
|
const { value, format } = args;
|
|
22
22
|
switch (format === null || format === void 0 ? void 0 : format.type) {
|
|
23
23
|
case 'number': {
|
|
24
|
-
|
|
24
|
+
if (typeof value === 'number') {
|
|
25
|
+
return formatNumber(Number(value), format);
|
|
26
|
+
}
|
|
27
|
+
break;
|
|
25
28
|
}
|
|
26
29
|
case 'date': {
|
|
27
30
|
return getFormattedDate({ value, format: format.format });
|
|
@@ -62,7 +62,8 @@ export const prepareLineData = async (args) => {
|
|
|
62
62
|
for (let index = 0; index < points.length; index++) {
|
|
63
63
|
const point = points[index];
|
|
64
64
|
if (point.y !== null && point.x !== null) {
|
|
65
|
-
const
|
|
65
|
+
const labelValue = (_b = point.data.label) !== null && _b !== void 0 ? _b : point.data.y;
|
|
66
|
+
const text = getFormattedValue(Object.assign({ value: labelValue }, s.dataLabels));
|
|
66
67
|
const labelSize = await getTextSize(text);
|
|
67
68
|
const style = s.dataLabels.style;
|
|
68
69
|
const y = Math.max(yAxisTop, point.y - s.dataLabels.padding - labelSize.height);
|
|
@@ -21,7 +21,10 @@ export function getFormattedValue(args) {
|
|
|
21
21
|
const { value, format } = args;
|
|
22
22
|
switch (format === null || format === void 0 ? void 0 : format.type) {
|
|
23
23
|
case 'number': {
|
|
24
|
-
|
|
24
|
+
if (typeof value === 'number') {
|
|
25
|
+
return formatNumber(Number(value), format);
|
|
26
|
+
}
|
|
27
|
+
break;
|
|
25
28
|
}
|
|
26
29
|
case 'date': {
|
|
27
30
|
return getFormattedDate({ value, format: format.format });
|