@easyv/charts 1.10.7 → 1.10.9

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.
@@ -261,15 +261,20 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
261
261
  }, [tickName, JSON.stringify(originData)]);
262
262
  var showTooltip = !!(tooltipData && tooltipData.length && (auto || manual));
263
263
  var isVertical = axisX.direction === "vertical";
264
- var indicatorWidth = indicator.width * (control ? axisX.controlStep : axisX.step) / 100;
265
- var position = axisX.scaler(tickName) - indicatorWidth / 2;
264
+ var axisStep = control ? axisX.controlStep : axisX.step;
265
+ var safeAxisStep = Number.isFinite(axisStep) ? axisStep : 0;
266
+ var indicatorWidth = indicator.width * safeAxisStep / 100;
267
+ var safeIndicatorWidth = Number.isFinite(indicatorWidth) ? indicatorWidth : 0;
268
+ var tickPos = axisX.scaler(tickName);
269
+ var safeTickPos = Number.isFinite(tickPos) ? tickPos : 0;
270
+ var position = safeTickPos - safeIndicatorWidth / 2;
266
271
  var indicatorAttr = isVertical ? {
267
272
  width: chartWidth,
268
- height: indicatorWidth,
273
+ height: safeIndicatorWidth,
269
274
  y: position
270
275
  } : {
271
276
  height: yLineRange,
272
- width: indicatorWidth,
277
+ width: safeIndicatorWidth,
273
278
  x: position
274
279
  };
275
280
  var onInteraction = (0, _react.useCallback)(function (e, type) {
@@ -353,15 +358,18 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
353
358
  if (controlEl.current) {
354
359
  controlEl.current.style.transform = "translate(".concat(cBarX, "px,0)");
355
360
  //计算出当前位移的百分比
356
- var percent = cBarX / (cWidth - cBarWidth);
357
- percent = isNaN(percent) ? 1 : percent;
358
- var translateX = -(controlEnd + start / cPercent - chartWidth) * percent;
361
+ var slideRange = cWidth - cBarWidth;
362
+ var percent = slideRange > 0 ? cBarX / slideRange : 0;
363
+ if (!Number.isFinite(percent)) percent = 0;
364
+ var safeCPercent = cPercent > 0 && Number.isFinite(cPercent) ? cPercent : 1;
365
+ var span = controlEnd + start / safeCPercent - chartWidth;
366
+ var translateX = Number.isFinite(span) ? -span * percent : 0;
359
367
  curControlPercent.current = percent;
360
- setClipX(-translateX);
368
+ setClipX(Number.isFinite(-translateX) ? -translateX : 0);
361
369
  var _isVertical = axisX.direction === "vertical";
362
370
  var coreOffset = _isVertical ? marginRight : isIOS ? marginLeft : 0;
363
371
  seriesEl.current.style.transform = "translate(".concat(translateX + coreOffset, "px,").concat(marginTop, "px)");
364
- axisElList.current[2].style.transform = "translate(".concat(translateX, "px,", 0, "px)");
372
+ axisElList.current[2] && (axisElList.current[2].style.transform = "translate(".concat(translateX, "px,", 0, "px)"));
365
373
  }
366
374
  }, [controlInfo]);
367
375
  //控制条轮播动画
@@ -457,6 +465,11 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
457
465
  });
458
466
  var bodyWidth = isVertical ? xLineRange + 100 + marginRight + marginLeft : xLineRange,
459
467
  bodyHeight = isVertical ? yLineRange : yLineRange + marginTop + marginBottom;
