Skip to content

Commit a453980

Browse files
Merge pull request #1145 from Abhinandan-Kushwaha/development
v1.4.64 fixed issues with PieChart & -ve LineChart
2 parents fe15779 + 13dc9f0 commit a453980

File tree

5 files changed

+32
-8
lines changed

5 files changed

+32
-8
lines changed

docs/LineChart/LineChartProps.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,12 @@ lineGradientComponent={()=>{
523523
}}
524524
```
525525

526+
**Note**
527+
By default the gradient colors start and end within the range of the line displayed in the chart. <br />
528+
If you want the gradient colors to start and end along the full length of the Y-axis, then you need to use the property `gradientUnits="userSpaceOnUse"` inside the `<LinearGradient>` tag. <br />
529+
And also make sure to give x1, y1, x2 and y2 values as `"0%"` or `"100%"` instead of simply giving numerical `'0'` and `'1'`. <br />
530+
See issue- https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/251#issuecomment-3222828003
531+
526532
### LineSegment
527533

528534
```ts

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-gifted-charts",
3-
"version": "1.4.63",
3+
"version": "1.4.64",
44
"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.",
55
"main": "dist/index.js",
66
"files": [
@@ -26,7 +26,7 @@
2626
"registry": "https://registry.npmjs.org/"
2727
},
2828
"dependencies": {
29-
"gifted-charts-core": "0.1.65"
29+
"gifted-charts-core": "0.1.66"
3030
},
3131
"devDependencies": {
3232
"@babel/cli": "^7.24.8",

release-notes/release-notes.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## 🎉 1.4.64
2+
3+
### 🐛 Bug fixes
4+
5+
1. Fixed the issue- "Pie - Donut inner view absorbs onPress events on pie". See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/1131
6+
7+
2. Fixed the issue- "PieChart does not render when all values are zero". See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/1137
8+
9+
3. Fixed the issue- "`negativeStepValue` does not reflect". See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/1107
10+
11+
12+
---
13+
14+
---
15+
16+
---
17+
118
## 🎉 1.4.63
219

320
### 🐛 Bug fixes
@@ -27,7 +44,7 @@ Added types to **style** related props. Thanks to [Seyed Mostafa Hasani](https:/
2744

2845
## ✨ Features added-
2946

30-
1. Added support for spread (or ranged) area chart using the props `spreadAreaData`, `spreadAreaColor` and `spreadAreaOpacity`. Thanks to [Sadat Taseen](https://github.com/sttaseen) for his PR - https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/pull/1104 <br />
47+
1. Added support for spread (or ranged) area chart using the props `spreadAreaData`, `spreadAreaColor` and `spreadAreaOpacity`. Thanks to [Sadat Taseen](https://github.com/sttaseen) and [TirelessDev](https://github.com/TirelessDev) for their PR - https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/pull/1104 <br />
3148
See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/1093 <br />
3249
See this Stackoverflow question- https://stackoverflow.com/questions/65683564/fusioncharts-area-range-graph-with-line
3350

src/PieChart/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ export const PieChart = (props: PieChartPropsType) => {
101101
borderRightWidth: 0.5,
102102
borderRightColor: innerCircleColor,
103103
},
104-
]}>
104+
]}
105+
pointerEvents="box-none">
105106
<View style={{marginTop: semiCircle ? -0.5 * innerRadius : 0}}>
106-
{props.centerLabelComponent ? props.centerLabelComponent(selectedIndex) : null}
107+
{props.centerLabelComponent?.(selectedIndex) ?? null}
107108
</View>
108109
</View>
109110
);
@@ -168,7 +169,7 @@ export const PieChart = (props: PieChartPropsType) => {
168169
);
169170
};
170171

171-
if (!total) return null;
172+
// if (!total) return null;
172173

173174
return (
174175
<View

src/PieChart/main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const PieChartMain = (props: PieChartMainProps) => {
9292
setTouchX(x);
9393
setTouchY(y);
9494
const r = Math.sqrt((x - cx) ** 2 + (y - cy) ** 2);
95-
if (r > radius) return;
95+
if (r > radius || (donut && r < innerRadius)) return;
9696
const a = Math.atan2(y - cy, x - cx);
9797

9898
for (let index = 0; index < data.length; index++) {
@@ -182,7 +182,7 @@ export const PieChartMain = (props: PieChartMainProps) => {
182182
);
183183
})}
184184
</Defs>
185-
{data.length === 1 ? (
185+
{(data.length === 1 || !total) ? (
186186
<>
187187
<Circle
188188
cx={cx}

0 commit comments

Comments
 (0)