@easyv/charts 1.5.19 → 1.5.21
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.
- package/lib/components/PieChart.js +32 -6
- package/lib/hooks/useAxes.js +6 -2
- package/package.json +1 -1
- package/src/components/PieChart.js +18 -6
- package/src/hooks/useAxes.js +6 -2
|
@@ -659,6 +659,11 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
659
659
|
config: _objectSpread(_objectSpread({}, label), {}, {
|
|
660
660
|
maxRadius: maxRadius + 2
|
|
661
661
|
}),
|
|
662
|
+
iosStyle: {
|
|
663
|
+
isIOS: isIOS,
|
|
664
|
+
left: halfChartWidth + marginLeft,
|
|
665
|
+
top: halfChartHeight + marginTop
|
|
666
|
+
},
|
|
662
667
|
arcs: _arcs,
|
|
663
668
|
judge: judgeData
|
|
664
669
|
}))), tooltip && mousePos && mousePos.x != 0 && mousePos.y != 0 && tooltip.manual && /*#__PURE__*/_react["default"].createElement(_PieTooltip.PieTooltip, {
|
|
@@ -788,6 +793,11 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
788
793
|
})));
|
|
789
794
|
}), label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
790
795
|
config: label,
|
|
796
|
+
iosStyle: {
|
|
797
|
+
isIOS: isIOS,
|
|
798
|
+
left: halfChartWidth + marginLeft,
|
|
799
|
+
top: halfChartHeight + marginTop
|
|
800
|
+
},
|
|
791
801
|
arcs: _arcs,
|
|
792
802
|
judge: judgeData
|
|
793
803
|
}), current && /*#__PURE__*/_react["default"].createElement("g", {
|
|
@@ -997,6 +1007,10 @@ var Label = function Label(_ref10) {
|
|
|
997
1007
|
showPercent = _ref10$config$percent.show,
|
|
998
1008
|
percentFont = _ref10$config$percent.font,
|
|
999
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,
|
|
1000
1014
|
arcs = _ref10.arcs,
|
|
1001
1015
|
judge = _ref10.judge,
|
|
1002
1016
|
animation = _ref10.animation;
|
|
@@ -1070,15 +1084,19 @@ var Label = function Label(_ref10) {
|
|
|
1070
1084
|
x: _x,
|
|
1071
1085
|
y: y2 + translateY,
|
|
1072
1086
|
style: {
|
|
1073
|
-
overflow: "visible"
|
|
1087
|
+
overflow: "visible",
|
|
1088
|
+
position: "relative"
|
|
1074
1089
|
}
|
|
1075
1090
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1076
1091
|
className: animation ? _piechartModule["default"]["label-text"] : "",
|
|
1077
1092
|
style: {
|
|
1078
|
-
|
|
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%)",
|
|
1079
1095
|
whiteSpace: "nowrap",
|
|
1080
1096
|
"float": x3 >= 0 ? "left" : "right",
|
|
1081
|
-
width: "max-content"
|
|
1097
|
+
width: "max-content",
|
|
1098
|
+
display: "flex",
|
|
1099
|
+
alignItems: "center"
|
|
1082
1100
|
}
|
|
1083
1101
|
}, _showName && /*#__PURE__*/_react["default"].createElement(_.TextOverflow, {
|
|
1084
1102
|
type: textOverflow,
|
|
@@ -1136,6 +1154,10 @@ var RingLabel = function RingLabel(_ref12) {
|
|
|
1136
1154
|
showPercent = _ref12$config$percent.show,
|
|
1137
1155
|
percentFont = _ref12$config$percent.font,
|
|
1138
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,
|
|
1139
1161
|
judge = _ref12.judge,
|
|
1140
1162
|
arcs = _ref12.arcs;
|
|
1141
1163
|
|
|
@@ -1208,16 +1230,20 @@ var RingLabel = function RingLabel(_ref12) {
|
|
|
1208
1230
|
x: _x,
|
|
1209
1231
|
y: y2 + translateY,
|
|
1210
1232
|
style: {
|
|
1211
|
-
overflow: "visible"
|
|
1233
|
+
overflow: "visible",
|
|
1234
|
+
position: "relative"
|
|
1212
1235
|
}
|
|
1213
1236
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1214
1237
|
className: _piechartModule["default"]["label-text"],
|
|
1215
1238
|
style: {
|
|
1216
|
-
|
|
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%)",
|
|
1217
1241
|
whiteSpace: "nowrap",
|
|
1218
1242
|
"float": x3 >= 0 ? "left" : "right",
|
|
1219
1243
|
width: "max-content",
|
|
1220
|
-
animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms")
|
|
1244
|
+
animationDelay: "".concat((actualIndex + 1) * 2000 - 800, "ms"),
|
|
1245
|
+
display: "flex",
|
|
1246
|
+
alignItems: "center"
|
|
1221
1247
|
}
|
|
1222
1248
|
}, _showName && /*#__PURE__*/_react["default"].createElement(_.TextOverflow, {
|
|
1223
1249
|
type: textOverflow,
|
package/lib/hooks/useAxes.js
CHANGED
|
@@ -231,7 +231,9 @@ var _default = function _default(_ref) {
|
|
|
231
231
|
break;
|
|
232
232
|
|
|
233
233
|
case "step":
|
|
234
|
-
|
|
234
|
+
var newStep = +step;
|
|
235
|
+
newStep = (newDomain[1] - newDomain[0]) / newStep > 30 ? Math.ceil((newDomain[1] - newDomain[0]) / 30) : newStep;
|
|
236
|
+
_ticks = (0, _utils2.getYTicksByStep)(newDomain[1], newDomain[0], newStep);
|
|
235
237
|
break;
|
|
236
238
|
}
|
|
237
239
|
}
|
|
@@ -358,7 +360,9 @@ var _default = function _default(_ref) {
|
|
|
358
360
|
break;
|
|
359
361
|
|
|
360
362
|
case "step":
|
|
361
|
-
|
|
363
|
+
var newStep = +_step;
|
|
364
|
+
newStep = (newDomain[1] - newDomain[0]) / newStep > 30 ? Math.ceil((newDomain[1] - newDomain[0]) / 30) : newStep;
|
|
365
|
+
_ticks = (0, _utils2.getYTicksByStep)(newDomain[1], newDomain[0], newStep);
|
|
362
366
|
break;
|
|
363
367
|
}
|
|
364
368
|
}
|
package/package.json
CHANGED
|
@@ -602,6 +602,7 @@ const Component = memo(
|
|
|
602
602
|
{label && (
|
|
603
603
|
<RingLabel
|
|
604
604
|
config={{ ...label, maxRadius: maxRadius + 2 }}
|
|
605
|
+
iosStyle={{isIOS, left:halfChartWidth+marginLeft, top:halfChartHeight+marginTop}}
|
|
605
606
|
arcs={_arcs}
|
|
606
607
|
judge={judgeData}
|
|
607
608
|
/>
|
|
@@ -819,7 +820,7 @@ const Component = memo(
|
|
|
819
820
|
);
|
|
820
821
|
}
|
|
821
822
|
)}
|
|
822
|
-
{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} />}
|
|
823
824
|
{current && (
|
|
824
825
|
<g
|
|
825
826
|
fillOpacity={y}
|
|
@@ -1070,6 +1071,9 @@ const Label = ({
|
|
|
1070
1071
|
},
|
|
1071
1072
|
percent: { show: showPercent, font: percentFont, precision },
|
|
1072
1073
|
},
|
|
1074
|
+
iosStyle:{
|
|
1075
|
+
isIOS, left, top
|
|
1076
|
+
},
|
|
1073
1077
|
arcs,
|
|
1074
1078
|
judge,
|
|
1075
1079
|
animation,
|
|
@@ -1125,7 +1129,6 @@ const Label = ({
|
|
|
1125
1129
|
const _showName = showName && displayName;
|
|
1126
1130
|
const _showValue = showValue && (value || showSuffix);
|
|
1127
1131
|
const nameStyle = getFontStyle(nameFont);
|
|
1128
|
-
|
|
1129
1132
|
return (
|
|
1130
1133
|
show &&
|
|
1131
1134
|
(_showName || showPercent || showValue) && (
|
|
@@ -1165,15 +1168,18 @@ const Label = ({
|
|
|
1165
1168
|
height="1"
|
|
1166
1169
|
x={_x}
|
|
1167
1170
|
y={y2 + translateY}
|
|
1168
|
-
style={{ overflow: "visible" }}
|
|
1171
|
+
style={{ overflow: "visible", position:"relative" }}
|
|
1169
1172
|
>
|
|
1170
1173
|
<div
|
|
1171
1174
|
className={animation ? ringCss["label-text"] : ""}
|
|
1172
1175
|
style={{
|
|
1173
|
-
|
|
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%)",
|
|
1174
1178
|
whiteSpace: "nowrap",
|
|
1175
1179
|
float: x3 >= 0 ? "left" : "right",
|
|
1176
1180
|
width: "max-content",
|
|
1181
|
+
display:"flex",
|
|
1182
|
+
alignItems:"center"
|
|
1177
1183
|
}}
|
|
1178
1184
|
>
|
|
1179
1185
|
{_showName && (
|
|
@@ -1248,6 +1254,9 @@ const RingLabel = ({
|
|
|
1248
1254
|
},
|
|
1249
1255
|
percent: { show: showPercent, font: percentFont, precision },
|
|
1250
1256
|
},
|
|
1257
|
+
iosStyle:{
|
|
1258
|
+
isIOS, left, top
|
|
1259
|
+
},
|
|
1251
1260
|
judge,
|
|
1252
1261
|
arcs,
|
|
1253
1262
|
}) => {
|
|
@@ -1342,16 +1351,19 @@ const RingLabel = ({
|
|
|
1342
1351
|
height="1"
|
|
1343
1352
|
x={_x}
|
|
1344
1353
|
y={y2 + translateY}
|
|
1345
|
-
style={{ overflow: "visible" }}
|
|
1354
|
+
style={{ overflow: "visible", position:"relative" }}
|
|
1346
1355
|
>
|
|
1347
1356
|
<div
|
|
1348
1357
|
className={ringCss["label-text"]}
|
|
1349
1358
|
style={{
|
|
1350
|
-
|
|
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%)",
|
|
1351
1361
|
whiteSpace: "nowrap",
|
|
1352
1362
|
float: x3 >= 0 ? "left" : "right",
|
|
1353
1363
|
width: "max-content",
|
|
1354
1364
|
animationDelay: `${(actualIndex + 1) * 2000 - 800}ms`,
|
|
1365
|
+
display:"flex",
|
|
1366
|
+
alignItems:"center"
|
|
1355
1367
|
}}
|
|
1356
1368
|
>
|
|
1357
1369
|
{_showName && (
|
package/src/hooks/useAxes.js
CHANGED
|
@@ -208,7 +208,9 @@ export default ({
|
|
|
208
208
|
_ticks = getYTicks(newDomain[1], newDomain[0], +tickCount);
|
|
209
209
|
break;
|
|
210
210
|
case "step":
|
|
211
|
-
|
|
211
|
+
let newStep = +step;
|
|
212
|
+
newStep = (newDomain[1] - newDomain[0])/newStep>30?Math.ceil((newDomain[1] - newDomain[0])/30):newStep;
|
|
213
|
+
_ticks = getYTicksByStep(newDomain[1], newDomain[0], newStep);
|
|
212
214
|
break;
|
|
213
215
|
}
|
|
214
216
|
}
|
|
@@ -368,7 +370,9 @@ export default ({
|
|
|
368
370
|
_ticks = getYTicks(newDomain[1], newDomain[0], +tickCount);
|
|
369
371
|
break;
|
|
370
372
|
case "step":
|
|
371
|
-
|
|
373
|
+
let newStep = +_step;
|
|
374
|
+
newStep = (newDomain[1] - newDomain[0])/newStep>30?Math.ceil((newDomain[1] - newDomain[0])/30):newStep;
|
|
375
|
+
_ticks = getYTicksByStep(newDomain[1], newDomain[0], newStep);
|
|
372
376
|
break;
|
|
373
377
|
}
|
|
374
378
|
}
|