@easyv/charts 1.5.22 → 1.5.24

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.
@@ -275,6 +275,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
275
275
  controlEl.current.style.transform = "translate(".concat(cBarX, "px,0)"); //计算出当前位移的百分比
276
276
 
277
277
  var percent = cBarX / (cWidth - cBarWidth);
278
+ percent = isNaN(percent) ? 1 : percent;
278
279
  var translateX = -(controlEnd + start / cPercent - chartWidth) * percent;
279
280
  curControlPercent.current = percent;
280
281
  seriesEl.current.style.transform = "translate(".concat(translateX, "px,").concat(marginTop, "px)");
@@ -286,6 +286,9 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
286
286
  _ref5$config$chart$le2 = _ref5$config$chart$le.formatter,
287
287
  formatter = _ref5$config$chart$le2 === void 0 ? _formatter.pieLegendFormatter : _ref5$config$chart$le2,
288
288
  legend = (0, _objectWithoutProperties2["default"])(_ref5$config$chart$le, _excluded3),
289
+ _ref5$config$chart$an = _ref5$config$chart.animation,
290
+ ringDuration = _ref5$config$chart$an.ringDuration,
291
+ labelDuration = _ref5$config$chart$an.labelDuration,
289
292
  _ref5$config$chart$ma = _ref5$config$chart.margin,
290
293
  marginLeft = _ref5$config$chart$ma.marginLeft,
291
294
  marginTop = _ref5$config$chart$ma.marginTop,
@@ -597,6 +600,8 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
597
600
  ref: pieWarpEl
598
601
  }, /*#__PURE__*/_react["default"].createElement("g", {
599
602
  style: {
603
+ "--labelDuration": labelDuration + "ms",
604
+ "--ringDuration": ringDuration + "ms",
600
605
  transition: "transform ease-in-out 0.3s",
601
606
  transform: "translate(" + halfChartWidth + "px, " + halfChartHeight + "px) rotate(" + rotate_ + "deg)"
602
607
  }
@@ -627,7 +632,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
627
632
  style: {
628
633
  strokeDasharray: "".concat(dashLength, ",").concat(2 * dashLength),
629
634
  strokeDashoffset: dashLength,
630
- animationDelay: "".concat(index * 2000, "ms")
635
+ animationDelay: "".concat(index * ringDuration, "ms")
631
636
  },
632
637
  "data-index": index,
633
638
  onClick: onClick,
@@ -657,7 +662,9 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
657
662
  })));
