react-native-gifted-charts 1.4.11 → 1.4.13
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
CHANGED
|
@@ -17,7 +17,7 @@ The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Popul
|
|
|
17
17
|
|
|
18
18
|
## 📣 Announcement
|
|
19
19
|
|
|
20
|
-
The web counterpart of this library is public now. Try out our new reactJS library- [react-gifted-charts](https://
|
|
20
|
+
The web counterpart of this library is public now. Try out our new reactJS library- [react-gifted-charts](https://www.npmjs.com/package/react-gifted-charts) <br />
|
|
21
21
|
The exact same piece of code that you write to render charts in react-native, can be used to render charts in reactJS using this library!
|
|
22
22
|
|
|
23
23
|
|
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.13",
|
|
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": "src/index.tsx",
|
|
6
6
|
"files": [
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
10
|
"android": "react-native run-android",
|
|
11
|
+
"build": "tsc -p .",
|
|
11
12
|
"ios": "react-native run-ios",
|
|
12
13
|
"start": "react-native start",
|
|
13
14
|
"test": "jest",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"registry": "https://registry.npmjs.org/"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"gifted-charts-core": "^0.1.
|
|
28
|
+
"gifted-charts-core": "^0.1.8"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@babel/core": "^7.22.5",
|
|
@@ -53,6 +53,7 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
53
53
|
onEndReached,
|
|
54
54
|
onStartReached,
|
|
55
55
|
onMomentumScrollEnd,
|
|
56
|
+
extraWidthDueToDataPoint = 0, // extraWidthDueToDataPoint will be receved from props onlhy in case of LineCharts, for other charts it will be undefined and will default to 0
|
|
56
57
|
} = props;
|
|
57
58
|
|
|
58
59
|
const {
|
|
@@ -155,7 +156,7 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
155
156
|
position: 'absolute',
|
|
156
157
|
bottom: chartType === chartTypes.LINE_BI_COLOR ? 0 : xAxisThickness,
|
|
157
158
|
},
|
|
158
|
-
!!props.width && {width: props.width},
|
|
159
|
+
!!props.width && {width: props.width + extraWidthDueToDataPoint},
|
|
159
160
|
horizontal && {
|
|
160
161
|
width:
|
|
161
162
|
(props.width ?? totalWidth) + (props.width ? endSpacing : -20),
|
|
@@ -168,10 +169,9 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
168
169
|
yAxisExtraHeight +
|
|
169
170
|
labelsExtraHeight +
|
|
170
171
|
(50 + xAxisLabelsVerticalShift),
|
|
171
|
-
width:
|
|
172
|
-
props.width ?? 0,
|
|
173
|
-
|
|
174
|
-
),
|
|
172
|
+
width:
|
|
173
|
+
Math.max(props.width ?? 0, totalWidth - spacing + endSpacing) +
|
|
174
|
+
extraWidthDueToDataPoint,
|
|
175
175
|
paddingLeft: initialSpacing,
|
|
176
176
|
paddingBottom:
|
|
177
177
|
noOfSectionsBelowXAxis * stepHeight + labelsExtraHeight,
|
package/src/LineChart/index.tsx
CHANGED
|
@@ -555,7 +555,9 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
555
555
|
});
|
|
556
556
|
|
|
557
557
|
const onStripPress = (item, index) => {
|
|
558
|
-
|
|
558
|
+
if (props.focusedDataPointIndex === undefined || !props.onFocus) {
|
|
559
|
+
setSelectedIndex(index);
|
|
560
|
+
}
|
|
559
561
|
if (props.onFocus) {
|
|
560
562
|
props.onFocus(item, index);
|
|
561
563
|
}
|