468
+ var controlTooltipSpan = function () {
469
+ var p = cPercent > 0 && Number.isFinite(cPercent) ? cPercent : 1;
470
+ var s = axisX.controlEnd + axisX.start / p - chartWidth;
471
+ return Number.isFinite(s) ? s : 0;
472
+ }();
460
473
  var hasDuplicateX = function hasDuplicateX(data) {
461
474
  var xValues = new Set();
462
475
  var _iterator = _createForOfIteratorHelper(data),
@@ -607,19 +620,21 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
607
620
  }, /*#__PURE__*/_react["default"].createElement("rect", {
608
621
  x: clipX,
609
622
  y: -marginTop,
610
- width: xLineRange,
623
+ width: bodyWidth,
611
624
  height: yLineRange + marginTop,
612
625
  fill: "transparent"
613
626
  }))), /*#__PURE__*/_react["default"].createElement("g", {
614
627
  clipPath: "url(#chart-clip-".concat(id, ")")
615
628
  }, /*#__PURE__*/_react["default"].createElement("g", null, control && zIndex == "bottom" && ctlIndicatorList.map(function (item, index) {
616
- var x = axisX.scaler(item.tick);
629
+ var xRaw = axisX.scaler(item.tick);
630
+ var x = Number.isFinite(xRaw) ? xRaw : 0;
631
+ var iw = safeIndicatorWidth;
617
632
  return /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({
618
633
  key: index
619
634
  }, indicator, {
620
635
  height: yLineRange,
621
- width: indicatorWidth,
622
- x: x - indicatorWidth / 2,
636
+ width: iw,
637
+ x: x - iw / 2,
623
638
  isControlChart: !!control,
624
639
  xName: item.tick,
625
640
  setCtlTip: setCtlTip,
@@ -669,13 +684,15 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
669
684
  isControlChart: !!control
670
685
  }));
671
686
  }), /*#__PURE__*/_react["default"].createElement("g", null, control && zIndex != "bottom" && ctlIndicatorList.map(function (item, index) {
672
- var x = axisX.scaler(item.tick);
687
+ var xRaw = axisX.scaler(item.tick);
688
+ var x = Number.isFinite(xRaw) ? xRaw : 0;
689
+ var iw = safeIndicatorWidth;
673
690
  return /*#__PURE__*/_react["default"].createElement(_.Indicator, (0, _extends2["default"])({
674
691
  key: index
675
692
  }, indicator, {
676
693
  height: yLineRange,
677
- width: indicatorWidth,
678
- x: x - indicatorWidth / 2,
694
+ width: iw,
695
+ x: x - iw / 2,
679
696
  isControlChart: !!control,
680
697
  xName: item.tick,
681
698
  setCtlTip: setCtlTip,
@@ -686,7 +703,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
686
703
  isVertical: isVertical
687
704
  }, tooltip, {
688
705
  data: controlChartTooltipData,
689
- x: ctlX - marginLeft - (axisX.controlEnd + axisX.start / cPercent - chartWidth) * curControlPercent.current,
706
+ x: (Number.isFinite(ctlX) ? ctlX : 0) - marginLeft - controlTooltipSpan * curControlPercent.current,
690
707
  marginLeft: marginLeft,
691
708
  marginTop: marginTop,
692
709
  tickName: ctlXName,
@@ -289,28 +289,28 @@ var getPosition = function getPosition(position, alignment) {
289
289
  switch (position) {
290
290
  case "top":
291
291
  return {
292
- left: alignment == "left" ? -5 : alignment == "center" ? "50%" : "",
293
- right: alignment == "right" ? -10 : "",
292
+ left: alignment == "left" ? 0 : alignment == "center" ? "50%" : "",
293
+ right: alignment == "right" ? 0 : "",
294
294
  top: 5,
295
295
  transform: "translate3d(calc(".concat(alignment == "center" ? "-50%" : "0px", " + ").concat(x, "px), ").concat(y, "px, 0px)")
296
296
  };
297
297
  case "right":
298
298
  return {
299
299
  top: "50%",
300
- right: -10,
300
+ right: 0,
301
301
  transform: "translate3d(".concat(x, "px, calc(-50% + ").concat(y, "px), 0px)")
302
302
  };
303
303
  case "left":
304
304
  return {
305
305
  top: "50%",
306
- left: -5,
306
+ left: 0,
307
307
  transform: "translate3d(".concat(x, "px, calc(-50% + ").concat(y, "px), 0px)")
308
308
  };
309
309
  default:
310
310
  // bottom
311
311
  return {
312
- left: alignment == "left" ? -5 : alignment == "center" ? "50%" : "",
313
- right: alignment == "right" ? -10 : "",
312
+ left: alignment == "left" ? 0 : alignment == "center" ? "50%" : "",
313
+ right: alignment == "right" ? 0 : "",
314
314
  bottom: 5,
315
315
  transform: "translate3d(calc(".concat(alignment == "center" ? "-50%" : "0px", " + ").concat(x, "px), ").concat(y, "px, 0px)")
316
316
  };
@@ -77,8 +77,8 @@ var Area = function Area(_ref) {
77
77
  opacity: Areaopacity
78
78
  },
79
79
  stroke: "none",
80
- fill: 'url(#' + id + ')'
81
- }), /*#__PURE__*/_react["default"].createElement("defs", null, type && type == 'pattern' ? /*#__PURE__*/_react["default"].createElement("pattern", {
80
+ fill: "url(#" + id + ")"
81
+ }), /*#__PURE__*/_react["default"].createElement("defs", null, type && type == "pattern" ? /*#__PURE__*/_react["default"].createElement("pattern", {
82
82
  id: id,
83
83
  patternUnits: "userSpaceOnUse",
84
84
  width: patternW,
@@ -132,7 +132,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
132
132
  return getLineData(sortData, connectNulls);
133
133
  }, [sortData, connectNulls]);
134
134
  var lineGen = (0, _react.useMemo)(function () {
135
- var isVertical = direction === 'vertical';
135
+ var isVertical = direction === "vertical";
136
136
  var lineGen = (isVertical ? (0, _d3v.line)().y(function (_ref9) {
137
137
  var x = _ref9.data.x;
138
138
  return xScaler(x);
@@ -164,9 +164,9 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
164
164
  pointerEvents: "none"
165
165
  },
166
166
  fill: "none",
167
- strokeDasharray: lineType === 'dash' ? '3 3' : null,
167
+ strokeDasharray: lineType === "dash" ? "3 3" : null,
168
168
  strokeWidth: lineWidth
169
- }), type == 'area' && /*#__PURE__*/_react["default"].createElement(Area, {
169
+ }), type == "area" && /*#__PURE__*/_react["default"].createElement(Area, {
170
170
  data: _data,
171
171
  config: _objectSpread(_objectSpread({}, area), {}, {
172
172
  curve: curve,
@@ -310,7 +310,7 @@ var _default = exports["default"] = function _default(_ref) {
310
310
  end: end,
311
311
  clipAxisRange: clipAxisRange,
312
312
  lengthWithoutPaddingOuter: lengthWithoutPaddingOuter,
313
- step: [lengthWithoutPaddingOuter / clipAxisAllTicks[0].length, lengthWithoutPaddingOuter / clipAxisAllTicks[1].length],
313
+ step: [clipAxisAllTicks[0].length > 0 ? lengthWithoutPaddingOuter / clipAxisAllTicks[0].length : 0, clipAxisAllTicks[1].length > 0 ? lengthWithoutPaddingOuter / clipAxisAllTicks[1].length : 0],
314
314
  allTicks: clipAxisAllTicks,
315
315
  ticks: clipAxisTicks,
316
316
  clipValue: clipValue
@@ -372,14 +372,19 @@ var _default = exports["default"] = function _default(_ref) {
372
372
  // }
373
373
  // }
374
374
  // }
375
- var _step2 = _lengthWithoutPaddingOuter / allTicks.length;
375
+ var tickLen = allTicks.length;
376
+ var _step2 = tickLen > 0 ? _lengthWithoutPaddingOuter / tickLen : 0;
376
377
  var controlCfg = {
377
378
  controlStep: 0,
378
379
  controlDragScaler: null
379
380
  };
380
381
  if (isC) {
381
- controlCfg.controlStep = _step2 / cPercent;
382
- controlCfg.controlDragScaler = scaler.copy().range([_start / cPercent, _end / cPercent]);
382
+ if (tickLen > 0 && cPercent > 0) {
383
+ controlCfg.controlStep = _step2 / cPercent;
384
+ controlCfg.controlDragScaler = scaler.copy().range([_start / cPercent, _end / cPercent]);
385
+ } else {
386
+ controlCfg.controlDragScaler = scaler.copy();
387
+ }
383
388
  var _getChartsConfig3 = getChartsConfig(orientation, cWidth, height, paddingOuter),
384
389
  start_ = _getChartsConfig3.start,
385
390
  end_ = _getChartsConfig3.end,
@@ -390,7 +395,7 @@ var _default = exports["default"] = function _default(_ref) {
390
395
  scaler = scales[type]().domain(newDomain).range(_range);
391
396
  scaler.type = type;
392
397
  var controlOuter = len - outer;
393
- _step2 = controlOuter / allTicks.length;
398
+ _step2 = tickLen > 0 ? controlOuter / tickLen : 0;
394
399
  }
395
400
  tmp.set(axisType, _objectSpread(_objectSpread(_objectSpread({}, item), {}, {
396
401
  count: _count,
@@ -17,11 +17,11 @@ var initialState = {
17
17
  flag: false // 首次加载标识:true-首次加载不执行动画,false-可执行轮播
18
18
  };
19
19
 
20
- /**
21
- * x轴滚动逻辑
22
- * @param {Object} axis x轴配置项
23
- * @param {Object} config x轴轮播动画的配置项
24
- * @returns {Map} 返回更新后的x轴配置(ticks/scaler/range 变更)
20
+ /**
21
+ * x轴滚动逻辑
22
+ * @param {Object} axis x轴配置项
23
+ * @param {Object} config x轴轮播动画的配置项
24
+ * @returns {Map} 返回更新后的x轴配置(ticks/scaler/range 变更)
25
25
  */
26
26
  var _default = exports["default"] = function _default(axis, config, isHover, controlInfo, active) {
27
27
  var show = config.show,
@@ -40,11 +40,11 @@ var _default = exports["default"] = function _default(axis, config, isHover, con
40
40
  lengthWithoutPaddingOuter = axis.lengthWithoutPaddingOuter;
41
41
  var tickLength = ticks.length;
42
42
  var tickCount = isC ? allTicks.length : count;
43
- var scale = isC ? cPercent : 1;
43
+ var scale = isC && cPercent > 0 ? cPercent : 1;
44
44
  var _start = start / scale;
45
45
  var _end = end / scale;
46
46
  var canCarousel = (0, _react.useMemo)(function () {
47
- return show && active && tickLength > tickCount;
47
+ return show && active && tickCount > 0 && tickLength > tickCount;
48
48
  }, [show, active, tickLength, tickCount]);
49
49
  var _useState = (0, _react.useState)({
50
50
  scaler: scaler,
@@ -120,7 +120,7 @@ var _default = exports["default"] = function _default(axis, config, isHover, con
120
120
 
121
121
  // 初始化:仅在基础条件变化时设置初始索引
122
122
  (0, _react.useEffect)(function () {
123
- if (show && tickLength > tickCount) {
123
+ if (show && tickCount > 0 && tickLength > tickCount) {
124
124
  setStatus({
125
125
  currentIndex: 0,
126
126
  flag: true
@@ -137,10 +137,11 @@ var _default = exports["default"] = function _default(axis, config, isHover, con
137
137
 
138
138
  // 执行条件:显示、非hover暂停、激活、有足够的轮播项
139
139
  var canRun = canCarousel && !(latest.hover && hoverRef.current);
140
- if (currentIndex !== null && canRun) {
140
+ if (currentIndex !== null && canRun && latest.tickCount > 0) {
141
141
  if (flag) {
142
142
  // 首次加载:仅初始化视图,不执行动画
143
143
  var _step = latest.lengthWithoutPaddingOuter / latest.tickCount;
144
+ if (!Number.isFinite(_step)) return;
144
145
  var _ticks = latest.allTicks.slice(currentIndex, latest.tickCount);
145
146
  setState({
146
147
  step: _step,
@@ -168,6 +169,7 @@ var _default = exports["default"] = function _default(axis, config, isHover, con
168
169
  // 非首次加载:执行动画 + 后续逻辑
169
170
  if (!ready) return;
170
171
  var _step2 = latest.lengthWithoutPaddingOuter / latest.tickCount;
172
+ if (!Number.isFinite(_step2)) return;
171
173
  animation = (0, _popmotion.animate)({
172
174
  from: 0,
173
175
  to: -1,
@@ -278,7 +280,7 @@ var _default = exports["default"] = function _default(axis, config, isHover, con
278
280
  setReady(true);
279
281
  setStatus(function () {
280
282
  // 与初始化 effect 保持一致:只要满足条件就从 0 开始重新初始化
281
- if (show && active && tickLength > tickCount) {
283
+ if (show && active && tickCount > 0 && tickLength > tickCount) {
282
284
  return {
283
285
  currentIndex: 0,
284
286
  flag: true
@@ -294,12 +296,12 @@ var _default = exports["default"] = function _default(axis, config, isHover, con
294
296
  controlEnd: _end
295
297
  });
296
298
  };
297
- /**
298
- * 获取指定索引范围的ticks(支持循环)
299
- * @param {Array} ticks 所有ticks
300
- * @param {number} currentIndex 当前起始索引
301
- * @param {number} length 需要的长度
302
- * @returns {Array} 目标ticks数组
299
+ /**
300
+ * 获取指定索引范围的ticks(支持循环)
301
+ * @param {Array} ticks 所有ticks
302
+ * @param {number} currentIndex 当前起始索引
303
+ * @param {number} length 需要的长度
304
+ * @returns {Array} 目标ticks数组
303
305
  */
304
306
  var getTicks = function getTicks(ticks, currentIndex, length) {
305
307
  var _currentIndex = +currentIndex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.10.7",
3
+ "version": "1.10.9",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -55,4 +55,4 @@
55
55
  "commit": true
56
56
  }
57
57
  }
58
- }
58
+ }
@@ -252,14 +252,20 @@ const Chart = memo(
252
252
 
253
253
  const isVertical = axisX.direction === "vertical";
254
254
 
255
- const indicatorWidth =
256
- (indicator.width * (control ? axisX.controlStep : axisX.step)) / 100;
257
- const position = axisX.scaler(tickName) - indicatorWidth / 2;
255
+ const axisStep = control ? axisX.controlStep : axisX.step;
256
+ const safeAxisStep = Number.isFinite(axisStep) ? axisStep : 0;
257
+ const indicatorWidth = (indicator.width * safeAxisStep) / 100;
258
+ const safeIndicatorWidth = Number.isFinite(indicatorWidth)
259
+ ? indicatorWidth
260
+ : 0;
261
+ const tickPos = axisX.scaler(tickName);
262
+ const safeTickPos = Number.isFinite(tickPos) ? tickPos : 0;
263
+ const position = safeTickPos - safeIndicatorWidth / 2;
258
264
  const indicatorAttr = isVertical
259
- ? { width: chartWidth, height: indicatorWidth, y: position }
265
+ ? { width: chartWidth, height: safeIndicatorWidth, y: position }
260
266
  : {
261
267
  height: yLineRange,
262
- width: indicatorWidth,
268
+ width: safeIndicatorWidth,
263
269
  x: position,
264
270
  };
265
271
 
@@ -341,18 +347,22 @@ const Chart = memo(
341
347
  if (controlEl.current) {
342
348
  controlEl.current.style.transform = `translate(${cBarX}px,0)`;
343
349
  //计算出当前位移的百分比
344
- let percent = cBarX / (cWidth - cBarWidth);
345
- percent = isNaN(percent) ? 1 : percent;
346
- const translateX =
347
- -(controlEnd + start / cPercent - chartWidth) * percent;
350
+ const slideRange = cWidth - cBarWidth;
351
+ let percent = slideRange > 0 ? cBarX / slideRange : 0;
352
+ if (!Number.isFinite(percent)) percent = 0;
353
+ const safeCPercent =
354
+ cPercent > 0 && Number.isFinite(cPercent) ? cPercent : 1;
355
+ const span = controlEnd + start / safeCPercent - chartWidth;
356
+ const translateX = Number.isFinite(span) ? -span * percent : 0;
348
357
  curControlPercent.current = percent;
349
- setClipX(-translateX);
358
+ setClipX(Number.isFinite(-translateX) ? -translateX : 0);
350
359
  const isVertical = axisX.direction === "vertical";
351
360
  const coreOffset = isVertical ? marginRight : isIOS ? marginLeft : 0;
352
361
  seriesEl.current.style.transform = `translate(${
353
362
  translateX + coreOffset
354
363
  }px,${marginTop}px)`;
355
- axisElList.current[2].style.transform = `translate(${translateX}px,${0}px)`;
364
+ axisElList.current[2] &&
365
+ (axisElList.current[2].style.transform = `translate(${translateX}px,${0}px)`);
356
366
  }
357
367
  }, [controlInfo]);
358
368
  //控制条轮播动画
@@ -465,6 +475,11 @@ const Chart = memo(
465
475
  bodyHeight = isVertical
466
476
  ? yLineRange
467
477
  : yLineRange + marginTop + marginBottom;
478
+ const controlTooltipSpan = (() => {
479
+ const p = cPercent > 0 && Number.isFinite(cPercent) ? cPercent : 1;
480
+ const s = axisX.controlEnd + axisX.start / p - chartWidth;
481
+ return Number.isFinite(s) ? s : 0;
482
+ })();
468
483
  const hasDuplicateX = (data) => {
469
484
  const xValues = new Set();
470
485
  for (const item of data) {
@@ -609,7 +624,7 @@ const Chart = memo(
609
624
  <rect
610
625
  x={clipX}
611
626
  y={-marginTop}
612
- width={xLineRange}
627
+ width={bodyWidth}
613
628
  height={yLineRange + marginTop}
614
629
  fill="transparent"
615
630
  />
@@ -624,15 +639,17 @@ const Chart = memo(
624
639
  {control &&
625
640
  zIndex == "bottom" &&
626
641
  ctlIndicatorList.map((item, index) => {
627
- const x = axisX.scaler(item.tick);
642
+ const xRaw = axisX.scaler(item.tick);
643
+ const x = Number.isFinite(xRaw) ? xRaw : 0;
644
+ const iw = safeIndicatorWidth;
628
645
  return (
629
646
  <Indicator
630
647
  key={index}
631
648
  {...indicator}
632
649
  {...{
633
650
  height: yLineRange,
634
- width: indicatorWidth,
635
- x: x - indicatorWidth / 2,
651
+ width: iw,
652
+ x: x - iw / 2,
636
653
  }}
637
654
  isControlChart={!!control}
638
655
  xName={item.tick}
@@ -695,15 +712,17 @@ const Chart = memo(
695
712
  {control &&
696
713
  zIndex != "bottom" &&
697
714
  ctlIndicatorList.map((item, index) => {
698
- const x = axisX.scaler(item.tick);
715
+ const xRaw = axisX.scaler(item.tick);
716
+ const x = Number.isFinite(xRaw) ? xRaw : 0;
717
+ const iw = safeIndicatorWidth;
699
718
  return (
700
719
  <Indicator
701
720
  key={index}
702
721
  {...indicator}
703
722
  {...{
704
723
  height: yLineRange,
705
- width: indicatorWidth,
706
- x: x - indicatorWidth / 2,
724
+ width: iw,
725
+ x: x - iw / 2,
707
726
  }}
708
727
  isControlChart={!!control}
709
728
  xName={item.tick}
@@ -723,10 +742,9 @@ const Chart = memo(
723
742
  {...tooltip}
724
743
  data={controlChartTooltipData}
725
744
  x={
726
- ctlX -
745
+ (Number.isFinite(ctlX) ? ctlX : 0) -
727
746
  marginLeft -
728
- (axisX.controlEnd + axisX.start / cPercent - chartWidth) *
729
- curControlPercent.current
747
+ controlTooltipSpan * curControlPercent.current
730
748
  }
731
749
  marginLeft={marginLeft}
732
750
  marginTop={marginTop}
@@ -94,7 +94,7 @@ export default memo(
94
94
  filterData && interactive && filterData(fieldName || name);
95
95
  pieClick && pieClick(e);
96
96
  },
97
- [interactive, filterData, pieClick]
97
+ [interactive, filterData, pieClick],
98
98
  );
99
99
 
100
100
  if (judge == 0) {
@@ -123,10 +123,10 @@ export default memo(
123
123
  getCanvasTextWidth(
124
124
  getValueStr(item),
125
125
  valueFont.letterSpacing || 0,
126
- `${valueFont.fontSize || 12}px ${valueFont.fontFamily || "Arial"}`
127
- )
128
- )
129
- )
126
+ `${valueFont.fontSize || 12}px ${valueFont.fontFamily || "Arial"}`,
127
+ ),
128
+ ),
129
+ ),
130
130
  );
131
131
  const percentMaxWidth = Math.max(
132
132
  ..._series.map((item) => {
@@ -139,10 +139,10 @@ export default memo(
139
139
  percentFont.letterSpacing || 0,
140
140
  `${percentFont.fontSize || 12}px ${
141
141
  percentFont.fontFamily || "Arial"
142
- }`
143
- )
142
+ }`,
143
+ ),
144
144
  );
145
- })
145
+ }),
146
146
  );
147
147
  const nameMaxWidth = config.name?.maxWidth || 80;
148
148
 
@@ -157,10 +157,10 @@ export default memo(
157
157
  ? "flex-start"
158
158
  : "flex-end"
159
159
  : alignment.split(" ")[0] == "left"
160
- ? "flex-start"
161
- : alignment.split(" ")[0] == "center"
162
- ? "center"
163
- : "flex-end",
160
+ ? "flex-start"
161
+ : alignment.split(" ")[0] == "center"
162
+ ? "center"
163
+ : "flex-end",
164
164
  flexDirection: "column",
165
165
  position: "absolute",
166
166
  ...getPosition(position, _alignment, x, y),
@@ -179,10 +179,10 @@ export default memo(
179
179
  ? "flex-start"
180
180
  : "flex-end"
181
181
  : alignment.split(" ")[0] == "left"
182
- ? "flex-start"
183
- : alignment.split(" ")[0] == "center"
184
- ? "center"
185
- : "flex-end",
182
+ ? "flex-start"
183
+ : alignment.split(" ")[0] == "center"
184
+ ? "center"
185
+ : "flex-end",
186
186
  flexDirection: "column",
187
187
  position: "absolute",
188
188
  ...getPosition(position, _alignment, x, y),
@@ -280,8 +280,8 @@ export default memo(
280
280
  alignment.split(" ")[0] == "left"
281
281
  ? "flex-start"
282
282
  : alignment.split(" ")[0] == "center"
283
- ? "center"
284
- : "flex-end",
283
+ ? "center"
284
+ : "flex-end",
285
285
  marginBottom: "0px",
286
286
  gap: `${gridRowGap}px ${gridColumnGap}px`,
287
287
  marginBottom: gridRowGap + "px",
@@ -337,7 +337,7 @@ export default memo(
337
337
  name.substring(0, 5)
338
338
  : "",
339
339
  font.letterSpacing,
340
- `${font.fontSize}px ${font.fontFamily}`
340
+ `${font.fontSize}px ${font.fontFamily}`,
341
341
  ),
342
342
  }}
343
343
  speed={speed}
@@ -349,19 +349,19 @@ export default memo(
349
349
  }
350
350
  })}
351
351
  </ul>
352
- )
352
+ ),
353
353
  )}
354
354
  </div>
355
355
  );
356
- }
356
+ },
357
357
  );
358
358
 
359
359
  const getPosition = (position, alignment, x = 0, y = 0) => {
360
360
  switch (position) {
361
361
  case "top":
362
362
  return {
363
- left: alignment == "left" ? -5 : alignment == "center" ? "50%" : "",
364
- right: alignment == "right" ? -10 : "",
363
+ left: alignment == "left" ? 0 : alignment == "center" ? "50%" : "",
364
+ right: alignment == "right" ? 0 : "",
365
365
  top: 5,
366
366
  transform: `translate3d(calc(${
367
367
  alignment == "center" ? "-50%" : "0px"
@@ -370,19 +370,19 @@ const getPosition = (position, alignment, x = 0, y = 0) => {
370
370
  case "right":
371
371
  return {
372
372
  top: "50%",
373
- right: -10,
373
+ right: 0,
374
374
  transform: `translate3d(${x}px, calc(-50% + ${y}px), 0px)`,
375
375
  };
376
376
  case "left":
377
377
  return {
378
378
  top: "50%",
379
- left: -5,
379
+ left: 0,
380
380
  transform: `translate3d(${x}px, calc(-50% + ${y}px), 0px)`,
381
381
  };
382
382
  default: // bottom
383
383
  return {
384
- left: alignment == "left" ? -5 : alignment == "center" ? "50%" : "",
385
- right: alignment == "right" ? -10 : "",
384
+ left: alignment == "left" ? 0 : alignment == "center" ? "50%" : "",
385
+ right: alignment == "right" ? 0 : "",
386
386
  bottom: 5,
387
387
  transform: `translate3d(calc(${
388
388
  alignment == "center" ? "-50%" : "0px"