658
663
  }), label && /*#__PURE__*/_react["default"].createElement(RingLabel, {
659
664
  config: _objectSpread(_objectSpread({}, label), {}, {
660
- maxRadius: maxRadius + 2
665
+ maxRadius: maxRadius + 2,
666
+ ringDuration: ringDuration,
667
+ labelDuration: labelDuration
661
668
  }),
662
669
  iosStyle: {
663
670
  isIOS: isIOS,
@@ -1073,7 +1080,7 @@ var Label = function Label(_ref10) {
1073
1080
  }, /*#__PURE__*/_react["default"].createElement("path", {
1074
1081
  className: animation ? _piechartModule["default"]["label-line"] : "",
1075
1082
  style: {
1076
- animationDelay: "".concat(animation ? (actualIndex + 1) * 2000 - 800 : 0, "ms")
1083
+ animationDelay: "".concat(animation ? (actualIndex + 1) * ringDuration - labelDuration : 0, "ms")
1077
1084
  },
1078
1085
  d: "M" + x1 + ", " + y1 + "L" + x2 + ", " + y2 + "L" + x3 + ", " + y2,
1079
1086
  stroke: lineColor ? lineColor : type == "pure" ? pure : stops[0].color,
@@ -1124,6 +1131,8 @@ var Label = function Label(_ref10) {
1124
1131
 
1125
1132
  var RingLabel = function RingLabel(_ref12) {
1126
1133
  var _ref12$config = _ref12.config,
1134
+ ringDuration = _ref12$config.ringDuration,
1135
+ labelDuration = _ref12$config.labelDuration,
1127
1136
  _ref12$config$maxRadi = _ref12$config.maxRadius,
1128
1137
  maxRadius = _ref12$config$maxRadi === void 0 ? 0 : _ref12$config$maxRadi,
1129
1138
  lineLength = _ref12$config.lineLength,
@@ -1219,7 +1228,7 @@ var RingLabel = function RingLabel(_ref12) {
1219
1228
  }, /*#__PURE__*/_react["default"].createElement("path", {
1220
1229
  className: _piechartModule["default"]["label-line"],
1221
1230
  style: {
1222
- animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms")
1231
+ animationDelay: "".concat((actualIndex + 1) * ringDuration - labelDuration, "ms")
1223
1232
  },
1224
1233
  d: "M" + x1 + ", " + y1 + "L" + x2 + ", " + y2 + "L" + x3 + ", " + y2,
1225
1234
  stroke: lineColor ? lineColor : type == "pure" ? pure : stops[0].color,
@@ -1241,7 +1250,7 @@ var RingLabel = function RingLabel(_ref12) {
1241
1250
  whiteSpace: "nowrap",
1242
1251
  "float": x3 >= 0 ? "left" : "right",
1243
1252
  width: "max-content",
1244
- animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms"),
1253
+ animationDelay: "".concat((actualIndex + 1) * ringDuration - labelDuration, "ms"),
1245
1254
  display: "flex",
1246
1255
  alignItems: "center"
1247
1256
  }
@@ -1,27 +1,27 @@
1
1
  /*甜甜圈图专用css*/
2
2
  .label-line {
3
- stroke-dasharray: 100;
4
- stroke-dashoffset: 100;
5
- animation: dash 800ms ease forwards;
6
- }
3
+ stroke-dasharray: 100;
4
+ stroke-dashoffset: 100;
5
+ animation: dash var(--labelDuration) ease forwards;
6
+ }
7
7
 
8
- .label-text {
9
- opacity: 0;
10
- animation: show 800ms ease forwards;
8
+ .label-text {
9
+ opacity: 0;
10
+ animation: show var(--labelDuration) ease forwards;
11
+ }
12
+
13
+ .inner-arc {
14
+ animation: dash var(--ringDuration) ease forwards;
15
+ }
16
+
17
+ @keyframes dash {
18
+ 100% {
19
+ stroke-dashoffset: 0%;
11
20
  }
12
-
13
- .inner-arc {
14
- animation: dash 2s ease forwards;
21
+ }
22
+
23
+ @keyframes show {
24
+ 100% {
25
+ opacity: 1;
15
26
  }
16
-
17
- @keyframes dash {
18
- 100% {
19
- stroke-dashoffset: 0%;
20
- }
21
- }
22
-
23
- @keyframes show {
24
- 100% {
25
- opacity: 1;
26
- }
27
- }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.5.22",
3
+ "version": "1.5.24",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -236,7 +236,8 @@ const Chart = memo(
236
236
  if(controlEl.current){
237
237
  controlEl.current.style.transform = `translate(${cBarX}px,0)`;
238
238
  //计算出当前位移的百分比
239
- const percent = cBarX / (cWidth - cBarWidth);
239
+ let percent = cBarX / (cWidth - cBarWidth);
240
+ percent = isNaN(percent)?1:percent;
240
241
  const translateX = -(controlEnd + start/cPercent - chartWidth) * percent;
241
242
  curControlPercent.current = percent;
242
243
  seriesEl.current.style.transform = `translate(${translateX}px,${marginTop}px)`;
@@ -539,7 +540,6 @@ const Chart = memo(
539
540
  height={height}
540
541
  />
541
542
  )}
542
-
543
543
  {showCtl && !!control && (
544
544
  <Tooltip
545
545
  isVertical={isVertical}
@@ -254,6 +254,7 @@ const Component = memo(
254
254
  },
255
255
  label,
256
256
  legend: { formatter = legendFormatter, ...legend },
257
+ animation: { ringDuration, labelDuration },
257
258
  margin: { marginLeft, marginTop },
258
259
  },
259
260
  fan: {
@@ -523,6 +524,8 @@ const Component = memo(
523
524
  >
524
525
  <g
525
526
  style={{
527
+ "--labelDuration":labelDuration+"ms",
528
+ "--ringDuration":ringDuration+"ms",
526
529
  transition: "transform ease-in-out 0.3s",
527
530
  transform:
528
531
  "translate(" +
@@ -564,7 +567,7 @@ const Component = memo(
564
567
  style={{
565
568
  strokeDasharray: `${dashLength},${2 * dashLength}`,
566
569
  strokeDashoffset: dashLength,
567
- animationDelay: `${index * 2000}ms`,
570
+ animationDelay: `${index * ringDuration}ms`,
568
571
  }}
569
572
  data-index={index}
570
573
  onClick={onClick}
@@ -601,7 +604,7 @@ const Component = memo(
601
604
  )}
602
605
  {label && (
603
606
  <RingLabel
604
- config={{ ...label, maxRadius: maxRadius + 2 }}
607
+ config={{ ...label, maxRadius: maxRadius + 2, ringDuration, labelDuration }}
605
608
  iosStyle={{isIOS, left:halfChartWidth+marginLeft, top:halfChartHeight+marginTop}}
606
609
  arcs={_arcs}
607
610
  judge={judgeData}
@@ -1137,7 +1140,7 @@ const Label = ({
1137
1140
  className={animation ? ringCss["label-line"] : ""}
1138
1141
  style={{
1139
1142
  animationDelay: `${
1140
- animation ? (actualIndex + 1) * 2000 - 800 : 0
1143
+ animation ? (actualIndex + 1) * ringDuration - labelDuration : 0
1141
1144
  }ms`,
1142
1145
  }}
1143
1146
  d={
@@ -1234,6 +1237,8 @@ const Label = ({
1234
1237
 
1235
1238
  const RingLabel = ({
1236
1239
  config: {
1240
+ ringDuration,
1241
+ labelDuration,
1237
1242
  maxRadius = 0,
1238
1243
  lineLength,
1239
1244
  lineColor,
@@ -1321,7 +1326,7 @@ const RingLabel = ({
1321
1326
  <path
1322
1327
  className={ringCss["label-line"]}
1323
1328
  style={{
1324
- animationDelay: `${(actualIndex + 1) * 2000 - 800}ms`,
1329
+ animationDelay: `${(actualIndex + 1) * ringDuration - labelDuration}ms`,
1325
1330
  }}
1326
1331
  d={
1327
1332
  "M" +
@@ -1361,7 +1366,7 @@ const RingLabel = ({
1361
1366
  whiteSpace: "nowrap",
1362
1367
  float: x3 >= 0 ? "left" : "right",
1363
1368
  width: "max-content",
1364
- animationDelay: `${(actualIndex + 1) * 2000 - 800}ms`,
1369
+ animationDelay: `${(actualIndex + 1) * ringDuration - labelDuration}ms`,
1365
1370
  display:"flex",
1366
1371
  alignItems:"center"
1367
1372
  }}
@@ -1,27 +1,27 @@
1
1
  /*甜甜圈图专用css*/
2
2
  .label-line {
3
- stroke-dasharray: 100;
4
- stroke-dashoffset: 100;
5
- animation: dash 800ms ease forwards;
6
- }
3
+ stroke-dasharray: 100;
4
+ stroke-dashoffset: 100;
5
+ animation: dash var(--labelDuration) ease forwards;
6
+ }
7
7
 
8
- .label-text {
9
- opacity: 0;
10
- animation: show 800ms ease forwards;
8
+ .label-text {
9
+ opacity: 0;
10
+ animation: show var(--labelDuration) ease forwards;
11
+ }
12
+
13
+ .inner-arc {
14
+ animation: dash var(--ringDuration) ease forwards;
15
+ }
16
+
17
+ @keyframes dash {
18
+ 100% {
19
+ stroke-dashoffset: 0%;
11
20
  }
12
-
13
- .inner-arc {
14
- animation: dash 2s ease forwards;
21
+ }
22
+
23
+ @keyframes show {
24
+ 100% {
25
+ opacity: 1;
15
26
  }
16
-
17
- @keyframes dash {
18
- 100% {
19
- stroke-dashoffset: 0%;
20
- }
21
- }
22
-
23
- @keyframes show {
24
- 100% {
25
- opacity: 1;
26
- }
27
- }
27
+ }
@@ -95,6 +95,7 @@ export default ({
95
95
  };
96
96
  }, [auto, tickLength, interval, isHover, active]);
97
97
  const name = currentIndex === null ? null : axisX.allTicks[currentIndex];
98
+
98
99
  return {
99
100
  name,
100
101
  x: axisX.scaler(name),