react-native-gifted-charts 1.4.38 → 1.4.40

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.
@@ -56,9 +56,13 @@ var RenderBars = function (props) {
56
56
  ? -40
57
57
  : -6 -
58
58
  xAxisTextNumberOfLines * 18 -
59
- xAxisLabelsVerticalShift) -
59
+ (value < 0
60
+ ? -xAxisLabelsVerticalShift
61
+ : xAxisLabelsVerticalShift)) -
60
62
  barMarginBottom -
61
- labelsDistanceFromXaxis,
63
+ (value < 0 && !autoShiftLabels
64
+ ? -labelsDistanceFromXaxis
65
+ : labelsDistanceFromXaxis),
62
66
  },
63
67
  rotateLabel
64
68
  ? horizontal
@@ -79,7 +83,7 @@ var RenderBars = function (props) {
79
83
  {
80
84
  translateY: autoShiftLabels
81
85
  ? 0
82
- : 16.5 * xAxisTextNumberOfLines + 14,
86
+ : 16.5 * xAxisTextNumberOfLines + 12,
83
87
  },
84
88
  ],
85
89
  }
@@ -112,7 +112,7 @@ export var BarChart = function (props) {
112
112
  var contentContainerStyle = {
113
113
  position: 'absolute',
114
114
  height: containerHeightIncludingBelowXAxis,
115
- bottom: 60,
115
+ bottom: 60 + labelsExtraHeight,
116
116
  paddingLeft: initialSpacing,
117
117
  width: totalWidth,
118
118
  flexDirection: 'row',
@@ -201,12 +201,12 @@ export var BarChart = function (props) {
201
201
  }, onResponderTerminationRequest: function (evt) { return false; }, style: contentContainerStyle, children: [pointerX > 0 && stripBehindBars ? (_jsx(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: {
202
202
  position: 'absolute',
203
203
  height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
204
- bottom: xAxisLabelsVerticalShift + labelsExtraHeight,
204
+ bottom: xAxisLabelsVerticalShift,
205
205
  width: totalWidth,
206
206
  }, children: renderStripAndLabel(null) })) : null, renderChart(), pointerX > 0 ? (_jsxs(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: {
207
207
  position: 'absolute',
208
208
  height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
209
- bottom: xAxisLabelsVerticalShift + labelsExtraHeight,
209
+ bottom: xAxisLabelsVerticalShift,
210
210
  width: totalWidth,
211
211
  zIndex: 20,
212
212
  }, children: [!stripOverPointer &&
@@ -912,7 +912,18 @@ export var LineChart = function (props) {
912
912
  ? renderAnimatedLabel(true, index, secondaryLabel, secondaryLabelTextStyle, item.secondaryLabelComponent)
913
913
  : renderLabel(true, index, secondaryLabel, secondaryLabelTextStyle, item.secondaryLabelComponent)
914
914
  : null] }, index));
915
- })] }));
915
+ }), (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.dynamicLegendComponent) && pointerX > 0 ? (_jsx(View, { style: [
916
+ { position: 'absolute' },
917
+ pointerConfig.dynamicLegendContainerStyle,
918
+ ], children: pointerConfig.dynamicLegendComponent(dataSet
919
+ ? pointerItemsForSet
920
+ : [
921
+ pointerItem,
922
+ pointerItem2,
923
+ pointerItem3,
924
+ pointerItem4,
925
+ pointerItem5,
926
+ ].filter(function (item) { return !!item; }), pointerIndex) })) : null] }));
916
927
  };
917
928
  return (_jsx(BarAndLineChartsWrapper, __assign({}, barAndLineChartsWrapperProps, { dataSet: props.dataSet, scrollRef: scrollRef, animatedWidth: widthValue, renderChartContent: renderChartContent, remainingScrollViewProps: remainingScrollViewProps })));
918
929
  };
@@ -92,7 +92,7 @@ export var PieChart = function (props) {
92
92
  },
93
93
  {
94
94
  value: total - props.data[selectedIndex].value,
95
- onPress: function () { return alert('black'); },
95
+ // onPress: () => alert('black'),
96
96
  peripheral: true,
97
97
  strokeWidth: 0,
98
98
  },
