react-native-gifted-charts 1.4.62 → 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.
- package/README.md +1 -1
- package/dist/BarChart/index.js +3 -2
- package/dist/PieChart/index.d.ts +1 -1
- package/dist/PieChart/index.js +3 -3
- package/dist/PieChart/main.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<a href="https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts">
|
|
11
11
|
<img src="/demos/gitLogo.png" height="auto" width="28" height="28" />
|
|
12
12
|
</a>
|
|
13
|
-
<a href="https://stackoverflow.com/questions/tagged/react-native-gifted-charts">
|
|
13
|
+
<a href="https://stackoverflow.com/questions/tagged/react-native-gifted-charts?tab=Newest">
|
|
14
14
|
<img src="/demos/stackOverflow.png" height="auto" width="28" height="28" />
|
|
15
15
|
</a>
|
|
16
16
|
<a href="https://discord.gg/FBbu9duJxs">
|
package/dist/BarChart/index.js
CHANGED
|
@@ -133,9 +133,10 @@ export var BarChart = function (props) {
|
|
|
133
133
|
};
|
|
134
134
|
var activatePointer = function (x) {
|
|
135
135
|
var _a;
|
|
136
|
+
var chartData = stackData !== null && stackData !== void 0 ? stackData : data;
|
|
136
137
|
var factor = (x - initialSpacing - barWidth / 2) / (spacing + barWidth);
|
|
137
138
|
factor = Math.round(factor);
|
|
138
|
-
factor = Math.min(factor,
|
|
139
|
+
factor = Math.min(factor, chartData.length - 1);
|
|
139
140
|
factor = Math.max(factor, 0);
|
|
140
141
|
var z = initialSpacing +
|
|
141
142
|
(spacing + barWidth) * factor -
|
|
@@ -144,7 +145,7 @@ export var BarChart = function (props) {
|
|
|
144
145
|
setPointerX(z);
|
|
145
146
|
setPointerIndex(factor);
|
|
146
147
|
var item, y;
|
|
147
|
-
item =
|
|
148
|
+
item = chartData[factor];
|
|
148
149
|
var stackSum = 0;
|
|
149
150
|
if ('stacks' in item) {
|
|
150
151
|
stackSum = item.stacks.reduce(function (acc, stack) { var _a; return acc + ((_a = stack.value) !== null && _a !== void 0 ? _a : 0); }, 0);
|
package/dist/PieChart/index.d.ts
CHANGED
|
@@ -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
|
|
2
|
+
export declare const PieChart: (props: PieChartPropsType) => import("react/jsx-runtime").JSX.Element;
|
package/dist/PieChart/index.js
CHANGED
|
@@ -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 ?
|
|
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),
|
package/dist/PieChart/main.js
CHANGED
|
@@ -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.
|
|
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.
|
|
29
|
+
"gifted-charts-core": "0.1.66"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|