@lobehub/charts 1.9.12 → 1.9.13

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.
@@ -25,12 +25,14 @@ var ChartLabels = /*#__PURE__*/memo(function (_ref) {
25
25
  return null;
26
26
  }
27
27
  var dayIndex = (index + weekStart) % 7;
28
+ var maxLength = Math.floor((blockSize * 7 + blockMargin * 6) / 12);
29
+ var label = (labels === null || labels === void 0 || (_labels$weekdays = labels.weekdays) === null || _labels$weekdays === void 0 ? void 0 : _labels$weekdays[dayIndex]) || '';
28
30
  return /*#__PURE__*/_jsx("text", {
29
31
  dominantBaseline: "middle",
30
32
  textAnchor: "end",
31
33
  x: -labelMargin,
32
34
  y: labelHeight + (blockSize + blockMargin) * index + blockSize / 2,
33
- children: labels === null || labels === void 0 || (_labels$weekdays = labels.weekdays) === null || _labels$weekdays === void 0 ? void 0 : _labels$weekdays[dayIndex]
35
+ children: label.length > maxLength ? label.slice(0, maxLength) + '...' : label
34
36
  }, index);
35
37
  })
36
38
  }), !hideMonthLabels && /*#__PURE__*/_jsx("g", {
@@ -38,10 +40,11 @@ var ChartLabels = /*#__PURE__*/memo(function (_ref) {
38
40
  children: getMonthLabels(weeks, labels.months).map(function (_ref2) {
39
41
  var label = _ref2.label,
40
42
  weekIndex = _ref2.weekIndex;
43
+ var maxLength = Math.floor((blockSize * 4 + blockMargin * 3) / 12);
41
44
  return /*#__PURE__*/_jsx("text", {
42
45
  dominantBaseline: "hanging",
43
46
  x: (blockSize + blockMargin) * weekIndex,
44
- children: label
47
+ children: label.length > maxLength ? label.slice(0, maxLength) + '...' : label
45
48
  }, weekIndex);
46
49
  })
47
50
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/charts",
3
- "version": "1.9.12",
3
+ "version": "1.9.13",
4
4
  "description": "React modern charts components built on recharts",
5
5
  "keywords": [
6
6
  "lobehub",