gifted-charts-core 0.0.43 → 0.0.45
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/index.js +7 -6
- package/src/PieChart/index.ts +7 -7
package/package.json
CHANGED
package/src/PieChart/index.js
CHANGED
|
@@ -89,7 +89,8 @@ export var usePieChart = function (props) {
|
|
|
89
89
|
? ((_u = props.textBackgroundRadius) !== null && _u !== void 0 ? _u : textSize) * 2 + 6
|
|
90
90
|
: 0;
|
|
91
91
|
/********************************** PRO **********************/
|
|
92
|
-
var
|
|
92
|
+
var startAngleForPro = (_v = props.startAngle) !== null && _v !== void 0 ? _v : 0;
|
|
93
|
+
var animationDuration = (_w = props.animationDuration) !== null && _w !== void 0 ? _w : defaultAnimationDuration;
|
|
93
94
|
var _3 = __read(useState(isAnimated), 2), isAnimating = _3[0], setIsAnimating = _3[1];
|
|
94
95
|
useEffect(function () {
|
|
95
96
|
if (isAnimated) {
|
|
@@ -113,7 +114,7 @@ export var usePieChart = function (props) {
|
|
|
113
114
|
: 'mid';
|
|
114
115
|
var getCoordinates = function (index, additionalValue, addInOnlyStart, addInOnlyEnd) {
|
|
115
116
|
var addedValue = addValues(index - 1) + (addInOnlyEnd ? 0 : additionalValue !== null && additionalValue !== void 0 ? additionalValue : 0);
|
|
116
|
-
var angle = (addedValue / total) * endAngleLocal +
|
|
117
|
+
var angle = (addedValue / total) * endAngleLocal + startAngleForPro;
|
|
117
118
|
var startInnerX = radius + Math.cos(angle) * innerRadius;
|
|
118
119
|
var startInnerY = radius - Math.sin(angle) * innerRadius;
|
|
119
120
|
var startOuterX = radius + Math.cos(angle) * radius;
|
|
@@ -121,7 +122,7 @@ export var usePieChart = function (props) {
|
|
|
121
122
|
var value = addValues(index - 1) +
|
|
122
123
|
data[index].value +
|
|
123
124
|
(addInOnlyStart ? 0 : additionalValue !== null && additionalValue !== void 0 ? additionalValue : 0);
|
|
124
|
-
angle = (value / total) * endAngleLocal +
|
|
125
|
+
angle = (value / total) * endAngleLocal + startAngleForPro;
|
|
125
126
|
var endOuterX = radius + Math.cos(angle) * radius;
|
|
126
127
|
var endOuterY = radius - Math.sin(angle) * radius;
|
|
127
128
|
var endInnerX = radius + Math.cos(angle) * innerRadius;
|
|
@@ -139,7 +140,7 @@ export var usePieChart = function (props) {
|
|
|
139
140
|
};
|
|
140
141
|
var getTextCoordinates = function (index, labelPos) {
|
|
141
142
|
var value = addValues(index - 1) + data[index].value / 2;
|
|
142
|
-
var angle = (value / total) * endAngleLocal +
|
|
143
|
+
var angle = (value / total) * endAngleLocal + startAngleForPro;
|
|
143
144
|
var labelPosition = labelPos || labelsPosition;
|
|
144
145
|
var x = radius +
|
|
145
146
|
Math.cos(angle) *
|
|
@@ -234,7 +235,7 @@ export var usePieChart = function (props) {
|
|
|
234
235
|
pi: pi,
|
|
235
236
|
selectedIndex: selectedIndex,
|
|
236
237
|
setSelectedIndex: setSelectedIndex,
|
|
237
|
-
startAngle: pro ?
|
|
238
|
+
startAngle: pro ? startAngleForPro : startAngle,
|
|
238
239
|
endAngle: endAngle,
|
|
239
240
|
setStartAngle: setStartAngle,
|
|
240
241
|
total: total,
|
|
@@ -258,7 +259,7 @@ export var usePieChart = function (props) {
|
|
|
258
259
|
paddingHorizontal: paddingHorizontal,
|
|
259
260
|
paddingVertical: paddingVertical,
|
|
260
261
|
isAnimated: isAnimated,
|
|
261
|
-
animationDuration: animationDuration,
|
|
262
|
+
animationDuration: animationDuration / 1000,
|
|
262
263
|
// PRO
|
|
263
264
|
initial: initial,
|
|
264
265
|
dInitial: dInitial,
|
package/src/PieChart/index.ts
CHANGED
|
@@ -156,8 +156,8 @@ export const usePieChart = (props: IPieChartPropsType): IusePieChart => {
|
|
|
156
156
|
|
|
157
157
|
/********************************** PRO **********************/
|
|
158
158
|
|
|
159
|
-
const
|
|
160
|
-
|
|
159
|
+
const startAngleForPro = props.startAngle ?? 0
|
|
160
|
+
const animationDuration = props.animationDuration ?? defaultAnimationDuration
|
|
161
161
|
|
|
162
162
|
const [isAnimating, setIsAnimating] = useState(isAnimated)
|
|
163
163
|
|
|
@@ -190,7 +190,7 @@ export const usePieChart = (props: IPieChartPropsType): IusePieChart => {
|
|
|
190
190
|
) => {
|
|
191
191
|
const addedValue =
|
|
192
192
|
addValues(index - 1) + (addInOnlyEnd ? 0 : additionalValue ?? 0)
|
|
193
|
-
let angle = (addedValue / total) * endAngleLocal +
|
|
193
|
+
let angle = (addedValue / total) * endAngleLocal + startAngleForPro
|
|
194
194
|
const startInnerX = radius + Math.cos(angle) * innerRadius
|
|
195
195
|
const startInnerY = radius - Math.sin(angle) * innerRadius
|
|
196
196
|
const startOuterX = radius + Math.cos(angle) * radius
|
|
@@ -200,7 +200,7 @@ export const usePieChart = (props: IPieChartPropsType): IusePieChart => {
|
|
|
200
200
|
addValues(index - 1) +
|
|
201
201
|
data[index].value +
|
|
202
202
|
(addInOnlyStart ? 0 : additionalValue ?? 0)
|
|
203
|
-
angle = (value / total) * endAngleLocal +
|
|
203
|
+
angle = (value / total) * endAngleLocal + startAngleForPro
|
|
204
204
|
|
|
205
205
|
const endOuterX = radius + Math.cos(angle) * radius
|
|
206
206
|
const endOuterY = radius - Math.sin(angle) * radius
|
|
@@ -222,7 +222,7 @@ export const usePieChart = (props: IPieChartPropsType): IusePieChart => {
|
|
|
222
222
|
|
|
223
223
|
const getTextCoordinates = (index: number, labelPos?: LabelsPosition) => {
|
|
224
224
|
const value = addValues(index - 1) + data[index].value / 2
|
|
225
|
-
const angle = (value / total) * endAngleLocal +
|
|
225
|
+
const angle = (value / total) * endAngleLocal + startAngleForPro
|
|
226
226
|
|
|
227
227
|
const labelPosition: LabelsPosition = labelPos || labelsPosition
|
|
228
228
|
|
|
@@ -370,7 +370,7 @@ export const usePieChart = (props: IPieChartPropsType): IusePieChart => {
|
|
|
370
370
|
pi,
|
|
371
371
|
selectedIndex,
|
|
372
372
|
setSelectedIndex,
|
|
373
|
-
startAngle: pro ?
|
|
373
|
+
startAngle: pro ? startAngleForPro : startAngle,
|
|
374
374
|
endAngle,
|
|
375
375
|
setStartAngle,
|
|
376
376
|
total,
|
|
@@ -394,7 +394,7 @@ export const usePieChart = (props: IPieChartPropsType): IusePieChart => {
|
|
|
394
394
|
paddingHorizontal,
|
|
395
395
|
paddingVertical,
|
|
396
396
|
isAnimated,
|
|
397
|
-
animationDuration,
|
|
397
|
+
animationDuration: animationDuration / 1000,
|
|
398
398
|
|
|
399
399
|
// PRO
|
|
400
400
|
|