@easyv/charts 1.5.18 → 1.5.20

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.
@@ -350,6 +350,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
350
350
 
351
351
  var _useContext = (0, _react.useContext)(_context.chartContext),
352
352
  id = _useContext.id,
353
+ isIOS = _useContext.isIOS,
353
354
  chartWidth = _useContext.width,
354
355
  chartHeight = _useContext.height,
355
356
  triggerOnRelative = _useContext.triggerOnRelative,
@@ -658,6 +659,11 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
658
659
  config: _objectSpread(_objectSpread({}, label), {}, {
659
660
  maxRadius: maxRadius + 2
660
661
  }),
662
+ iosStyle: {
663
+ isIOS: isIOS,
664
+ left: halfChartWidth + marginLeft,
665
+ top: halfChartHeight + marginTop
666
+ },
661
667
  arcs: _arcs,
662
668
  judge: judgeData
663
669
  }))), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement(_PieTooltip.PieTooltip, {
@@ -787,6 +793,11 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
787
793
  })));
788
794
  }), label && /*#__PURE__*/_react["default"].createElement(Label, {
789
795
  config: label,
796
+ iosStyle: {
797
+ isIOS: isIOS,
798
+ left: halfChartWidth + marginLeft,
799
+ top: halfChartHeight + marginTop
800
+ },
790
801
  arcs: _arcs,
791
802
  judge: judgeData
792
803
  }), current && /*#__PURE__*/_react["default"].createElement("g", {
@@ -796,8 +807,13 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
796
807
  }
797
808
  }, /*#__PURE__*/_react["default"].createElement(Current, {
798
809
  config: current,
799
- width: width,
800
- height: height,
810
+ width: chartWidth,
811
+ height: chartHeight,
812
+ iosStyle: {
813
+ marginLeft: marginLeft,
814
+ marginTop: marginTop,
815
+ isIOS: isIOS
816
+ },
801
817
  data: _arcs,
802
818
  judge: judgeData,
803
819
  currentIndex: +currentIndex
@@ -867,6 +883,10 @@ var Current = function Current(_ref9) {
867
883
  _ref9$config$value$su2 = _ref9$config$value$su.translate,
868
884
  translateSuffixX = _ref9$config$value$su2.x,
869
885
  translateSuffixY = _ref9$config$value$su2.y,
886
+ _ref9$iosStyle = _ref9.iosStyle,
887
+ isIOS = _ref9$iosStyle.isIOS,
888
+ marginLeft = _ref9$iosStyle.marginLeft,
889
+ marginTop = _ref9$iosStyle.marginTop,
870
890
  width = _ref9.width,
871
891
  height = _ref9.height,
872
892
  data = _ref9.data,
@@ -897,17 +917,20 @@ var Current = function Current(_ref9) {
897
917
  //foreignObject标签样式,
898
918
  width: width,
899
919
  height: height,
900
- transform: "translate(-".concat(width / 2, "px,-").concat(height / 2, "px)"),
920
+ position: "relative",
921
+ overflow: "visible",
901
922
  pointerEvents: "none"
902
923
  },
903
924
  boxStyle = {
904
925
  //弹性盒子样式,用于当前值的上下居中对齐等
905
926
  width: width,
906
927
  height: height,
928
+ position: "absolute",
907
929
  display: "flex",
908
930
  flexDirection: "column",
909
931
  justifyContent: "center",
910
- alignItems: "center"
932
+ alignItems: "center",
933
+ transform: isIOS ? "translate(".concat(marginLeft, "px,").concat(marginTop, "px)") : "translate(-".concat(width / 2, "px,-").concat(height / 2, "px)")
911
934
  };
912
935
  var seriesColor = currentData.series.color;
913
936
  seriesColor = seriesColor.type == "pure" ? seriesColor.pure : seriesColor.linear.stops[0].color;
@@ -984,6 +1007,10 @@ var Label = function Label(_ref10) {
984
1007
  showPercent = _ref10$config$percent.show,
985
1008
  percentFont = _ref10$config$percent.font,
986
1009
  precision = _ref10$config$percent.precision,
1010
+ _ref10$iosStyle = _ref10.iosStyle,
1011
+ isIOS = _ref10$iosStyle.isIOS,
1012
+ left = _ref10$iosStyle.left,
1013
+ top = _ref10$iosStyle.top,
987
1014
  arcs = _ref10.arcs,
988
1015
  judge = _ref10.judge,
989
1016
  animation = _ref10.animation;
@@ -1057,15 +1084,19 @@ var Label = function Label(_ref10) {
1057
1084
  x: _x,
1058
1085
  y: y2 + translateY,
1059
1086
  style: {
1060
- overflow: "visible"
1087
+ overflow: "visible",
1088
+ position: "relative"
1061
1089
  }
1062
1090
  }, /*#__PURE__*/_react["default"].createElement("div", {
1063
1091
  className: animation ? _piechartModule["default"]["label-text"] : "",
1064
1092
  style: {
1065
- transform: "translate(0,-50%)",
1093
+ position: isIOS ? "absolute" : "relative",
1094
+ transform: isIOS ? "translate(calc(".concat(x3 < 0 ? "-100%" : "0px", " + ").concat(left + _x, "px),calc(-50% + ").concat(top + y2 + translateY, "px))") : "translate(0,-50%)",
1066
1095
  whiteSpace: "nowrap",
1067
1096
  "float": x3 >= 0 ? "left" : "right",
1068
- width: "max-content"
1097
+ width: "max-content",
1098
+ display: "flex",
1099
+ alignItems: "center"
1069
1100
  }
1070
1101
  }, _showName && /*#__PURE__*/_react["default"].createElement(_.TextOverflow, {
1071
1102
  type: textOverflow,
@@ -1123,6 +1154,10 @@ var RingLabel = function RingLabel(_ref12) {
1123
1154
  showPercent = _ref12$config$percent.show,
1124
1155
  percentFont = _ref12$config$percent.font,
1125
1156
  precision = _ref12$config$percent.precision,
1157
+ _ref12$iosStyle = _ref12.iosStyle,
1158
+ isIOS = _ref12$iosStyle.isIOS,
1159
+ left = _ref12$iosStyle.left,
1160
+ top = _ref12$iosStyle.top,
1126
1161
  judge = _ref12.judge,
1127
1162
  arcs = _ref12.arcs;
1128
1163
 
@@ -1195,16 +1230,20 @@ var RingLabel = function RingLabel(_ref12) {
1195
1230
  x: _x,
1196
1231
  y: y2 + translateY,
1197
1232
  style: {
1198
- overflow: "visible"
1233
+ overflow: "visible",
1234
+ position: "relative"
1199
1235
  }
1200
1236
  }, /*#__PURE__*/_react["default"].createElement("div", {
1201
1237
  className: _piechartModule["default"]["label-text"],
1202
1238
  style: {
1203
- transform: "translate(0,-50%)",
1239
+ position: isIOS ? "absolute" : "relative",
1240
+ transform: isIOS ? "translate(calc(".concat(x3 < 0 ? "-100%" : "0px", " + ").concat(left + _x, "px),calc(-50% + ").concat(top + y2 + translateY, "px))") : "translate(0,-50%)",
1204
1241
  whiteSpace: "nowrap",
1205
1242
  "float": x3 >= 0 ? "left" : "right",
1206
1243
  width: "max-content",
1207
- animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms")
1244
+ animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms"),
1245
+ display: "flex",
1246
+ alignItems: "center"
1208
1247
  }
1209
1248
  }, _showName && /*#__PURE__*/_react["default"].createElement(_.TextOverflow, {
1210
1249
  type: textOverflow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.5.18",
3
+ "version": "1.5.20",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -295,6 +295,7 @@ const Component = memo(
295
295
  const { precision: legendPrecision } = legend.config.percent;
296
296
  const {
297
297
  id,
298
+ isIOS,
298
299
  width: chartWidth,
299
300
  height: chartHeight,
300
301
  triggerOnRelative,
@@ -601,6 +602,7 @@ const Component = memo(
601
602
  {label && (
602
603
  <RingLabel
603
604
  config={{ ...label, maxRadius: maxRadius + 2 }}
605
+ iosStyle={{isIOS, left:halfChartWidth+marginLeft, top:halfChartHeight+marginTop}}
604
606
  arcs={_arcs}
605
607
  judge={judgeData}
606
608
  />
@@ -818,7 +820,7 @@ const Component = memo(
818
820
  );
819
821
  }
820
822
  )}
821
- {label && <Label config={label} arcs={_arcs} judge={judgeData} />}
823
+ {label && <Label config={label} iosStyle={{isIOS, left:halfChartWidth+marginLeft, top:halfChartHeight+marginTop}} arcs={_arcs} judge={judgeData} />}
822
824
  {current && (
823
825
  <g
824
826
  fillOpacity={y}
@@ -826,8 +828,11 @@ const Component = memo(
826
828
  >
827
829
  <Current
828
830
  config={current}
829
- width={width}
830
- height={height}
831
+ width={chartWidth}
832
+ height={chartHeight}
833
+ iosStyle={{
834
+ marginLeft, marginTop, isIOS
835
+ }}
831
836
  data={_arcs}
832
837
  judge={judgeData}
833
838
  currentIndex={+currentIndex}
@@ -910,6 +915,9 @@ const Current = ({
910
915
  },
911
916
  },
912
917
  },
918
+ iosStyle:{
919
+ isIOS, marginLeft, marginTop
920
+ },
913
921
  width,
914
922
  height,
915
923
  data,
@@ -939,17 +947,20 @@ const Current = ({
939
947
  //foreignObject标签样式,
940
948
  width,
941
949
  height,
942
- transform: `translate(-${width / 2}px,-${height / 2}px)`,
950
+ position:"relative",
951
+ overflow:"visible",
943
952
  pointerEvents: "none",
944
953
  },
945
954
  boxStyle = {
946
955
  //弹性盒子样式,用于当前值的上下居中对齐等
947
956
  width,
948
957
  height,
958
+ position:"absolute",
949
959
  display: "flex",
950
960
  flexDirection: "column",
951
961
  justifyContent: "center",
952
962
  alignItems: "center",
963
+ transform: isIOS?`translate(${marginLeft}px,${marginTop}px)`:`translate(-${width / 2}px,-${height / 2}px)`,
953
964
  };
954
965
  let seriesColor = currentData.series.color;
955
966
  seriesColor =
@@ -1060,6 +1071,9 @@ const Label = ({
1060
1071
  },
1061
1072
  percent: { show: showPercent, font: percentFont, precision },
1062
1073
  },
1074
+ iosStyle:{
1075
+ isIOS, left, top
1076
+ },
1063
1077
  arcs,
1064
1078
  judge,
1065
1079
  animation,
@@ -1115,7 +1129,6 @@ const Label = ({
1115
1129
  const _showName = showName && displayName;
1116
1130
  const _showValue = showValue && (value || showSuffix);
1117
1131
  const nameStyle = getFontStyle(nameFont);
1118
-
1119
1132
  return (
1120
1133
  show &&
1121
1134
  (_showName || showPercent || showValue) && (
@@ -1155,15 +1168,18 @@ const Label = ({
1155
1168
  height="1"
1156
1169
  x={_x}
1157
1170
  y={y2 + translateY}
1158
- style={{ overflow: "visible" }}
1171
+ style={{ overflow: "visible", position:"relative" }}
1159
1172
  >
1160
1173
  <div
1161
1174
  className={animation ? ringCss["label-text"] : ""}
1162
1175
  style={{
1163
- transform: "translate(0,-50%)",
1176
+ position:isIOS?"absolute":"relative",
1177
+ transform: isIOS?`translate(calc(${x3<0?"-100%":"0px"} + ${left+_x}px),calc(-50% + ${top+y2+translateY}px))`:"translate(0,-50%)",
1164
1178
  whiteSpace: "nowrap",
1165
1179
  float: x3 >= 0 ? "left" : "right",
1166
1180
  width: "max-content",
1181
+ display:"flex",
1182
+ alignItems:"center"
1167
1183
  }}
1168
1184
  >
1169
1185
  {_showName && (
@@ -1238,6 +1254,9 @@ const RingLabel = ({
1238
1254
  },
1239
1255
  percent: { show: showPercent, font: percentFont, precision },
1240
1256
  },
1257
+ iosStyle:{
1258
+ isIOS, left, top
1259
+ },
1241
1260
  judge,
1242
1261
  arcs,
1243
1262
  }) => {
@@ -1332,16 +1351,19 @@ const RingLabel = ({
1332
1351
  height="1"
1333
1352
  x={_x}
1334
1353
  y={y2 + translateY}
1335
- style={{ overflow: "visible" }}
1354
+ style={{ overflow: "visible", position:"relative" }}
1336
1355
  >
1337
1356
  <div
1338
1357
  className={ringCss["label-text"]}
1339
1358
  style={{
1340
- transform: "translate(0,-50%)",
1359
+ position:isIOS?"absolute":"relative",
1360
+ transform: isIOS?`translate(calc(${x3<0?"-100%":"0px"} + ${left+_x}px),calc(-50% + ${top+y2+translateY}px))`:"translate(0,-50%)",
1341
1361
  whiteSpace: "nowrap",
1342
1362
  float: x3 >= 0 ? "left" : "right",
1343
1363
  width: "max-content",
1344
1364
  animationDelay: `${(actualIndex + 1) * 2000 - 800}ms`,
1365
+ display:"flex",
1366
+ alignItems:"center"
1345
1367
  }}
1346
1368
  >
1347
1369
  {_showName && (