react-native-gifted-charts 1.4.63 → 1.4.64

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.
@@ -1,2 +1,2 @@
1
1
  import { PieChartPropsType } from 'gifted-charts-core';
2
- export declare const PieChart: (props: PieChartPropsType) => import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const PieChart: (props: PieChartPropsType) => import("react/jsx-runtime").JSX.Element;
@@ -36,6 +36,7 @@ export var PieChart = function (props) {
36
36
  var _b = __read(useState(0), 2), touchX = _b[0], setTouchX = _b[1];
37
37
  var _c = __read(useState(0), 2), touchY = _c[0], setTouchY = _c[1];
38
38
  var renderInnerCircle = function (innerRadius, innerCircleBorderWidth) {
39
+ var _a, _b;
39
40
  if (props.centerLabelComponent || (donut && !isDataShifted)) {
40
41
  return (_jsx(View, { style: [
41
42
  {
@@ -79,7 +80,7 @@ export var PieChart = function (props) {
79
80
  borderRightWidth: 0.5,
80
81
  borderRightColor: innerCircleColor,
81
82
  },
82
- ], children: _jsx(View, { style: { marginTop: semiCircle ? -0.5 * innerRadius : 0 }, children: props.centerLabelComponent ? props.centerLabelComponent(selectedIndex) : null }) }));
83
+ ], pointerEvents: "box-none", children: _jsx(View, { style: { marginTop: semiCircle ? -0.5 * innerRadius : 0 }, children: (_b = (_a = props.centerLabelComponent) === null || _a === void 0 ? void 0 : _a.call(props, selectedIndex)) !== null && _b !== void 0 ? _b : null }) }));
83
84
  }
84
85
  return null;
85
86
  };
@@ -116,8 +117,7 @@ export var PieChart = function (props) {
116
117
  fontStyle: fontStyle,
117
118
  }, children: getTooltipText(tooltipSelectedIndex) }) })) }));
118
119
  };
119
- if (!total)
120
- return null;
120
+ // if (!total) return null;
121
121
  return (_jsxs(View, { style: {
122
122
  height: (radius + extraRadius + paddingVertical / 2) *
123
123
  (props.semiCircle ? 1 : 2),
@@ -43,7 +43,7 @@ export var PieChartMain = function (props) {
43
43
  setTouchX(x);
44
44
  setTouchY(y);
45
45
  var r = Math.sqrt(Math.pow((x - cx), 2) + Math.pow((y - cy), 2));
46
- if (r > radius)
46
+ if (r > radius || (donut && r < innerRadius))
47
47
  return;
48
48
  var a = Math.atan2(y - cy, x - cx);
49
49
  for (var index = 0; index < data.length; index++) {
@@ -88,7 +88,7 @@ export var PieChartMain = function (props) {
88
88
  vertAdjustment +
89
89
  (vertAdjustment ? strokeWidth : 0)), height: (radius + extraRadius) * 2 + strokeWidth + paddingVertical, width: (radius + extraRadius) * 2 + strokeWidth + paddingHorizontal, children: [_jsx(Defs, { children: data.map(function (item, index) {
90
90
  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 + ''));
91
- }) }), data.length === 1 ? (_jsx(_Fragment, { children: _jsx(Circle, { cx: cx, cy: cy, r: radius, fill: showGradient
91
+ }) }), (data.length === 1 || !total) ? (_jsx(_Fragment, { children: _jsx(Circle, { cx: cx, cy: cy, r: radius, fill: showGradient
92
92
  ? "url(#grad".concat(0, ")")
93
93
  : data[0].color || pieColors[0 % 9] }) })) : (data.map(function (item, index) {
94
94
  var _a = coordinates[index], sx = _a.sx, sy = _a.sy, ax = _a.ax, ay = _a.ay;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.4.63",
3
+ "version": "1.4.64",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid and Radar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -26,7 +26,7 @@
26
26
  "registry": "https://registry.npmjs.org/"
27
27
  },
28
28
  "dependencies": {
29
- "gifted-charts-core": "0.1.65"
29
+ "gifted-charts-core": "0.1.66"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@babel/cli": "^7.24.8",