gifted-charts-core 0.0.48 → 0.0.49
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/package.json +1 -1
- package/src/PieChart/pro.d.ts +1 -0
- package/src/PieChart/pro.js +2 -26
- package/src/PieChart/pro.ts +3 -11
package/package.json
CHANGED
package/src/PieChart/pro.d.ts
CHANGED
package/src/PieChart/pro.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
|
-
import { useEffect, useState } from 'react';
|
|
18
1
|
import { defaultAnimationDuration } from '../utils/constants';
|
|
19
2
|
export var usePiePro = function (props) {
|
|
20
3
|
var _a, _b;
|
|
@@ -22,13 +5,6 @@ export var usePiePro = function (props) {
|
|
|
22
5
|
var endAngle = (_a = props.endAngle) !== null && _a !== void 0 ? _a : startAngle + Math.PI * (semiCircle ? 1 : 2);
|
|
23
6
|
var total = data.reduce(function (acc, item) { return acc + item.value; }, 0);
|
|
24
7
|
var animationDuration = (_b = props.animationDuration) !== null && _b !== void 0 ? _b : defaultAnimationDuration;
|
|
25
|
-
var _h = __read(useState(isAnimated), 2), isAnimating = _h[0], setIsAnimating = _h[1];
|
|
26
|
-
useEffect(function () {
|
|
27
|
-
if (isAnimated) {
|
|
28
|
-
setIsAnimating(true);
|
|
29
|
-
setTimeout(function () { return setIsAnimating(false); }, animationDuration);
|
|
30
|
-
}
|
|
31
|
-
}, []);
|
|
32
8
|
var endAngleLocal = 0;
|
|
33
9
|
var addValues = function (index) {
|
|
34
10
|
if (index < 0)
|
|
@@ -170,9 +146,9 @@ export var usePiePro = function (props) {
|
|
|
170
146
|
initial: initial,
|
|
171
147
|
dInitial: dInitial,
|
|
172
148
|
dFinal: dFinal,
|
|
173
|
-
isAnimating: isAnimating,
|
|
174
149
|
getStartCaps: getStartCaps,
|
|
175
150
|
getEndCaps: getEndCaps,
|
|
176
|
-
getTextCoordinates: getTextCoordinates
|
|
151
|
+
getTextCoordinates: getTextCoordinates,
|
|
152
|
+
labelsPosition: labelsPosition
|
|
177
153
|
};
|
|
178
154
|
};
|
package/src/PieChart/pro.ts
CHANGED
|
@@ -20,6 +20,7 @@ interface IusePiePro {
|
|
|
20
20
|
index: number,
|
|
21
21
|
labelPos?: LabelsPosition
|
|
22
22
|
) => { x: number; y: number }
|
|
23
|
+
labelsPosition: LabelsPosition
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export const usePiePro = (props: PieChartPropsType): IusePiePro => {
|
|
@@ -38,15 +39,6 @@ export const usePiePro = (props: PieChartPropsType): IusePiePro => {
|
|
|
38
39
|
const total = data.reduce((acc, item) => acc + item.value, 0)
|
|
39
40
|
const animationDuration = props.animationDuration ?? defaultAnimationDuration
|
|
40
41
|
|
|
41
|
-
const [isAnimating, setIsAnimating] = useState(isAnimated)
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (isAnimated) {
|
|
45
|
-
setIsAnimating(true)
|
|
46
|
-
setTimeout(() => setIsAnimating(false), animationDuration)
|
|
47
|
-
}
|
|
48
|
-
}, [])
|
|
49
|
-
|
|
50
42
|
let endAngleLocal = 0
|
|
51
43
|
|
|
52
44
|
const addValues = (index: number) => {
|
|
@@ -253,9 +245,9 @@ export const usePiePro = (props: PieChartPropsType): IusePiePro => {
|
|
|
253
245
|
initial,
|
|
254
246
|
dInitial,
|
|
255
247
|
dFinal,
|
|
256
|
-
isAnimating,
|
|
257
248
|
getStartCaps,
|
|
258
249
|
getEndCaps,
|
|
259
|
-
getTextCoordinates
|
|
250
|
+
getTextCoordinates,
|
|
251
|
+
labelsPosition
|
|
260
252
|
}
|
|
261
253
|
}
|