@@ -1,188 +1,141 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { View } from 'react-native';
3
+ import { TouchableWithoutFeedback, View, } from 'react-native';
4
4
  import Svg, { Path, Circle, Text as SvgText, Defs, RadialGradient, Stop, G, Line, } from 'react-native-svg';
5
5
  import { getPieChartMainProps, pieColors, } from 'gifted-charts-core';
6
6
  import { rnVersion } from '../utils';
7
7
  export var PieChartMain = function (props) {
8
- var _a = getPieChartMainProps(props), isThreeD = _a.isThreeD, isBiggerPie = _a.isBiggerPie, data = _a.data, showInnerComponent = _a.showInnerComponent, radius = _a.radius, canvasWidth = _a.canvasWidth, canvasHeight = _a.canvasHeight, shadowWidth = _a.shadowWidth, backgroundColor = _a.backgroundColor, shadowColor = _a.shadowColor, semiCircle = _a.semiCircle, pi = _a.pi, initialAngle = _a.initialAngle, shadow = _a.shadow, donut = _a.donut, strokeWidth = _a.strokeWidth, strokeColor = _a.strokeColor, innerRadius = _a.innerRadius, showText = _a.showText, textColor = _a.textColor, textSize = _a.textSize, tiltAngle = _a.tiltAngle, labelsPosition = _a.labelsPosition, showTextBackground = _a.showTextBackground, textBackgroundColor = _a.textBackgroundColor, showValuesAsLabels = _a.showValuesAsLabels, showGradient = _a.showGradient, gradientCenterColor = _a.gradientCenterColor, toggleFocusOnPress = _a.toggleFocusOnPress, minShiftX = _a.minShiftX, minShiftY = _a.minShiftY, total = _a.total, horizAdjustment = _a.horizAdjustment, vertAdjustment = _a.vertAdjustment, cx = _a.cx, cy = _a.cy, pData = _a.pData, mData = _a.mData, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical, extraRadius = _a.extraRadius, showExternalLabels = _a.showExternalLabels, getExternaLabelProperties = _a.getExternaLabelProperties;
8
+ var _a = getPieChartMainProps(props), isThreeD = _a.isThreeD, isBiggerPie = _a.isBiggerPie, data = _a.data, showInnerComponent = _a.showInnerComponent, radius = _a.radius, canvasWidth = _a.canvasWidth, canvasHeight = _a.canvasHeight, shadowWidth = _a.shadowWidth, backgroundColor = _a.backgroundColor, shadowColor = _a.shadowColor, semiCircle = _a.semiCircle, pi = _a.pi, initialAngle = _a.initialAngle, shadow = _a.shadow, donut = _a.donut, strokeWidth = _a.strokeWidth, strokeColor = _a.strokeColor, innerRadius = _a.innerRadius, showText = _a.showText, textColor = _a.textColor, textSize = _a.textSize, tiltAngle = _a.tiltAngle, labelsPosition = _a.labelsPosition, showTextBackground = _a.showTextBackground, textBackgroundColor = _a.textBackgroundColor, showValuesAsLabels = _a.showValuesAsLabels, showGradient = _a.showGradient, gradientCenterColor = _a.gradientCenterColor, toggleFocusOnPress = _a.toggleFocusOnPress, minShiftX = _a.minShiftX, minShiftY = _a.minShiftY, total = _a.total, horizAdjustment = _a.horizAdjustment, vertAdjustment = _a.vertAdjustment, cx = _a.cx, cy = _a.cy, pData = _a.pData, mData = _a.mData, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical, extraRadius = _a.extraRadius, showExternalLabels = _a.showExternalLabels, getExternaLabelProperties = _a.getExternaLabelProperties, coordinates = _a.coordinates, onPressed = _a.onPressed;
9
9
  var prevSide = 'right';
10
10
  var prevLabelComponentX = 0;
11
11
  var wasFirstItemOnPole = false;
12
- return (_jsxs(View, { pointerEvents: "box-none", style: [
13
- {
14
- backgroundColor: backgroundColor,
15
- height: semiCircle
16
- ? (canvasHeight + paddingVertical) / 2 + extraRadius
17
- : canvasHeight + paddingVertical + extraRadius * 2,
18
- width: canvasWidth + paddingHorizontal + extraRadius * 2,
19
- overflow: 'hidden',
20
- },
21
- isThreeD && { transform: [{ rotateX: tiltAngle }] },
22
- ], children: [_jsxs(Svg, { pointerEvents: rnVersion >= 720000 ? 'box-none' : 'auto', viewBox: "".concat(strokeWidth / -2 + minShiftX - extraRadius - paddingHorizontal / 2, " ").concat(strokeWidth / -2 + minShiftY - extraRadius - paddingVertical / 2, " ").concat((radius + extraRadius + strokeWidth) * 2 +
23
- paddingHorizontal +
24
- horizAdjustment +
25
- (horizAdjustment ? strokeWidth : 0), " ").concat((radius + extraRadius + strokeWidth) * 2 +
26
- paddingVertical +
27
- vertAdjustment +
28
- (vertAdjustment ? strokeWidth : 0)), height: (radius + extraRadius) * 2 + strokeWidth + paddingVertical, width: (radius + extraRadius) * 2 + strokeWidth + paddingHorizontal, children: [_jsx(Defs, { children: data.map(function (item, index) {
29
- return (_jsxs(RadialGradient, { id: 'grad' + index, cx: "50%", cy: "50%", rx: "50%", ry: "50%", fx: "50%", fy: "50%", gradientUnits: "userSpaceOnUse", children: [_jsx(Stop, { offset: "0%", stopColor: item.gradientCenterColor || gradientCenterColor, stopOpacity: "1" }), _jsx(Stop, { offset: "100%", stopColor: item.color || pieColors[index % 9], stopOpacity: "1" })] }, index + ''));
30
- }) }), data.length === 1 ? (_jsx(_Fragment, { children: _jsx(Circle, { cx: cx, cy: cy, r: radius, fill: showGradient
31
- ? "url(#grad".concat(0, ")")
32
- : data[0].color || pieColors[0 % 9], onPress: function () {
33
- data[0].onPress
34
- ? data[0].onPress()
35
- : props.onPress
36
- ? props.onPress(data[0], 0)
37
- : null;
38
- } }) })) : (data.map(function (item, index) {
39
- // console.log('index', index);
40
- var nextItem;
41
- if (index === pData.length - 1)
42
- nextItem = pData[0];
43
- else
44
- nextItem = pData[index + 1];
45
- var sx = cx * (1 + Math.sin(2 * pi * pData[index] + initialAngle)) +
46
- (item.shiftX || 0);
47
- var sy = cy * (1 - Math.cos(2 * pi * pData[index] + initialAngle)) +
48
- (item.shiftY || 0);
49
- var ax = cx * (1 + Math.sin(2 * pi * nextItem + initialAngle)) +
50
- (item.shiftX || 0);
51
- var ay = cy * (1 - Math.cos(2 * pi * nextItem + initialAngle)) +
52
- (item.shiftY || 0);
53
- if (isBiggerPie && index)
54
- return null;
55
- return (_jsx(Path, { d: "M ".concat(cx + (item.shiftX || 0), " ").concat(cy + (item.shiftY || 0), " L ").concat(sx, " ").concat(sy, " A ").concat(radius, " ").concat(radius, " 0 ").concat(semiCircle ? 0 : data[index].value > total / 2 ? 1 : 0, " 1 ").concat(ax, " ").concat(ay, " L ").concat(cx + (item.shiftX || 0), " ").concat(cy + (item.shiftY || 0)), stroke: item.strokeColor || strokeColor, strokeWidth: props.focusOnPress && props.selectedIndex === index
56
- ? 0
57
- : item.strokeWidth === 0
12
+ var onPressHandler = function (e) {
13
+ var _a = e.nativeEvent, x = _a.locationX, y = _a.locationY;
14
+ x -= extraRadius;
15
+ y -= extraRadius;
16
+ var r = Math.sqrt(Math.pow((x - cx), 2) + Math.pow((y - cy), 2));
17
+ if (r > radius)
18
+ return;
19
+ var a = Math.atan2(y - cy, x - cx);
20
+ for (var index = 0; index < data.length; index++) {
21
+ var angle = coordinates[index];
22
+ var sx = angle.sx, sy = angle.sy, ax = angle.ax, ay = angle.ay;
23
+ var startAngle = Math.atan2(sy - cy, sx - cx);
24
+ var endAngle = Math.atan2(ay - cy, ax - cx);
25
+ if (startAngle < endAngle) {
26
+ if (startAngle < a && a < endAngle) {
27
+ onPressed(data[index], index);
28
+ break;
29
+ }
30
+ }
31
+ else {
32
+ if (a > startAngle || a < endAngle) {
33
+ onPressed(data[index], index);
34
+ break;
35
+ }
36
+ }
37
+ }
38
+ };
39
+ return (_jsx(TouchableWithoutFeedback, { onPress: onPressHandler, children: _jsxs(View, { pointerEvents: "box-only", style: [
40
+ {
41
+ backgroundColor: backgroundColor,
42
+ height: semiCircle
43
+ ? (canvasHeight + paddingVertical) / 2 + extraRadius
44
+ : canvasHeight + paddingVertical + extraRadius * 2,
45
+ width: canvasWidth + paddingHorizontal + extraRadius * 2,
46
+ overflow: 'hidden',
47
+ },
48
+ isThreeD && { transform: [{ rotateX: tiltAngle }] },
49
+ ], children: [_jsxs(Svg, { pointerEvents: rnVersion >= 720000 ? 'box-none' : 'auto', viewBox: "".concat(strokeWidth / -2 + minShiftX - extraRadius - paddingHorizontal / 2, " ").concat(strokeWidth / -2 + minShiftY - extraRadius - paddingVertical / 2, " ").concat((radius + extraRadius + strokeWidth) * 2 +
50
+ paddingHorizontal +
51
+ horizAdjustment +
52
+ (horizAdjustment ? strokeWidth : 0), " ").concat((radius + extraRadius + strokeWidth) * 2 +
53
+ paddingVertical +
54
+ vertAdjustment +
55
+ (vertAdjustment ? strokeWidth : 0)), height: (radius + extraRadius) * 2 + strokeWidth + paddingVertical, width: (radius + extraRadius) * 2 + strokeWidth + paddingHorizontal, children: [_jsx(Defs, { children: data.map(function (item, index) {
56
+ return (_jsxs(RadialGradient, { id: 'grad' + index, cx: "50%", cy: "50%", rx: "50%", ry: "50%", fx: "50%", fy: "50%", gradientUnits: "userSpaceOnUse", children: [_jsx(Stop, { offset: "0%", stopColor: item.gradientCenterColor || gradientCenterColor, stopOpacity: "1" }), _jsx(Stop, { offset: "100%", stopColor: item.color || pieColors[index % 9], stopOpacity: "1" })] }, index + ''));
57
+ }) }), data.length === 1 ? (_jsx(_Fragment, { children: _jsx(Circle, { cx: cx, cy: cy, r: radius, fill: showGradient
58
+ ? "url(#grad".concat(0, ")")
59
+ : data[0].color || pieColors[0 % 9] }) })) : (data.map(function (item, index) {
60
+ var _a = coordinates[index], sx = _a.sx, sy = _a.sy, ax = _a.ax, ay = _a.ay;
61
+ if (isBiggerPie && index)
62
+ return null;
63
+ return (_jsx(Path, { d: "M ".concat(cx + (item.shiftX || 0), " ").concat(cy + (item.shiftY || 0), " L ").concat(sx, " ").concat(sy, " A ").concat(radius, " ").concat(radius, " 0 ").concat(semiCircle ? 0 : data[index].value > total / 2 ? 1 : 0, " 1 ").concat(ax, " ").concat(ay, " L ").concat(cx + (item.shiftX || 0), " ").concat(cy + (item.shiftY || 0)), stroke: item.strokeColor || strokeColor, strokeWidth: props.focusOnPress && props.selectedIndex === index
58
64
  ? 0
59
- : item.strokeWidth || strokeWidth, fill: props.selectedIndex === index || item.peripheral
60
- ? 'none'
61
- : showGradient
62
- ? "url(#grad".concat(index, ")")
63
- : item.color || pieColors[index % 9], onPressIn: function () {
64
- if (item.onPress) {
65
- item.onPress();
65
+ : item.strokeWidth === 0
66
+ ? 0
67
+ : item.strokeWidth || strokeWidth, fill: props.selectedIndex === index || item.peripheral
68
+ ? 'none'
69
+ : showGradient
70
+ ? "url(#grad".concat(index, ")")
71
+ : item.color || pieColors[index % 9] }, index + 'a'));
72
+ })), (showText || showInnerComponent || showExternalLabels) &&
73
+ data.map(function (item, index) {
74
+ var _a, _b, _c, _d, _e, _f, _g;
75
+ var localPieInnerComponent = (_a = item.pieInnerComponent) !== null && _a !== void 0 ? _a : props.pieInnerComponent;
76
+ if (isBiggerPie && index)
77
+ return null;
78
+ if (!props.data[index].value)
79
+ return null;
80
+ var mx = cx * (1 + Math.sin(2 * pi * mData[index] + initialAngle));
81
+ var my = cy * (1 - Math.cos(2 * pi * mData[index] + initialAngle));
82
+ var midx = (mx + cx) / 2;
83
+ var midy = (my + cy) / 2;
84
+ var x = midx, y = midy;
85
+ var labelPosition = item.labelPosition || labelsPosition;
86
+ if (labelPosition === 'onBorder') {
87
+ x = mx;
88
+ y = my;
66
89
  }
67
- else if (props.onPress) {
68
- props.onPress(item, index);
90
+ else if (labelPosition === 'outward') {
91
+ x = (midx + mx) / 2;
92
+ y = (midy + my) / 2;
69
93
  }
70
- if (props.focusOnPress) {
71
- if (props.selectedIndex === index || props.isBiggerPie) {
72
- if (toggleFocusOnPress) {
73
- props.setSelectedIndex(-1);
74
- }
94
+ else if (labelPosition === 'inward') {
95
+ x = (midx + cx) / 2;
96
+ y = (midy + cy) / 2;
97
+ }
98
+ x += item.shiftX || 0;
99
+ y += item.shiftY || 0;
100
+ if (data.length === 1) {
101
+ if (donut) {
102
+ y =
103
+ (radius -
104
+ innerRadius +
105
+ (item.textBackgroundRadius ||
106
+ props.textBackgroundRadius ||
107
+ item.textSize ||
108
+ textSize)) /
109
+ 2;
75
110
  }
76
111
  else {
77
- props.setSelectedIndex(index);
112
+ y = cy;
78
113
  }
79
114
  }
80
- } }, index + 'a'));
81
- })), (showText || showInnerComponent || showExternalLabels) &&
82
- data.map(function (item, index) {
83
- var _a, _b, _c, _d, _e, _f, _g;
84
- var localPieInnerComponent = (_a = item.pieInnerComponent) !== null && _a !== void 0 ? _a : props.pieInnerComponent;
85
- if (isBiggerPie && index)
86
- return null;
87
- if (!props.data[index].value)
88
- return null;
89
- var mx = cx * (1 + Math.sin(2 * pi * mData[index] + initialAngle));
90
- var my = cy * (1 - Math.cos(2 * pi * mData[index] + initialAngle));
91
- var midx = (mx + cx) / 2;
92
- var midy = (my + cy) / 2;
93
- var x = midx, y = midy;
94
- var labelPosition = item.labelPosition || labelsPosition;
95
- if (labelPosition === 'onBorder') {
96
- x = mx;
97
- y = my;
98
- }
99
- else if (labelPosition === 'outward') {
100
- x = (midx + mx) / 2;
101
- y = (midy + my) / 2;
102
- }
103
- else if (labelPosition === 'inward') {
104
- x = (midx + cx) / 2;
105
- y = (midy + cy) / 2;
106
- }
107
- x += item.shiftX || 0;
108
- y += item.shiftY || 0;
109
- if (data.length === 1) {
110
- if (donut) {
111
- y =
112
- (radius -
113
- innerRadius +
114
- (item.textBackgroundRadius ||
115
+ var _h = getExternaLabelProperties(item, mx, my, cx, cy, prevSide, prevLabelComponentX, index === data.length - 1, // isLast
116
+ wasFirstItemOnPole), labelLineColor = _h.labelLineColor, labelLineThickness = _h.labelLineThickness, labelComponentHeight = _h.labelComponentHeight, inX = _h.inX, inY = _h.inY, outX = _h.outX, outY = _h.outY, finalX = _h.finalX, labelComponentX = _h.labelComponentX, labelComponentY = _h.labelComponentY, localExternalLabelComponent = _h.localExternalLabelComponent, isRightHalf = _h.isRightHalf;
117
+ prevSide = isRightHalf ? 'right' : 'left';
118
+ prevLabelComponentX = labelComponentX;
119
+ if (index === 0)
120
+ wasFirstItemOnPole = labelComponentY !== outY;
121
+ return (_jsxs(React.Fragment, { children: [showExternalLabels ? (_jsxs(G, { children: [_jsx(Line, { x1: inX, x2: outX, y1: inY, y2: outY, stroke: labelLineColor, strokeWidth: labelLineThickness }), _jsx(Line, { x1: outX, x2: finalX, y1: outY, y2: outY, stroke: labelLineColor, strokeWidth: labelLineThickness }), localExternalLabelComponent ? (_jsx(G, { x: labelComponentX, y: labelComponentY + labelComponentHeight / 2, children: (_b = localExternalLabelComponent === null || localExternalLabelComponent === void 0 ? void 0 : localExternalLabelComponent(item, index)) !== null && _b !== void 0 ? _b : null })) : null] })) : null, showTextBackground ? (_jsx(Circle, { cx: x + ((_d = (_c = item.shiftTextBackgroundX) !== null && _c !== void 0 ? _c : item.shiftTextX) !== null && _d !== void 0 ? _d : 0), cy: y +
122
+ ((_f = (_e = item.shiftTextBackgroundY) !== null && _e !== void 0 ? _e : item.shiftTextY) !== null && _f !== void 0 ? _f : 0) -
123
+ (item.textSize || textSize) / 4, r: item.textBackgroundRadius ||
115
124
  props.textBackgroundRadius ||
116
125
  item.textSize ||
117
- textSize)) /
118
- 2;
119
- }
120
- else {
121
- y = cy;
122
- }
123
- }
124
- var _h = getExternaLabelProperties(item, mx, my, cx, cy, prevSide, prevLabelComponentX, index === data.length - 1, // isLast
125
- wasFirstItemOnPole), labelLineColor = _h.labelLineColor, labelLineThickness = _h.labelLineThickness, labelComponentHeight = _h.labelComponentHeight, inX = _h.inX, inY = _h.inY, outX = _h.outX, outY = _h.outY, finalX = _h.finalX, labelComponentX = _h.labelComponentX, labelComponentY = _h.labelComponentY, localExternalLabelComponent = _h.localExternalLabelComponent, isRightHalf = _h.isRightHalf;
126
- prevSide = isRightHalf ? 'right' : 'left';
127
- prevLabelComponentX = labelComponentX;
128
- if (index === 0)
129
- wasFirstItemOnPole = labelComponentY !== outY;
130
- return (_jsxs(React.Fragment, { children: [showExternalLabels ? (_jsxs(G, { children: [_jsx(Line, { x1: inX, x2: outX, y1: inY, y2: outY, stroke: labelLineColor, strokeWidth: labelLineThickness }), _jsx(Line, { x1: outX, x2: finalX, y1: outY, y2: outY, stroke: labelLineColor, strokeWidth: labelLineThickness }), localExternalLabelComponent ? (_jsx(G, { x: labelComponentX, y: labelComponentY + labelComponentHeight / 2, children: (_b = localExternalLabelComponent === null || localExternalLabelComponent === void 0 ? void 0 : localExternalLabelComponent(item, index)) !== null && _b !== void 0 ? _b : null })) : null] })) : null, showTextBackground ? (_jsx(Circle, { cx: x + ((_d = (_c = item.shiftTextBackgroundX) !== null && _c !== void 0 ? _c : item.shiftTextX) !== null && _d !== void 0 ? _d : 0), cy: y +
131
- ((_f = (_e = item.shiftTextBackgroundY) !== null && _e !== void 0 ? _e : item.shiftTextY) !== null && _f !== void 0 ? _f : 0) -
132
- (item.textSize || textSize) / 4, r: item.textBackgroundRadius ||
133
- props.textBackgroundRadius ||
134
- item.textSize ||
135
- textSize, fill: item.textBackgroundColor || textBackgroundColor, onPress: function () {
136
- item.onLabelPress
137
- ? item.onLabelPress()
138
- : props.onLabelPress
139
- ? props.onLabelPress(item, index)
140
- : item.onPress
141
- ? item.onPress()
142
- : props.onPress
143
- ? props.onPress(item, index)
144
- : null;
145
- if (props.focusOnPress) {
146
- if (props.selectedIndex === index) {
147
- if (toggleFocusOnPress) {
148
- props.setSelectedIndex(-1);
149
- }
150
- }
151
- else {
152
- props.setSelectedIndex(index);
153
- }
154
- }
155
- } })) : null, showText && (_jsx(SvgText, { fill: item.textColor || textColor || pieColors[(index + 2) % 9], fontSize: item.textSize || textSize, fontFamily: item.font || props.font, fontWeight: item.fontWeight || props.fontWeight, fontStyle: item.fontStyle || props.fontStyle || 'normal', x: x +
156
- (item.shiftTextX || 0) -
157
- (item.textSize || textSize) / 1.8, y: y + (item.shiftTextY || 0), onPress: function () {
158
- item.onLabelPress
159
- ? item.onLabelPress()
160
- : props.onLabelPress
161
- ? props.onLabelPress(item, index)
162
- : item.onPress
163
- ? item.onPress()
164
- : props.onPress
165
- ? props.onPress(item, index)
166
- : null;
167
- if (props.focusOnPress) {
168
- if (props.selectedIndex === index) {
169
- if (toggleFocusOnPress) {
170
- props.setSelectedIndex(-1);
171
- }
172
- }
173
- else {
174
- props.setSelectedIndex(index);
175
- }
176
- }
177
- }, children: item.text || (showValuesAsLabels ? item.value + '' : '') })), localPieInnerComponent ? (_jsx(G, { x: x, y: y, children: (_g = localPieInnerComponent === null || localPieInnerComponent === void 0 ? void 0 : localPieInnerComponent(item, index)) !== null && _g !== void 0 ? _g : null })) : null] }, index));
178
- })] }), isThreeD && shadow && !semiCircle ? (_jsx(View, { style: {
179
- width: radius * 2,
180
- height: radius * 2,
181
- backgroundColor: shadowColor,
182
- borderRadius: radius,
183
- position: 'absolute',
184
- top: shadowWidth + paddingVertical / 2,
185
- left: paddingHorizontal / 2,
186
- zIndex: -1,
187
- } })) : null] }));
126
+ textSize, fill: item.textBackgroundColor || textBackgroundColor })) : null, showText && (_jsx(SvgText, { fill: item.textColor ||
127
+ textColor ||
128
+ pieColors[(index + 2) % 9], fontSize: item.textSize || textSize, fontFamily: item.font || props.font, fontWeight: item.fontWeight || props.fontWeight, fontStyle: item.fontStyle || props.fontStyle || 'normal', x: x +
129
+ (item.shiftTextX || 0) -
130
+ (item.textSize || textSize) / 1.8, y: y + (item.shiftTextY || 0), children: item.text || (showValuesAsLabels ? item.value + '' : '') })), localPieInnerComponent ? (_jsx(G, { x: x, y: y, children: (_g = localPieInnerComponent === null || localPieInnerComponent === void 0 ? void 0 : localPieInnerComponent(item, index)) !== null && _g !== void 0 ? _g : null })) : null] }, index));
131
+ })] }), isThreeD && shadow && !semiCircle ? (_jsx(View, { style: {
132
+ width: radius * 2,
133
+ height: radius * 2,
134
+ backgroundColor: shadowColor,
135
+ borderRadius: radius,
136
+ position: 'absolute',
137
+ top: shadowWidth + paddingVertical / 2,
138
+ left: paddingHorizontal / 2,
139
+ zIndex: -1,
140
+ } })) : null] }) }));
188
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.4.38",
3
+ "version": "1.4.40",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "registry": "https://registry.npmjs.org/"
26
26
  },
27
27
  "dependencies": {
28
- "gifted-charts-core": "0.1.38"
28
+ "gifted-charts-core": "0.1.41"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/cli": "^7.24.8",