react-native-gifted-charts 1.3.33 → 1.4.1
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 +9 -2
- package/package.json +2 -1
- package/src/BarChart/Animated2DWithGradient.tsx +13 -154
- package/src/BarChart/RenderBars.tsx +29 -179
- package/src/BarChart/RenderStackBars.tsx +22 -104
- package/src/BarChart/index.tsx +87 -686
- package/src/Components/AnimatedThreeDBar/index.tsx +16 -48
- package/src/Components/BarAndLineChartsWrapper/index.tsx +38 -283
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +17 -339
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +147 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +157 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +86 -0
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +42 -0
- package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +1 -1
- package/src/Components/BarSpecificComponents/cap.tsx +1 -1
- package/src/Components/common/StripAndLabel.tsx +3 -56
- package/src/Components/lineSvg.tsx +1 -1
- package/src/LineChart/LineChartBicolor.tsx +80 -516
- package/src/LineChart/index.tsx +266 -1778
- package/src/PieChart/index.tsx +20 -84
- package/src/PieChart/main.tsx +47 -119
- package/src/PopulationPyramid/index.tsx +90 -203
- package/src/index.tsx +7 -12
- package/src/BarChart/types.ts +0 -394
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart.tsx +0 -402
- package/src/LineChart/types.ts +0 -575
- package/src/PieChart/types.ts +0 -77
- package/src/PopulationPyramid/types.ts +0 -200
- package/src/utils/constants.ts +0 -333
- package/src/utils/index.tsx +0 -1137
- package/src/utils/types.ts +0 -360
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {useEffect, useState} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
StyleSheet,
|
|
5
|
-
ColorValue,
|
|
6
5
|
LayoutAnimation,
|
|
7
6
|
Platform,
|
|
8
7
|
UIManager,
|
|
@@ -11,45 +10,13 @@ import {
|
|
|
11
10
|
import LinearGradient from 'react-native-linear-gradient';
|
|
12
11
|
import Svg, {Defs, Rect} from 'react-native-svg';
|
|
13
12
|
import {styles} from './styles';
|
|
14
|
-
import {
|
|
13
|
+
import { useAnimatedThreeDBar, animatedBarPropTypes, trianglePropTypes, BarDefaults } from 'gifted-charts-core';
|
|
15
14
|
|
|
16
15
|
if (Platform.OS === 'android') {
|
|
17
16
|
UIManager.setLayoutAnimationEnabledExperimental &&
|
|
18
17
|
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
type trianglePropTypes = {
|
|
22
|
-
style: any;
|
|
23
|
-
width: number;
|
|
24
|
-
color: ColorValue;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
type animatedBarPropTypes = {
|
|
28
|
-
isAnimated?: boolean;
|
|
29
|
-
animationDuration: number;
|
|
30
|
-
width: number;
|
|
31
|
-
sideWidth: number;
|
|
32
|
-
height: number;
|
|
33
|
-
showGradient: boolean;
|
|
34
|
-
gradientColor: any;
|
|
35
|
-
frontColor: ColorValue;
|
|
36
|
-
sideColor: ColorValue;
|
|
37
|
-
topColor: ColorValue;
|
|
38
|
-
opacity: number;
|
|
39
|
-
side: String;
|
|
40
|
-
horizontal: boolean;
|
|
41
|
-
intactTopLabel: boolean;
|
|
42
|
-
showValuesAsTopLabel: boolean;
|
|
43
|
-
topLabelContainerStyle?: any;
|
|
44
|
-
topLabelTextStyle?: any;
|
|
45
|
-
barBackgroundPattern?: Function;
|
|
46
|
-
barInnerComponent?: (item?: barDataItem, index?: number) => ReactNode;
|
|
47
|
-
patternId?: String;
|
|
48
|
-
barStyle?: object;
|
|
49
|
-
item: any;
|
|
50
|
-
index: number;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
20
|
const TriangleCorner = (props: trianglePropTypes) => {
|
|
54
21
|
return (
|
|
55
22
|
<View
|
|
@@ -78,6 +45,10 @@ const triangleStyles = StyleSheet.create({
|
|
|
78
45
|
});
|
|
79
46
|
|
|
80
47
|
const AnimatedThreeDBar = (props: animatedBarPropTypes) => {
|
|
48
|
+
const [height, setHeight] = useState(
|
|
49
|
+
props.isAnimated ? (Platform.OS === 'ios' ? 0 : 20) : props.height,
|
|
50
|
+
);
|
|
51
|
+
|
|
81
52
|
const {
|
|
82
53
|
isAnimated,
|
|
83
54
|
animationDuration,
|
|
@@ -95,10 +66,16 @@ const AnimatedThreeDBar = (props: animatedBarPropTypes) => {
|
|
|
95
66
|
topLabelTextStyle,
|
|
96
67
|
} = props;
|
|
97
68
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
69
|
+
const {
|
|
70
|
+
showGradient,
|
|
71
|
+
gradientColor,
|
|
72
|
+
frontColor,
|
|
73
|
+
sideColor,
|
|
74
|
+
topColor,
|
|
75
|
+
opacity,
|
|
76
|
+
initialRender,
|
|
77
|
+
setInitialRender,
|
|
78
|
+
} = useAnimatedThreeDBar(props);
|
|
102
79
|
|
|
103
80
|
useEffect(() => {
|
|
104
81
|
if (isAnimated) {
|
|
@@ -130,15 +107,6 @@ const AnimatedThreeDBar = (props: animatedBarPropTypes) => {
|
|
|
130
107
|
setTimeout(() => elevate(), Platform.OS == 'ios' ? 10 : 100);
|
|
131
108
|
};
|
|
132
109
|
|
|
133
|
-
const showGradient = props.showGradient || false;
|
|
134
|
-
const gradientColor = props.gradientColor || 'white';
|
|
135
|
-
|
|
136
|
-
const frontColor = props.frontColor || '#fe2233';
|
|
137
|
-
const sideColor = props.sideColor || '#cc2233';
|
|
138
|
-
const topColor = props.topColor || '#ff4433';
|
|
139
|
-
|
|
140
|
-
const opacity = props.opacity || 1;
|
|
141
|
-
|
|
142
110
|
return (
|
|
143
111
|
<View style={styles.container}>
|
|
144
112
|
{!initialRender && (
|
|
@@ -4,15 +4,11 @@ import {renderHorizSections} from './renderHorizSections';
|
|
|
4
4
|
import RenderLineInBarChart from './renderLineInBarChart';
|
|
5
5
|
import RenderVerticalLines from './renderVerticalLines';
|
|
6
6
|
import {
|
|
7
|
-
AxesAndRulesDefaults,
|
|
8
|
-
BarDefaults,
|
|
9
7
|
chartTypes,
|
|
10
8
|
yAxisSides,
|
|
11
|
-
} from '../../utils/constants';
|
|
12
|
-
import {
|
|
13
9
|
BarAndLineChartsWrapperTypes,
|
|
14
|
-
|
|
15
|
-
} from '
|
|
10
|
+
useBarAndLineChartsWrapper,
|
|
11
|
+
} from 'gifted-charts-core';
|
|
16
12
|
|
|
17
13
|
const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
18
14
|
const {
|
|
@@ -23,14 +19,9 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
23
19
|
labelsExtraHeight,
|
|
24
20
|
yAxisLabelWidth,
|
|
25
21
|
horizontal,
|
|
26
|
-
rtl,
|
|
27
|
-
shiftX,
|
|
28
|
-
shiftY,
|
|
29
22
|
scrollRef,
|
|
30
23
|
initialSpacing,
|
|
31
24
|
data,
|
|
32
|
-
stackData,
|
|
33
|
-
secondaryData,
|
|
34
25
|
barWidth,
|
|
35
26
|
xAxisThickness,
|
|
36
27
|
totalWidth,
|
|
@@ -40,33 +31,12 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
40
31
|
scrollToIndex,
|
|
41
32
|
scrollAnimation,
|
|
42
33
|
indicatorColor,
|
|
43
|
-
setSelectedIndex,
|
|
44
34
|
spacing,
|
|
45
35
|
showLine,
|
|
46
|
-
lineConfig,
|
|
47
|
-
lineConfig2,
|
|
48
|
-
maxValue,
|
|
49
|
-
lineData,
|
|
50
|
-
lineData2,
|
|
51
|
-
animatedWidth,
|
|
52
|
-
lineBehindBars,
|
|
53
|
-
points,
|
|
54
36
|
points2,
|
|
55
|
-
arrowPoints,
|
|
56
37
|
renderChartContent,
|
|
57
38
|
remainingScrollViewProps,
|
|
58
|
-
|
|
59
|
-
width,
|
|
60
|
-
horizSections,
|
|
61
39
|
endSpacing,
|
|
62
|
-
horizontalRulesStyle,
|
|
63
|
-
noOfSections,
|
|
64
|
-
showFractionalValues,
|
|
65
|
-
axesAndRulesProps,
|
|
66
|
-
|
|
67
|
-
yAxisLabelTexts,
|
|
68
|
-
yAxisOffset,
|
|
69
|
-
rotateYAxisTexts,
|
|
70
40
|
hideAxesAndRules,
|
|
71
41
|
|
|
72
42
|
showXAxisIndices,
|
|
@@ -80,262 +50,34 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
80
50
|
pointerX,
|
|
81
51
|
pointerY,
|
|
82
52
|
|
|
83
|
-
|
|
53
|
+
onEndReached,
|
|
54
|
+
onStartReached,
|
|
84
55
|
} = props;
|
|
85
56
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
axesAndRulesProps.hideOrigin ?? AxesAndRulesDefaults.hideOrigin;
|
|
90
|
-
|
|
91
|
-
const yAxisSide =
|
|
92
|
-
axesAndRulesProps.yAxisSide ?? AxesAndRulesDefaults.yAxisSide;
|
|
93
|
-
const yAxisLabelContainerStyle = axesAndRulesProps.yAxisLabelContainerStyle;
|
|
94
|
-
const yAxisColor =
|
|
95
|
-
axesAndRulesProps.yAxisColor ?? AxesAndRulesDefaults.yAxisColor;
|
|
96
|
-
const yAxisExtraHeight =
|
|
97
|
-
axesAndRulesProps.yAxisExtraHeight ?? containerHeight / 20;
|
|
98
|
-
const trimYAxisAtTop =
|
|
99
|
-
axesAndRulesProps.trimYAxisAtTop ?? AxesAndRulesDefaults.trimYAxisAtTop;
|
|
100
|
-
const overflowTop =
|
|
101
|
-
axesAndRulesProps.overflowTop ?? AxesAndRulesDefaults.overflowTop;
|
|
102
|
-
const yAxisThickness =
|
|
103
|
-
axesAndRulesProps.yAxisThickness ?? AxesAndRulesDefaults.yAxisThickness;
|
|
104
|
-
const xAxisColor =
|
|
105
|
-
axesAndRulesProps.xAxisColor ?? AxesAndRulesDefaults.xAxisColor;
|
|
106
|
-
const xAxisLength = axesAndRulesProps.xAxisLength;
|
|
107
|
-
const xAxisType =
|
|
108
|
-
axesAndRulesProps.xAxisType ?? AxesAndRulesDefaults.xAxisType;
|
|
109
|
-
const xAxisLabelsVerticalShift =
|
|
110
|
-
axesAndRulesProps.xAxisLabelsVerticalShift ??
|
|
111
|
-
AxesAndRulesDefaults.xAxisLabelsVerticalShift;
|
|
112
|
-
const xAxisLabelsHeight = axesAndRulesProps.xAxisLabelsHeight;
|
|
113
|
-
const xAxisTextNumberOfLines = axesAndRulesProps.xAxisTextNumberOfLines;
|
|
114
|
-
const dashWidth =
|
|
115
|
-
axesAndRulesProps.dashWidth ?? AxesAndRulesDefaults.dashWidth;
|
|
116
|
-
const dashGap = axesAndRulesProps.dashGap ?? AxesAndRulesDefaults.dashGap;
|
|
117
|
-
const backgroundColor =
|
|
118
|
-
axesAndRulesProps.backgroundColor ?? AxesAndRulesDefaults.backgroundColor;
|
|
119
|
-
const hideRules =
|
|
120
|
-
axesAndRulesProps.hideRules ?? AxesAndRulesDefaults.hideRules;
|
|
121
|
-
const rulesLength = axesAndRulesProps.rulesLength;
|
|
122
|
-
const rulesType =
|
|
123
|
-
axesAndRulesProps.rulesType ?? AxesAndRulesDefaults.rulesType;
|
|
124
|
-
const rulesThickness =
|
|
125
|
-
axesAndRulesProps.rulesThickness ?? AxesAndRulesDefaults.rulesThickness;
|
|
126
|
-
const rulesColor =
|
|
127
|
-
axesAndRulesProps.rulesColor ?? AxesAndRulesDefaults.rulesColor;
|
|
128
|
-
const rulesConfigArray =
|
|
129
|
-
axesAndRulesProps.rulesConfigArray ?? AxesAndRulesDefaults.rulesConfigArray;
|
|
130
|
-
const showYAxisIndices = axesAndRulesProps.showYAxisIndices ?? false;
|
|
131
|
-
const yAxisIndicesHeight =
|
|
132
|
-
axesAndRulesProps.yAxisIndicesHeight ??
|
|
133
|
-
AxesAndRulesDefaults.yAxisIndicesHeight;
|
|
134
|
-
const yAxisIndicesWidth =
|
|
135
|
-
axesAndRulesProps.yAxisIndicesWidth ??
|
|
136
|
-
AxesAndRulesDefaults.yAxisIndicesWidth;
|
|
137
|
-
const yAxisIndicesColor =
|
|
138
|
-
axesAndRulesProps.yAxisIndicesColor ??
|
|
139
|
-
AxesAndRulesDefaults.yAxisIndicesColor;
|
|
140
|
-
const hideYAxisText =
|
|
141
|
-
axesAndRulesProps.hideYAxisText ?? AxesAndRulesDefaults.hideYAxisText;
|
|
142
|
-
const yAxisTextNumberOfLines =
|
|
143
|
-
axesAndRulesProps.yAxisTextNumberOfLines ??
|
|
144
|
-
AxesAndRulesDefaults.yAxisTextNumberOfLines;
|
|
145
|
-
const yAxisLabelPrefix = axesAndRulesProps.yAxisLabelPrefix ?? '';
|
|
146
|
-
const yAxisLabelSuffix = axesAndRulesProps.yAxisLabelSuffix ?? '';
|
|
147
|
-
const yAxisTextStyle = axesAndRulesProps.yAxisTextStyle;
|
|
148
|
-
const secondaryYAxis = axesAndRulesProps.secondaryYAxis;
|
|
149
|
-
const stepValue = axesAndRulesProps.stepValue;
|
|
150
|
-
const roundToDigits = axesAndRulesProps.roundToDigits;
|
|
151
|
-
|
|
152
|
-
const referenceLinesConfig = axesAndRulesProps.referenceLinesConfig;
|
|
153
|
-
const referenceLinesOverChartContent =
|
|
154
|
-
referenceLinesConfig.referenceLinesOverChartContent ??
|
|
155
|
-
AxesAndRulesDefaults.referenceLinesOverChartContent;
|
|
156
|
-
|
|
157
|
-
const showVerticalLines =
|
|
158
|
-
axesAndRulesProps.showVerticalLines ??
|
|
159
|
-
AxesAndRulesDefaults.showVerticalLines;
|
|
160
|
-
const verticalLinesThickness =
|
|
161
|
-
axesAndRulesProps.verticalLinesThickness ??
|
|
162
|
-
AxesAndRulesDefaults.verticalLinesThickness;
|
|
163
|
-
const verticalLinesHeight = axesAndRulesProps.verticalLinesHeight;
|
|
164
|
-
const verticalLinesColor =
|
|
165
|
-
axesAndRulesProps.verticalLinesColor ??
|
|
166
|
-
AxesAndRulesDefaults.verticalLinesColor;
|
|
167
|
-
const verticalLinesStrokeDashArray =
|
|
168
|
-
axesAndRulesProps.verticalLinesStrokeDashArray ??
|
|
169
|
-
AxesAndRulesDefaults.verticalLinesStrokeDashArray;
|
|
170
|
-
const verticalLinesShift =
|
|
171
|
-
axesAndRulesProps.verticalLinesShift ??
|
|
172
|
-
AxesAndRulesDefaults.verticalLinesShift;
|
|
173
|
-
const verticalLinesZIndex =
|
|
174
|
-
axesAndRulesProps.verticalLinesZIndex ??
|
|
175
|
-
AxesAndRulesDefaults.verticalLinesZIndex;
|
|
176
|
-
const verticalLinesSpacing =
|
|
177
|
-
axesAndRulesProps.verticalLinesSpacing ??
|
|
178
|
-
AxesAndRulesDefaults.verticalLinesSpacing;
|
|
179
|
-
const verticalLinesUptoDataPoint =
|
|
180
|
-
axesAndRulesProps.verticalLinesUptoDataPoint ??
|
|
181
|
-
AxesAndRulesDefaults.verticalLinesUptoDataPoint;
|
|
182
|
-
const noOfVerticalLines = axesAndRulesProps.noOfVerticalLines;
|
|
183
|
-
|
|
184
|
-
const verticalLinesAr = noOfVerticalLines
|
|
185
|
-
? [...Array(noOfVerticalLines).keys()]
|
|
186
|
-
: [...Array(stackData ? stackData.length : data.length).keys()];
|
|
187
|
-
|
|
188
|
-
const horizSectionProps: horizSectionPropTypes = {
|
|
189
|
-
width,
|
|
190
|
-
horizSections,
|
|
191
|
-
noOfSectionsBelowXAxis,
|
|
192
|
-
totalWidth,
|
|
193
|
-
endSpacing,
|
|
194
|
-
yAxisSide,
|
|
195
|
-
horizontalRulesStyle,
|
|
196
|
-
noOfSections,
|
|
197
|
-
stepHeight,
|
|
198
|
-
yAxisLabelWidth,
|
|
199
|
-
yAxisLabelContainerStyle,
|
|
200
|
-
yAxisThickness,
|
|
201
|
-
yAxisColor,
|
|
202
|
-
yAxisExtraHeight,
|
|
57
|
+
const {
|
|
58
|
+
containerHeightIncludingBelowXAxis,
|
|
59
|
+
xAxisLabelsVerticalShift,
|
|
203
60
|
trimYAxisAtTop,
|
|
204
|
-
|
|
205
|
-
xAxisColor,
|
|
206
|
-
xAxisLength,
|
|
207
|
-
xAxisType,
|
|
208
|
-
dashWidth,
|
|
209
|
-
dashGap,
|
|
210
|
-
backgroundColor,
|
|
211
|
-
hideRules,
|
|
212
|
-
rulesLength,
|
|
213
|
-
rulesType,
|
|
214
|
-
rulesThickness,
|
|
215
|
-
rulesColor,
|
|
216
|
-
rulesConfigArray,
|
|
217
|
-
spacing,
|
|
218
|
-
showYAxisIndices,
|
|
219
|
-
yAxisIndicesHeight,
|
|
220
|
-
yAxisIndicesWidth,
|
|
221
|
-
yAxisIndicesColor,
|
|
222
|
-
|
|
223
|
-
hideOrigin,
|
|
224
|
-
hideYAxisText,
|
|
225
|
-
showFractionalValues,
|
|
226
|
-
yAxisTextNumberOfLines,
|
|
227
|
-
yAxisLabelPrefix,
|
|
228
|
-
yAxisLabelSuffix,
|
|
229
|
-
yAxisTextStyle,
|
|
230
|
-
rotateYAxisTexts,
|
|
231
|
-
rtl,
|
|
232
|
-
|
|
233
|
-
containerHeight,
|
|
61
|
+
yAxisExtraHeight,
|
|
234
62
|
overflowTop,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
63
|
+
xAxisLabelsHeight,
|
|
64
|
+
xAxisTextNumberOfLines,
|
|
65
|
+
actualContainerWidth,
|
|
66
|
+
transformForHorizontal,
|
|
67
|
+
horizSectionProps,
|
|
68
|
+
referenceLinesOverChartContent,
|
|
69
|
+
setCanMomentum,
|
|
70
|
+
isCloseToStart,
|
|
71
|
+
isCloseToEnd,
|
|
72
|
+
canMomentum,
|
|
243
73
|
yAxisAtTop,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const lineInBarChartProps = {
|
|
254
|
-
yAxisLabelWidth,
|
|
255
|
-
initialSpacing,
|
|
256
|
-
spacing,
|
|
257
|
-
containerHeight,
|
|
258
|
-
lineConfig,
|
|
259
|
-
maxValue: secondaryYAxis?.maxValue ?? maxValue,
|
|
260
|
-
animatedWidth,
|
|
261
|
-
lineBehindBars,
|
|
262
|
-
points,
|
|
263
|
-
arrowPoints,
|
|
264
|
-
data: lineData?.length ? lineData : stackData ?? data,
|
|
265
|
-
totalWidth,
|
|
266
|
-
barWidth,
|
|
267
|
-
labelsExtraHeight,
|
|
268
|
-
scrollEventThrottle,
|
|
269
|
-
xAxisLabelsVerticalShift,
|
|
270
|
-
};
|
|
271
|
-
const lineInBarChartProps2 = {
|
|
272
|
-
...lineInBarChartProps,
|
|
273
|
-
lineConfig: lineConfig2,
|
|
274
|
-
points: points2,
|
|
275
|
-
data: lineData2,
|
|
276
|
-
};
|
|
277
|
-
const extendedContainerHeight = containerHeight + overflowTop + 10;
|
|
278
|
-
const containerHeightIncludingBelowXAxis =
|
|
279
|
-
extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
|
|
280
|
-
const verticalLinesProps = {
|
|
281
|
-
verticalLinesAr,
|
|
282
|
-
verticalLinesSpacing,
|
|
283
|
-
spacing: lineConfig?.spacing ?? spacing,
|
|
284
|
-
initialSpacing,
|
|
285
|
-
verticalLinesZIndex,
|
|
286
|
-
verticalLinesHeight,
|
|
287
|
-
verticalLinesThickness,
|
|
288
|
-
verticalLinesColor,
|
|
289
|
-
verticalLinesStrokeDashArray,
|
|
290
|
-
verticalLinesShift,
|
|
291
|
-
verticalLinesUptoDataPoint,
|
|
292
|
-
xAxisThickness,
|
|
293
|
-
labelsExtraHeight,
|
|
294
|
-
containerHeight,
|
|
295
|
-
data,
|
|
296
|
-
stackData,
|
|
297
|
-
barWidth,
|
|
298
|
-
maxValue,
|
|
299
|
-
chartType,
|
|
300
|
-
containerHeightIncludingBelowXAxis,
|
|
301
|
-
yAxisLabelWidth,
|
|
302
|
-
totalWidth,
|
|
303
|
-
xAxisLabelsVerticalShift,
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const actualContainerHeight =
|
|
307
|
-
containerHeightIncludingBelowXAxis + labelsExtraHeight - 10;
|
|
308
|
-
const actualContainerWidth = (width ?? totalWidth) + yAxisLabelWidth;
|
|
309
|
-
|
|
310
|
-
/*******************************************************************************************************************************************/
|
|
311
|
-
/*************** horizontal chart related calculations *******************/
|
|
312
|
-
/*******************************************************************************************************************************************/
|
|
313
|
-
|
|
314
|
-
const containerHeightIncludingXaxisLabels =
|
|
315
|
-
actualContainerHeight + BarDefaults.labelsWidthForHorizontal;
|
|
316
|
-
|
|
317
|
-
const difBwWidthHeight =
|
|
318
|
-
actualContainerWidth - containerHeightIncludingXaxisLabels;
|
|
319
|
-
|
|
320
|
-
const transformForHorizontal = [
|
|
321
|
-
{rotate: rtl ? '-90deg' : '90deg'},
|
|
322
|
-
{
|
|
323
|
-
translateY:
|
|
324
|
-
-shiftX + (rtl ? -difBwWidthHeight + 14 : difBwWidthHeight) / 2 - 20,
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
translateX:
|
|
328
|
-
shiftY +
|
|
329
|
-
(rtl
|
|
330
|
-
? (props.width ? -98 - endSpacing : -75 - endSpacing) -
|
|
331
|
-
difBwWidthHeight
|
|
332
|
-
: props.width
|
|
333
|
-
? difBwWidthHeight
|
|
334
|
-
: difBwWidthHeight - 40) /
|
|
335
|
-
2 +
|
|
336
|
-
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52),
|
|
337
|
-
},
|
|
338
|
-
];
|
|
74
|
+
yAxisThickness,
|
|
75
|
+
yAxisSide,
|
|
76
|
+
showVerticalLines,
|
|
77
|
+
verticalLinesProps,
|
|
78
|
+
lineInBarChartProps,
|
|
79
|
+
lineInBarChartProps2,
|
|
80
|
+
} = useBarAndLineChartsWrapper(props);
|
|
339
81
|
|
|
340
82
|
useEffect(() => {
|
|
341
83
|
if (pointerConfig && getPointerProps) {
|
|
@@ -378,6 +120,19 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
378
120
|
})
|
|
379
121
|
: null}
|
|
380
122
|
<ScrollView
|
|
123
|
+
onScrollBeginDrag={() => {
|
|
124
|
+
setCanMomentum(true);
|
|
125
|
+
}}
|
|
126
|
+
onMomentumScrollEnd={({nativeEvent}) => {
|
|
127
|
+
if (isCloseToEnd(nativeEvent) && canMomentum) {
|
|
128
|
+
onEndReached ? onEndReached() : null;
|
|
129
|
+
setCanMomentum(false);
|
|
130
|
+
}
|
|
131
|
+
if (isCloseToStart(nativeEvent) && canMomentum) {
|
|
132
|
+
onStartReached ? onStartReached() : null;
|
|
133
|
+
setCanMomentum(false);
|
|
134
|
+
}
|
|
135
|
+
}}
|
|
381
136
|
scrollEventThrottle={
|
|
382
137
|
props.scrollEventThrottle ? props.scrollEventThrottle : 16
|
|
383
138
|
}
|