@easyv/charts 1.3.15 → 1.3.17
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.
|
@@ -435,8 +435,9 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
435
435
|
|
|
436
436
|
var _series = (0, _toConsumableArray2["default"])(series.values());
|
|
437
437
|
|
|
438
|
+
if (_series.length < arcs.length) console.warn("请检查数据中是否存在相同的s");
|
|
438
439
|
return arcs.map(function (arc, index) {
|
|
439
|
-
return getArc(radius, arc, _series[index]);
|
|
440
|
+
return getArc(radius, arc, _series[index % _series.length]);
|
|
440
441
|
});
|
|
441
442
|
}, [series, arcs, radius]);
|
|
442
443
|
|
|
@@ -55,7 +55,7 @@ var _default = function _default(data, dataAnimation) {
|
|
|
55
55
|
};
|
|
56
56
|
var delta = current.y - y;
|
|
57
57
|
return _objectSpread(_objectSpread({}, current), {}, {
|
|
58
|
-
y:
|
|
58
|
+
y: y + delta * v
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
} else {
|
|
@@ -65,7 +65,7 @@ var _default = function _default(data, dataAnimation) {
|
|
|
65
65
|
};
|
|
66
66
|
var delta = oldCurrent.y - current.y;
|
|
67
67
|
return _objectSpread(_objectSpread({}, current), {}, {
|
|
68
|
-
y:
|
|
68
|
+
y: oldCurrent.y + delta * v
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
}
|
package/lib/utils/index.js
CHANGED
|
@@ -833,7 +833,7 @@ var getDataWithPercent = function getDataWithPercent() {
|
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
var sum = valueList.reduce(function (acc, val) {
|
|
836
|
-
return acc + val.
|
|
836
|
+
return acc + val.value;
|
|
837
837
|
}, 0);
|
|
838
838
|
|
|
839
839
|
if (sum === 0) {
|
|
@@ -842,7 +842,7 @@ var getDataWithPercent = function getDataWithPercent() {
|
|
|
842
842
|
|
|
843
843
|
var digits = Math.pow(10, precision);
|
|
844
844
|
var votesPerQuota = valueList.map(function (val) {
|
|
845
|
-
return val.
|
|
845
|
+
return val.value / sum * digits * 100;
|
|
846
846
|
});
|
|
847
847
|
var targetSeats = digits * 100;
|
|
848
848
|
var seats = votesPerQuota.map(function (votes) {
|
package/package.json
CHANGED
|
@@ -175,22 +175,24 @@ const getArc = (
|
|
|
175
175
|
...rest
|
|
176
176
|
},
|
|
177
177
|
series
|
|
178
|
-
) =>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
178
|
+
) => {
|
|
179
|
+
return {
|
|
180
|
+
...rest,
|
|
181
|
+
type: 'pie',
|
|
182
|
+
fieldName: series.fieldName,
|
|
183
|
+
displayName: series.displayName || rest.data.s,
|
|
184
|
+
series: series,
|
|
185
|
+
innerRadius: innerRadius * radius,
|
|
186
|
+
outerRadius: outerRadius * radius,
|
|
187
|
+
arc: arc()
|
|
188
|
+
.innerRadius(innerRadius * radius)
|
|
189
|
+
.outerRadius(outerRadius * radius)
|
|
190
|
+
.cornerRadius(cornerRadius)
|
|
191
|
+
.startAngle(startAngle)
|
|
192
|
+
.endAngle(endAngle)
|
|
193
|
+
.padAngle(padAngle),
|
|
194
|
+
}
|
|
195
|
+
};
|
|
194
196
|
|
|
195
197
|
const getCircleScale = ({ count, color, width, length } = tick, radius) => {
|
|
196
198
|
let data = [],
|
|
@@ -353,7 +355,8 @@ const Component = memo(
|
|
|
353
355
|
const seriesLength = series.size;
|
|
354
356
|
if (!seriesLength) return [];
|
|
355
357
|
const _series = [...series.values()];
|
|
356
|
-
|
|
358
|
+
if(_series.length<arcs.length) console.warn("请检查数据中是否存在相同的s")
|
|
359
|
+
return arcs.map((arc, index) => getArc(radius, arc, _series[index%_series.length]));
|
|
357
360
|
}, [series, arcs, radius]);
|
|
358
361
|
const onClick = useCallback(
|
|
359
362
|
(e) =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { animate, linear } from 'popmotion';
|
|
2
|
+
import { animate, easeIn, easeOut, linear } from 'popmotion';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 图表数据动画
|
|
@@ -36,7 +36,7 @@ export default (data: DataType[], dataAnimation: DataAnimation) => {
|
|
|
36
36
|
const delta: number = current.y - y;
|
|
37
37
|
return {
|
|
38
38
|
...current,
|
|
39
|
-
y:
|
|
39
|
+
y: y + delta * v,
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
42
|
} else {
|
|
@@ -45,7 +45,7 @@ export default (data: DataType[], dataAnimation: DataAnimation) => {
|
|
|
45
45
|
const delta = oldCurrent.y - current.y;
|
|
46
46
|
return {
|
|
47
47
|
...current,
|
|
48
|
-
y:
|
|
48
|
+
y:oldCurrent.y + delta * v,
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
}
|
package/src/utils/index.js
CHANGED
|
@@ -663,14 +663,14 @@ const getDataWithPercent = (data = [], precision = 0) => {
|
|
|
663
663
|
return 0;
|
|
664
664
|
}
|
|
665
665
|
const sum = valueList.reduce( function (acc, val) {
|
|
666
|
-
return acc + val.
|
|
666
|
+
return acc + val.value;
|
|
667
667
|
}, 0);
|
|
668
668
|
if (sum === 0) {
|
|
669
669
|
return 0;
|
|
670
670
|
}
|
|
671
671
|
const digits = Math.pow(10, precision);
|
|
672
672
|
const votesPerQuota = valueList.map(function (val) {
|
|
673
|
-
return val.
|
|
673
|
+
return val.value / sum * digits * 100;
|
|
674
674
|
});
|
|
675
675
|
const targetSeats = digits * 100;
|
|
676
676
|
const seats = votesPerQuota.map(function (votes) {
|