@easyv/charts 1.8.1 → 1.8.3

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.
@@ -30,6 +30,7 @@ var defaultAnimation = {
30
30
  on: false,
31
31
  interval: 0,
32
32
  interactive: '',
33
+ canCancel: false,
33
34
  current: {
34
35
  heighten: 0,
35
36
  opacity: 100
@@ -52,6 +53,7 @@ var _default = exports["default"] = function _default(Component) {
52
53
  var on = _animation.on,
53
54
  interval = _animation.interval,
54
55
  interactive = _animation.interactive,
56
+ canCancel = _animation.canCancel,
55
57
  hoverStop = _animation.hoverStop;
56
58
  var _useState = (0, _react.useState)(on ? carouselState : initialState),
57
59
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -99,9 +101,11 @@ var _default = exports["default"] = function _default(Component) {
99
101
  if (type == 'onClick') {
100
102
  timer.current && timer.current.stop();
101
103
  !hoverState.current && animationOn && carousel();
102
- setState({
103
- trigger: type,
104
- currentIndex: currentIndex
104
+ setState(function (pre) {
105
+ return {
106
+ trigger: type,
107
+ currentIndex: pre.currentIndex == currentIndex && canCancel ? -1 : currentIndex
108
+ };
105
109
  });
106
110
  }
107
111
  break;
@@ -114,6 +118,12 @@ var _default = exports["default"] = function _default(Component) {
114
118
  timer.current && timer.current.stop();
115
119
  } else if (type == 'onMouseLeave') {
116
120
  !hoverState.current && animationOn && carousel();
121
+ canCancel && setState(function (pre) {
122
+ return {
123
+ trigger: "onMouseEnter",
124
+ currentIndex: -1
125
+ };
126
+ });
117
127
  }
118
128
  break;
119
129
  case false:
@@ -127,7 +137,7 @@ var _default = exports["default"] = function _default(Component) {
127
137
  });
128
138
  break;
129
139
  }
130
- }, [interactive, animationOn, carousel]);
140
+ }, [interactive, canCancel, animationOn, carousel]);
131
141
  var hoverEvent = (0, _react.useCallback)(function (isHover) {
132
142
  if (hoverStop) {
133
143
  if (isHover) {
@@ -425,8 +425,8 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
425
425
  }, [series, arcs, radius]);
426
426
  var onClick = (0, _react.useCallback)(function (e) {
427
427
  var _data = arcs[+e.currentTarget.dataset.index].data;
428
- triggerOnRelative('onClick', _data);
429
- onEmit('onClick', _data);
428
+ triggerOnRelative("onClick", _data);
429
+ onEmit("onClick", _data);
430
430
  onEvent({
431
431
  currentIndex: +e.currentTarget.dataset.index,
432
432
  type: "onClick"
@@ -434,7 +434,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
434
434
  }, [onEvent]);
435
435
  var onMouseEnter = (0, _react.useCallback)(function (e) {
436
436
  var _data = arcs[+e.currentTarget.dataset.index].data;
437
- triggerOnRelative('mousehover', _data);
437
+ triggerOnRelative("mousehover", _data);
438
438
  onEmit("mousehover", _data);
439
439
  onEvent({
440
440
  currentIndex: +e.currentTarget.dataset.index,
@@ -464,16 +464,16 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
464
464
  setY(v);
465
465
  },
466
466
  onComplete: function onComplete() {
467
- var _data = arcs[+currentIndex].data;
467
+ var _data = arcs[+currentIndex] ? arcs[+currentIndex].data : {};
468
468
  triggerOnRelative("carousel", _data);
469
469
  onEmit("carousel", _data);
470
470
  }
471
471
  });
472
472
  } else {
473
473
  if (currentIndex !== null && trigger === "onClick") {
474
- var _data = arcs[+currentIndex].data;
475
- triggerOnRelative('click', _data);
476
- onEmit('click', _data);
474
+ var _data = arcs[+currentIndex] ? arcs[+currentIndex].data : {};
475
+ triggerOnRelative("click", _data);
476
+ onEmit("click", _data);
477
477
  }
478
478
  }
479
479
  return function () {
@@ -603,7 +603,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
603
603
  judge: judgeData
604
604
  }))), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement("div", {
605
605
  style: {
606
- position: 'absolute',
606
+ position: "absolute",
607
607
  zIndex: 9999
608
608
  }
609
609
  }, /*#__PURE__*/_react["default"].createElement(_PieTooltip.PieTooltip, {
@@ -767,7 +767,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
767
767
  radius: radius
768
768
  }), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement("div", {
769
769
  style: {
770
- position: 'absolute',
770
+ position: "absolute",
771
771
  zIndex: 9999
772
772
  }
773
773
  }, /*#__PURE__*/_react["default"].createElement(_PieTooltip.PieTooltip, {
@@ -100,20 +100,22 @@ var getColorList = exports.getColorList = function getColorList(_ref3) {
100
100
  });
101
101
  };
102
102
  var getMultiColorStr = exports.getMultiColorStr = function getMultiColorStr(colors) {
103
- var stops = colors.stops,
104
- angle = colors.angle;
105
- var result = 'linear-gradient(' + angle + 'deg, ';
106
- var stops_ = JSON.parse(JSON.stringify(stops));
107
- stops_.sort(function (a, b) {
108
- return a.offset - b.offset;
109
- });
110
- for (var i = 0; i < stops_.length; i++) {
111
- var _stops_$i = stops_[i],
112
- color = _stops_$i.color,
113
- offset = _stops_$i.offset;
114
- result += "".concat(color, " ").concat(offset, "%,");
103
+ if (colors) {
104
+ var stops = colors.stops,
105
+ angle = colors.angle;
106
+ var result = 'linear-gradient(' + angle + 'deg, ';
107
+ var stops_ = JSON.parse(JSON.stringify(stops));
108
+ stops_.sort(function (a, b) {
109
+ return a.offset - b.offset;
110
+ });
111
+ for (var i = 0; i < stops_.length; i++) {
112
+ var _stops_$i = stops_[i],
113
+ color = _stops_$i.color,
114
+ offset = _stops_$i.offset;
115
+ result += "".concat(color, " ").concat(offset, "%,");
116
+ }
117
+ return result.slice(0, -1) + ")";
115
118
  }
116
- return result.slice(0, -1) + ")";
117
119
  };
118
120
  var getIcon = exports.getIcon = function getIcon(type, icon) {
119
121
  var lineType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "solid";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -26,6 +26,7 @@ const defaultAnimation = {
26
26
  on: false,
27
27
  interval: 0,
28
28
  interactive: '',
29
+ canCancel: false,
29
30
  current: { heighten: 0, opacity: 100 },
30
31
  };
31
32
  /**
@@ -45,7 +46,7 @@ export default (Component: ComponentType<any>) =>
45
46
  }) => {
46
47
  const dataLength = data.length;
47
48
  const _animation = Object.assign({}, defaultAnimation, animation);
48
- const { on, interval, interactive, hoverStop } = _animation;
49
+ const { on, interval, interactive, canCancel, hoverStop } = _animation;
49
50
  const [state, setState] = useState<State>(
50
51
  on ? carouselState : initialState
51
52
  );
@@ -95,9 +96,11 @@ export default (Component: ComponentType<any>) =>
95
96
  if (type == 'onClick') {
96
97
  timer.current && timer.current.stop();
97
98
  !hoverState.current && animationOn && carousel();
98
- setState({
99
- trigger: type,
100
- currentIndex,
99
+ setState(pre => {
100
+ return {
101
+ trigger: type,
102
+ currentIndex:pre.currentIndex==currentIndex && canCancel?-1:currentIndex,
103
+ }
101
104
  });
102
105
  }
103
106
  break;
@@ -110,6 +113,12 @@ export default (Component: ComponentType<any>) =>
110
113
  timer.current && timer.current.stop();
111
114
  } else if (type == 'onMouseLeave') {
112
115
  !hoverState.current && animationOn && carousel();
116
+ canCancel && setState(pre => {
117
+ return {
118
+ trigger: "onMouseEnter",
119
+ currentIndex:-1,
120
+ }
121
+ });
113
122
  }
114
123
  break;
115
124
  case false:
@@ -124,7 +133,7 @@ export default (Component: ComponentType<any>) =>
124
133
  break;
125
134
  }
126
135
  },
127
- [interactive, animationOn, carousel]
136
+ [interactive, canCancel, animationOn, carousel]
128
137
  );
129
138
 
130
139
  const hoverEvent = useCallback((isHover:boolean)=>{
@@ -247,7 +247,8 @@ const getCircleScale = ({ count, color, width, length } = tick, radius) => {
247
247
 
248
248
  const Component = memo(
249
249
  ({
250
- width, height,
250
+ width,
251
+ height,
251
252
  config: {
252
253
  chart: {
253
254
  label,
@@ -402,8 +403,8 @@ const Component = memo(
402
403
  const onClick = useCallback(
403
404
  (e) => {
404
405
  const _data = arcs[+e.currentTarget.dataset.index].data;
405
- triggerOnRelative('onClick',_data);
406
- onEmit('onClick', _data);
406
+ triggerOnRelative("onClick", _data);
407
+ onEmit("onClick", _data);
407
408
  onEvent({
408
409
  currentIndex: +e.currentTarget.dataset.index,
409
410
  type: "onClick",
@@ -415,7 +416,7 @@ const Component = memo(
415
416
  const onMouseEnter = useCallback(
416
417
  (e) => {
417
418
  const _data = arcs[+e.currentTarget.dataset.index].data;
418
- triggerOnRelative('mousehover',_data);
419
+ triggerOnRelative("mousehover", _data);
419
420
  onEmit("mousehover", _data);
420
421
  onEvent({
421
422
  currentIndex: +e.currentTarget.dataset.index,
@@ -452,16 +453,16 @@ const Component = memo(
452
453
  setY(v);
453
454
  },
454
455
  onComplete: () => {
455
- const _data = arcs[+currentIndex].data;
456
- triggerOnRelative("carousel",_data);
456
+ const _data = arcs[+currentIndex] ? arcs[+currentIndex].data : {};
457
+ triggerOnRelative("carousel", _data);
457
458
  onEmit("carousel", _data);
458
459
  },
459
460
  });
460
461
  } else {
461
462
  if (currentIndex !== null && trigger === "onClick") {
462
- const _data = arcs[+currentIndex].data;
463
- triggerOnRelative('click',_data);
464
- onEmit('click', _data);
463
+ const _data = arcs[+currentIndex] ? arcs[+currentIndex].data : {};
464
+ triggerOnRelative("click", _data);
465
+ onEmit("click", _data);
465
466
  }
466
467
  }
467
468
  return () => {
@@ -522,8 +523,8 @@ const Component = memo(
522
523
  >
523
524
  <g
524
525
  style={{
525
- "--labelDuration":labelDuration+"ms",
526
- "--ringDuration":ringDuration+"ms",
526
+ "--labelDuration": labelDuration + "ms",
527
+ "--ringDuration": ringDuration + "ms",
527
528
  transition: "transform ease-in-out 0.3s",
528
529
  transform:
529
530
  "translate(" +
@@ -602,8 +603,17 @@ const Component = memo(
602
603
  )}
603
604
  {label && (
604
605
  <RingLabel
605
- config={{ ...label, maxRadius: maxRadius + 2, ringDuration, labelDuration }}
606
- iosStyle={{isIOS, left:halfChartWidth+marginLeft, top:halfChartHeight+marginTop}}
606
+ config={{
607
+ ...label,
608
+ maxRadius: maxRadius + 2,
609
+ ringDuration,
610
+ labelDuration,
611
+ }}
612
+ iosStyle={{
613
+ isIOS,
614
+ left: halfChartWidth + marginLeft,
615
+ top: halfChartHeight + marginTop,
616
+ }}
607
617
  arcs={_arcs}
608
618
  judge={judgeData}
609
619
  />
@@ -615,17 +625,17 @@ const Component = memo(
615
625
  mousePos.x != 0 &&
616
626
  mousePos.y != 0 &&
617
627
  tooltip.manual && (
618
- <div style={{ position: 'absolute', zIndex: 9999 }}>
619
- <PieTooltip
620
- series={series}
621
- data={hoverData}
622
- config={tooltip}
623
- pieCenter={{
624
- x: halfChartWidth,
625
- y: maxRadius + marginTop,
626
- }}
627
- mousePos={mousePos}
628
- />
628
+ <div style={{ position: "absolute", zIndex: 9999 }}>
629
+ <PieTooltip
630
+ series={series}
631
+ data={hoverData}
632
+ config={tooltip}
633
+ pieCenter={{
634
+ x: halfChartWidth,
635
+ y: maxRadius + marginTop,
636
+ }}
637
+ mousePos={mousePos}
638
+ />
629
639
  </div>
630
640
  )}
631
641
  <Legend
@@ -693,7 +703,9 @@ const Component = memo(
693
703
  const deltaHeighten = offset * heighten;
694
704
  const path = arc
695
705
  .innerRadius(innerRadius + deltaWidthen)
696
- .outerRadius(outerRadius + deltaHeighten + deltaWidthen)(value);
706
+ .outerRadius(outerRadius + deltaHeighten + deltaWidthen)(
707
+ value
708
+ );
697
709
  const pie = getColorList(series.color);
698
710
  const currentPie = animateColor
699
711
  ? getColorList(animateColor)
@@ -824,7 +836,18 @@ const Component = memo(
824
836
  );
825
837
  }
826
838
  )}
827
- {label && <Label config={label} iosStyle={{isIOS, left:halfChartWidth+marginLeft, top:halfChartHeight+marginTop}} arcs={_arcs} judge={judgeData} />}
839
+ {label && (
840
+ <Label
841
+ config={label}
842
+ iosStyle={{
843
+ isIOS,
844
+ left: halfChartWidth + marginLeft,
845
+ top: halfChartHeight + marginTop,
846
+ }}
847
+ arcs={_arcs}
848
+ judge={judgeData}
849
+ />
850
+ )}
828
851
  {current && (
829
852
  <g
830
853
  fillOpacity={y}
@@ -835,7 +858,9 @@ const Component = memo(
835
858
  width={chartWidth}
836
859
  height={chartHeight}
837
860
  iosStyle={{
838
- marginLeft, marginTop, isIOS
861
+ marginLeft,
862
+ marginTop,
863
+ isIOS,
839
864
  }}
840
865
  data={_arcs}
841
866
  judge={judgeData}
@@ -857,23 +882,23 @@ const Component = memo(
857
882
  />
858
883
  )}
859
884
  {tooltip &&
860
- mousePos &&
861
- mousePos.x != 0 &&
862
- mousePos.y != 0 &&
863
- tooltip.manual && (
864
- <div style={{ position: 'absolute', zIndex: 9999 }}>
865
- <PieTooltip
866
- series={series}
867
- data={hoverData}
868
- config={tooltip}
869
- pieCenter={{
870
- x: halfChartWidth,
871
- y: maxRadius + marginTop,
872
- }}
873
- mousePos={mousePos}
874
- />
875
- </div>
876
- )}
885
+ mousePos &&
886
+ mousePos.x != 0 &&
887
+ mousePos.y != 0 &&
888
+ tooltip.manual && (
889
+ <div style={{ position: "absolute", zIndex: 9999 }}>
890
+ <PieTooltip
891
+ series={series}
892
+ data={hoverData}
893
+ config={tooltip}
894
+ pieCenter={{
895
+ x: halfChartWidth,
896
+ y: maxRadius + marginTop,
897
+ }}
898
+ mousePos={mousePos}
899
+ />
900
+ </div>
901
+ )}
877
902
  <Legend
878
903
  {...legend}
879
904
  height={chartHeight}
@@ -897,7 +922,7 @@ const Current = ({
897
922
  show: showName,
898
923
  sameColor: nameColor,
899
924
  font: nameFont,
900
- translate = { x:0,y:0 },
925
+ translate = { x: 0, y: 0 },
901
926
  maxWidth,
902
927
  textOverflow,
903
928
  speed,
@@ -922,9 +947,7 @@ const Current = ({
922
947
  },
923
948
  },
924
949
  },
925
- iosStyle:{
926
- isIOS, marginLeft, marginTop
927
- },
950
+ iosStyle: { isIOS, marginLeft, marginTop },
928
951
  width,
929
952
  height,
930
953
  data,
@@ -954,20 +977,22 @@ const Current = ({
954
977
  //foreignObject标签样式,
955
978
  width,
956
979
  height,
957
- position:"relative",
958
- overflow:"visible",
980
+ position: "relative",
981
+ overflow: "visible",
959
982
  pointerEvents: "none",
960
983
  },
961
984
  boxStyle = {
962
985
  //弹性盒子样式,用于当前值的上下居中对齐等
963
986
  width,
964
987
  height,
965
- position:"absolute",
988
+ position: "absolute",
966
989
  display: "flex",
967
990
  flexDirection: "column",
968
991
  justifyContent: "center",
969
992
  alignItems: "center",
970
- transform: isIOS?`translate(${marginLeft}px,${marginTop}px)`:`translate(-${width / 2}px,-${height / 2}px)`,
993
+ transform: isIOS
994
+ ? `translate(${marginLeft}px,${marginTop}px)`
995
+ : `translate(-${width / 2}px,-${height / 2}px)`,
971
996
  };
972
997
  let seriesColor = currentData.series.color;
973
998
  seriesColor =
@@ -990,7 +1015,7 @@ const Current = ({
990
1015
  ...getFontStyle(nameFont),
991
1016
  margin: gap / 2 + "px 0",
992
1017
  color: nameColor ? seriesColor : nameFont.color,
993
- transform:`translate(${translate.x}px,${translate.y}px)`
1018
+ transform: `translate(${translate.x}px,${translate.y}px)`,
994
1019
  }}
995
1020
  ></TextOverflow>
996
1021
  )}
@@ -1078,9 +1103,7 @@ const Label = ({
1078
1103
  },
1079
1104
  percent: { show: showPercent, font: percentFont, precision },
1080
1105
  },
1081
- iosStyle:{
1082
- isIOS, left, top
1083
- },
1106
+ iosStyle: { isIOS, left, top },
1084
1107
  arcs,
1085
1108
  judge,
1086
1109
  animation,
@@ -1144,7 +1167,9 @@ const Label = ({
1144
1167
  className={animation ? ringCss["label-line"] : ""}
1145
1168
  style={{
1146
1169
  animationDelay: `${
1147
- animation ? (actualIndex + 1) * ringDuration - labelDuration : 0
1170
+ animation
1171
+ ? (actualIndex + 1) * ringDuration - labelDuration
1172
+ : 0
1148
1173
  }ms`,
1149
1174
  }}
1150
1175
  d={
@@ -1175,20 +1200,24 @@ const Label = ({
1175
1200
  height="1"
1176
1201
  x={_x}
1177
1202
  y={y2 + translateY}
1178
- style={{ overflow: "visible", position:"relative" }}
1203
+ style={{ overflow: "visible", position: "relative" }}
1179
1204
  >
1180
1205
  <div
1181
1206
  className={animation ? ringCss["label-text"] : ""}
1182
1207
  style={{
1183
- position:isIOS?"absolute":"relative",
1184
- transform: isIOS?`translate(calc(${x3<0?"-100%":"0px"} + ${left+_x}px),calc(-50% + ${top+y2+translateY}px))`:"translate(0,-50%)",
1208
+ position: isIOS ? "absolute" : "relative",
1209
+ transform: isIOS
1210
+ ? `translate(calc(${x3 < 0 ? "-100%" : "0px"} + ${
1211
+ left + _x
1212
+ }px),calc(-50% + ${top + y2 + translateY}px))`
1213
+ : "translate(0,-50%)",
1185
1214
  whiteSpace: "nowrap",
1186
1215
  float: x3 >= 0 ? "left" : "right",
1187
1216
  width: "max-content",
1188
- display:"flex",
1189
- flexDirection: mode=="horizontal"?"row":"column",
1190
- alignItems:"center",
1191
- justifyContent:"center"
1217
+ display: "flex",
1218
+ flexDirection: mode == "horizontal" ? "row" : "column",
1219
+ alignItems: "center",
1220
+ justifyContent: "center",
1192
1221
  }}
1193
1222
  >
1194
1223
  {_showName && (
@@ -1241,28 +1270,35 @@ const Label = ({
1241
1270
  );
1242
1271
  };
1243
1272
 
1244
- function getAlign(align, reverse){
1245
- if(align=="center")return "center";
1246
- if(align=="left")return reverse?"flex-end":"flex-start";
1247
- return reverse?"flex-start":"flex-end"
1273
+ function getAlign(align, reverse) {
1274
+ if (align == "center") return "center";
1275
+ if (align == "left") return reverse ? "flex-end" : "flex-start";
1276
+ return reverse ? "flex-start" : "flex-end";
1248
1277
  }
1249
- function getTranslate(translate, reverse){
1278
+ function getTranslate(translate, reverse) {
1250
1279
  const { x, y } = translate;
1251
- return `translate(${reverse?-x:x}px, ${y}px)`
1280
+ return `translate(${reverse ? -x : x}px, ${y}px)`;
1252
1281
  }
1253
1282
  const RingLabel = ({
1254
1283
  config: {
1255
- ringDuration,
1284
+ ringDuration,
1256
1285
  labelDuration,
1257
1286
  maxRadius = 0,
1258
1287
  lineLength,
1259
1288
  lineColor,
1260
1289
  distance,
1261
1290
  mode,
1262
- align="center",
1291
+ align = "center",
1263
1292
  show,
1264
1293
  translate: { x: translateX, y: translateY },
1265
- name: { show: showName, font: nameFont, maxWidth, textOverflow, speed, translate:nameTranslate },
1294
+ name: {
1295
+ show: showName,
1296
+ font: nameFont,
1297
+ maxWidth,
1298
+ textOverflow,
1299
+ speed,
1300
+ translate: nameTranslate,
1301
+ },
1266
1302
  value: {
1267
1303
  show: showValue,
1268
1304
  font: valueFont,
@@ -1272,13 +1308,16 @@ const RingLabel = ({
1272
1308
  fontSize: suffixFontSize,
1273
1309
  translate: { x: suffixTranslateX, y: suffixTranslateY },
1274
1310
  },
1275
- translate:valueTranslate
1311
+ translate: valueTranslate,
1312
+ },
1313
+ percent: {
1314
+ show: showPercent,
1315
+ font: percentFont,
1316
+ precision,
1317
+ translate: percentTranslate,
1276
1318
  },
1277
- percent: { show: showPercent, font: percentFont, precision, translate:percentTranslate },
1278
- },
1279
- iosStyle:{
1280
- isIOS, left, top
1281
1319
  },
1320
+ iosStyle: { isIOS, left, top },
1282
1321
  judge,
1283
1322
  arcs,
1284
1323
  }) => {
@@ -1343,7 +1382,9 @@ const RingLabel = ({
1343
1382
  <path
1344
1383
  className={ringCss["label-line"]}
1345
1384
  style={{
1346
- animationDelay: `${(actualIndex + 1) * ringDuration - labelDuration}ms`,
1385
+ animationDelay: `${
1386
+ (actualIndex + 1) * ringDuration - labelDuration
1387
+ }ms`,
1347
1388
  }}
1348
1389
  d={
1349
1390
  "M" +
@@ -1373,21 +1414,27 @@ const RingLabel = ({
1373
1414
  height="1"
1374
1415
  x={_x}
1375
1416
  y={y2 + translateY}
1376
- style={{ overflow: "visible", position:"relative" }}
1417
+ style={{ overflow: "visible", position: "relative" }}
1377
1418
  >
1378
1419
  <div
1379
1420
  className={ringCss["label-text"]}
1380
1421
  style={{
1381
- position:isIOS?"absolute":"relative",
1382
- transform: isIOS?`translate(calc(${x3<0?"-100%":"0px"} + ${left+_x}px),calc(-50% + ${top+y2+translateY}px))`:"translate(0,-50%)",
1422
+ position: isIOS ? "absolute" : "relative",
1423
+ transform: isIOS
1424
+ ? `translate(calc(${x3 < 0 ? "-100%" : "0px"} + ${
1425
+ left + _x
1426
+ }px),calc(-50% + ${top + y2 + translateY}px))`
1427
+ : "translate(0,-50%)",
1383
1428
  whiteSpace: "nowrap",
1384
1429
  float: x3 >= 0 ? "left" : "right",
1385
1430
  width: "max-content",
1386
- animationDelay: `${(actualIndex + 1) * ringDuration - labelDuration}ms`,
1387
- display:"flex",
1388
- flexDirection:mode=="horizontal"?"row":"column",
1389
- alignItems:getAlign(align, x3>=0),
1390
- justifyContent:"center"
1431
+ animationDelay: `${
1432
+ (actualIndex + 1) * ringDuration - labelDuration
1433
+ }ms`,
1434
+ display: "flex",
1435
+ flexDirection: mode == "horizontal" ? "row" : "column",
1436
+ alignItems: getAlign(align, x3 >= 0),
1437
+ justifyContent: "center",
1391
1438
  }}
1392
1439
  >
1393
1440
  {_showName && (
@@ -1401,12 +1448,17 @@ const RingLabel = ({
1401
1448
  maxWidth,
1402
1449
  ...getFontStyle(nameFont),
1403
1450
  float: mode == "horizontal" ? "left" : "none",
1404
- transform:getTranslate(nameTranslate, x3>=0)
1451
+ transform: getTranslate(nameTranslate, x3 >= 0),
1405
1452
  }}
1406
1453
  ></TextOverflow>
1407
1454
  )}
1408
1455
  {showValue && (
1409
- <span style={{...getFontStyle(valueFont), transform:getTranslate(valueTranslate, x3>=0)}}>
1456
+ <span
1457
+ style={{
1458
+ ...getFontStyle(valueFont),
1459
+ transform: getTranslate(valueTranslate, x3 >= 0),
1460
+ }}
1461
+ >
1410
1462
  {realData.y}
1411
1463
  {showSuffix && (
1412
1464
  <span
@@ -1423,7 +1475,12 @@ const RingLabel = ({
1423
1475
  </span>
1424
1476
  )}
1425
1477
  {showPercent && (
1426
- <span style={{...getFontStyle(percentFont), transform:getTranslate(percentTranslate, x3>=0)}}>
1478
+ <span
1479
+ style={{
1480
+ ...getFontStyle(percentFont),
1481
+ transform: getTranslate(percentTranslate, x3 >= 0),
1482
+ }}
1483
+ >
1427
1484
  {(_showValue ? "(" : "") +
1428
1485
  percent +
1429
1486
  "%" +
@@ -77,15 +77,17 @@ const getColorList = ({ type, pure, linear: { stops, angle, opacity } }) => {
77
77
  return stops.map(({ color, offset }) => ({ color, offset: offset / 100 }));
78
78
  };
79
79
  const getMultiColorStr = (colors)=>{
80
- const { stops, angle } = colors;
81
- let result = 'linear-gradient(' + angle + 'deg, ';
82
- const stops_ = JSON.parse(JSON.stringify(stops));
83
- stops_.sort((a,b)=>a.offset-b.offset);
84
- for(let i=0;i<stops_.length;i++){
85
- const { color, offset } = stops_[i];
86
- result += `${color} ${offset}%,`;
80
+ if(colors){
81
+ const { stops, angle } = colors;
82
+ let result = 'linear-gradient(' + angle + 'deg, ';
83
+ const stops_ = JSON.parse(JSON.stringify(stops));
84
+ stops_.sort((a,b)=>a.offset-b.offset);
85
+ for(let i=0;i<stops_.length;i++){
86
+ const { color, offset } = stops_[i];
87
+ result += `${color} ${offset}%,`;
88
+ }
89
+ return result.slice(0,-1)+")";
87
90
  }
88
- return result.slice(0,-1)+")";
89
91
  }
90
92
  const getIcon = (type, icon, lineType="solid") => {
91
93
  switch (type) {