@gravity-ui/charts 1.34.5 → 1.34.6

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.
@@ -5,11 +5,12 @@ async function getHtmlLabel(point, series, xMax) {
5
5
  var _a;
6
6
  const content = String((_a = point.data.label) !== null && _a !== void 0 ? _a : point.data.y);
7
7
  const size = await getLabelsSize({ labels: [content], html: true });
8
+ const width = size.maxWidth;
8
9
  return {
9
- x: Math.min(xMax - size.maxWidth, Math.max(0, point.x)),
10
+ x: Math.min(xMax - size.maxWidth, Math.max(0, point.x - width / 2)),
10
11
  y: Math.max(0, point.y - series.dataLabels.padding - size.maxHeight),
11
12
  content,
12
- size: { width: size.maxWidth, height: size.maxHeight },
13
+ size: { width, height: size.maxHeight },
13
14
  style: series.dataLabels.style,
14
15
  };
15
16
  }
@@ -5,11 +5,12 @@ async function getHtmlLabel(point, series, xMax) {
5
5
  var _a;
6
6
  const content = String((_a = point.data.label) !== null && _a !== void 0 ? _a : point.data.y);
7
7
  const size = await getLabelsSize({ labels: [content], html: true });
8
+ const width = size.maxWidth;
8
9
  return {
9
- x: Math.min(xMax - size.maxWidth, Math.max(0, point.x)),
10
+ x: Math.min(xMax - size.maxWidth, Math.max(0, point.x - width / 2)),
10
11
  y: Math.max(0, point.y - series.dataLabels.padding - size.maxHeight),
11
12
  content,
12
- size: { width: size.maxWidth, height: size.maxHeight },
13
+ size: { width, height: size.maxHeight },
13
14
  style: series.dataLabels.style,
14
15
  };
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/charts",
3
- "version": "1.34.5",
3
+ "version": "1.34.6",
4
4
  "description": "A flexible JavaScript library for data visualization and chart rendering using React",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",