react-native-gifted-charts 1.2.40 → 1.2.41
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 -0
- package/package.json +1 -1
- package/src/BarChart/index.tsx +4 -2
- package/src/PieChart/index.tsx +6 -2
- package/src/todos.md +0 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ The most complete library for Bar, Line, Area, Pie, Donut and Stacked Bar charts
|
|
|
18
18
|
---
|
|
19
19
|
<img src='/demos/bars.png' alt=''/>
|
|
20
20
|
<img src='/demos/lineArea.png' alt=''/>
|
|
21
|
+
<img src='/demos/blues.png' alt=''/>
|
|
21
22
|
<table>
|
|
22
23
|
<tr>
|
|
23
24
|
<td><img src='/demos/scrollLine.gif' alt='' width=320 height=280/></td>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.41",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut and Stacked Bar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"files": [
|
package/src/BarChart/index.tsx
CHANGED
|
@@ -62,6 +62,7 @@ type PropTypes = {
|
|
|
62
62
|
showLine?: Boolean;
|
|
63
63
|
lineData?: any;
|
|
64
64
|
lineConfig?: lineConfigType;
|
|
65
|
+
lineBehindBars?: boolean;
|
|
65
66
|
|
|
66
67
|
cappedBars?: Boolean;
|
|
67
68
|
capThickness?: number;
|
|
@@ -235,6 +236,7 @@ export const BarChart = (props: PropTypes) => {
|
|
|
235
236
|
return props.data;
|
|
236
237
|
}, [props.yAxisOffset, props.data]);
|
|
237
238
|
const lineData = props.lineData || data;
|
|
239
|
+
const lineBehindBars = props.lineBehindBars || false;
|
|
238
240
|
const defaultLineConfig = {
|
|
239
241
|
initialSpacing: initialSpacing,
|
|
240
242
|
curved: false,
|
|
@@ -1434,7 +1436,7 @@ export const BarChart = (props: PropTypes) => {
|
|
|
1434
1436
|
height: containerHeight + 10,
|
|
1435
1437
|
bottom: 60, //stepHeight * -0.5 + xAxisThickness,
|
|
1436
1438
|
width: animatedWidth,
|
|
1437
|
-
zIndex: -1,
|
|
1439
|
+
zIndex: lineBehindBars ? -1 : 100000,
|
|
1438
1440
|
// backgroundColor: 'wheat',
|
|
1439
1441
|
}}>
|
|
1440
1442
|
<Svg>
|
|
@@ -1471,7 +1473,7 @@ export const BarChart = (props: PropTypes) => {
|
|
|
1471
1473
|
height: containerHeight + 10,
|
|
1472
1474
|
bottom: 60, //stepHeight * -0.5 + xAxisThickness,
|
|
1473
1475
|
width: totalWidth,
|
|
1474
|
-
zIndex: -1,
|
|
1476
|
+
zIndex: lineBehindBars ? -1 : 100000,
|
|
1475
1477
|
// backgroundColor: 'rgba(200,150,150,0.1)'
|
|
1476
1478
|
}}>
|
|
1477
1479
|
<Svg>
|
package/src/PieChart/index.tsx
CHANGED
|
@@ -45,6 +45,7 @@ type propTypes = {
|
|
|
45
45
|
toggleFocusOnPress?: Boolean;
|
|
46
46
|
selectedIndex?: number;
|
|
47
47
|
setSelectedIndex?: Function;
|
|
48
|
+
sectionAutoFocus?: boolean;
|
|
48
49
|
onLabelPress?: Function;
|
|
49
50
|
extraRadiusForFocused?: number;
|
|
50
51
|
};
|
|
@@ -69,13 +70,16 @@ type itemType = {
|
|
|
69
70
|
onLabelPress?: Function;
|
|
70
71
|
strokeWidth?: number;
|
|
71
72
|
strokeColor?: string;
|
|
73
|
+
focused?: boolean;
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
export const PieChart = (props: propTypes) => {
|
|
75
77
|
const radius = props.radius || 120;
|
|
76
78
|
const extraRadiusForFocused = props.extraRadiusForFocused || radius / 10;
|
|
77
79
|
const pi = props.semiCircle ? Math.PI / 2 : Math.PI;
|
|
78
|
-
const [selectedIndex, setSelectedIndex] = useState(
|
|
80
|
+
const [selectedIndex, setSelectedIndex] = useState(
|
|
81
|
+
props.data.findIndex(item => item.focused === true),
|
|
82
|
+
);
|
|
79
83
|
let startAngle = props.initialAngle || (props.semiCircle ? -pi : 0);
|
|
80
84
|
let total = 0;
|
|
81
85
|
props.data.forEach(item => {
|
|
@@ -96,7 +100,7 @@ export const PieChart = (props: propTypes) => {
|
|
|
96
100
|
}}>
|
|
97
101
|
{!(
|
|
98
102
|
props.data.length <= 1 ||
|
|
99
|
-
!props.focusOnPress ||
|
|
103
|
+
!(props.focusOnPress || props.sectionAutoFocus) ||
|
|
100
104
|
selectedIndex === -1
|
|
101
105
|
) && (
|
|
102
106
|
<View
|
package/src/todos.md
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
8. Prepare a doc for xAxisLabelTexts and xAxisLabelTextStyle in Bar, Line And Area Charts
|
|
16
16
|
9. Prepare a doc for vertical lines to explain noOfVerticalLines and verticalLinesSpacing props. https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/205
|
|
17
17
|
10. Prepare a doc for negative marginBottom instead of marginTop for x axis labels. https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/190
|
|
18
|
-
11. Prepare a doc for LineChartBicolor https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/221
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
## Architecture Enhancement
|