@easyv/charts 1.4.3 → 1.4.4
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.
|
@@ -205,7 +205,7 @@ var getAngle = function getAngle(_ref2) {
|
|
|
205
205
|
});
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
-
var getArc = function getArc(radius, _ref3,
|
|
208
|
+
var getArc = function getArc(radius, _ref3, series_, index) {
|
|
209
209
|
var _ref3$padAngle = _ref3.padAngle,
|
|
210
210
|
padAngle = _ref3$padAngle === void 0 ? 0 : _ref3$padAngle,
|
|
211
211
|
_ref3$innerRadius = _ref3.innerRadius,
|
|
@@ -219,6 +219,9 @@ var getArc = function getArc(radius, _ref3, series) {
|
|
|
219
219
|
_ref3$endAngle = _ref3.endAngle,
|
|
220
220
|
endAngle = _ref3$endAngle === void 0 ? 360 : _ref3$endAngle,
|
|
221
221
|
rest = (0, _objectWithoutProperties2["default"])(_ref3, _excluded2);
|
|
222
|
+
var series = series_.find(function (s) {
|
|
223
|
+
return s.fieldName == rest.data.s;
|
|
224
|
+
}) || series_[index % series_.length];
|
|
222
225
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
223
226
|
type: 'pie',
|
|
224
227
|
fieldName: series.fieldName,
|
|
@@ -455,7 +458,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
455
458
|
outerRadius: outerRadius
|
|
456
459
|
});
|
|
457
460
|
});
|
|
458
|
-
}, [data, arcsFunc, arcsFuncTwo, chart, legendPrecision]);
|
|
461
|
+
}, [data, arcsFunc, arcsFuncTwo, chart, legendPrecision, order]);
|
|
459
462
|
|
|
460
463
|
var _arcs = (0, _react.useMemo)(function () {
|
|
461
464
|
var seriesLength = series.size;
|
|
@@ -465,7 +468,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
465
468
|
|
|
466
469
|
if (_series.length < arcs.length) console.warn("请检查数据中是否存在相同的s");
|
|
467
470
|
return arcs.map(function (arc, index) {
|
|
468
|
-
return getArc(radius, arc, _series
|
|
471
|
+
return getArc(radius, arc, _series, index);
|
|
469
472
|
});
|
|
470
473
|
}, [series, arcs, radius]);
|
|
471
474
|
|
package/package.json
CHANGED
|
@@ -174,8 +174,10 @@ const getArc = (
|
|
|
174
174
|
endAngle = 360,
|
|
175
175
|
...rest
|
|
176
176
|
},
|
|
177
|
-
|
|
177
|
+
series_,
|
|
178
|
+
index
|
|
178
179
|
) => {
|
|
180
|
+
const series = series_.find(s=>s.fieldName==rest.data.s) || series_[index%series_.length];
|
|
179
181
|
return {
|
|
180
182
|
...rest,
|
|
181
183
|
type: 'pie',
|
|
@@ -336,11 +338,10 @@ const Component = memo(
|
|
|
336
338
|
});
|
|
337
339
|
if (judgeData == 0) {
|
|
338
340
|
arcs = arcsFuncTwo(data)
|
|
339
|
-
|
|
340
341
|
} else {
|
|
341
342
|
arcs = arcsFunc(data)
|
|
342
343
|
}
|
|
343
|
-
|
|
344
|
+
|
|
344
345
|
//const arcs = arcsFunc(data); 此处是原本的传输饼图data流程
|
|
345
346
|
const legendDataWithPercent = getDataWithPercent(arcs, legendPrecision);
|
|
346
347
|
const _legendDataWithPercent = sortPie(legendDataWithPercent, order);
|
|
@@ -372,15 +373,16 @@ const Component = memo(
|
|
|
372
373
|
innerRadius,
|
|
373
374
|
outerRadius,
|
|
374
375
|
}));
|
|
375
|
-
}, [data, arcsFunc,arcsFuncTwo, chart, legendPrecision]);
|
|
376
|
+
}, [data, arcsFunc,arcsFuncTwo, chart, legendPrecision, order]);
|
|
376
377
|
|
|
377
378
|
const _arcs = useMemo(() => {
|
|
378
379
|
const seriesLength = series.size;
|
|
379
380
|
if (!seriesLength) return [];
|
|
380
381
|
const _series = [...series.values()];
|
|
381
382
|
if(_series.length<arcs.length) console.warn("请检查数据中是否存在相同的s");
|
|
382
|
-
return arcs.map((arc, index) => getArc(radius, arc, _series
|
|
383
|
+
return arcs.map((arc, index) => getArc(radius, arc, _series, index));
|
|
383
384
|
}, [series, arcs, radius]);
|
|
385
|
+
|
|
384
386
|
const onClick = useCallback(
|
|
385
387
|
(e) =>
|
|
386
388
|
onEvent({
|
|
@@ -770,9 +772,8 @@ const Current = ({
|
|
|
770
772
|
fontSize,
|
|
771
773
|
text,
|
|
772
774
|
translate: { x: translateSuffixX, y: translateSuffixY },
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
|
|
775
|
+
}
|
|
776
|
+
}
|
|
776
777
|
},
|
|
777
778
|
width,
|
|
778
779
|
height,
|