react-native-gifted-charts 1.4.20 → 1.4.21

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.
Files changed (63) hide show
  1. package/README.md +4 -3
  2. package/dist/BarChart/Animated2DWithGradient.js +1 -0
  3. package/dist/BarChart/RenderBars.js +1 -0
  4. package/dist/BarChart/RenderStackBars.js +1 -0
  5. package/dist/BarChart/index.js +1 -0
  6. package/dist/BarChart/styles.js +1 -0
  7. package/dist/Components/AnimatedThreeDBar/index.js +1 -0
  8. package/dist/Components/AnimatedThreeDBar/styles.js +1 -0
  9. package/dist/Components/BarAndLineChartsWrapper/index.js +1 -0
  10. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +1 -0
  11. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +1 -0
  12. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +1 -0
  13. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +1 -0
  14. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +1 -0
  15. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +1 -0
  16. package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +1 -0
  17. package/dist/Components/BarSpecificComponents/cap.js +1 -0
  18. package/dist/Components/BarSpecificComponents/tooltip.js +1 -0
  19. package/dist/Components/common/LinearGradient.js +1 -0
  20. package/dist/Components/common/Pointer.js +1 -0
  21. package/dist/Components/common/StripAndLabel.js +1 -0
  22. package/dist/Components/lineSvg.js +1 -0
  23. package/dist/LineChart/LineChartBicolor.js +1 -0
  24. package/dist/LineChart/index.js +1 -0
  25. package/dist/LineChart/styles.js +1 -0
  26. package/dist/PieChart/index.js +1 -0
  27. package/dist/PieChart/main.js +1 -0
  28. package/dist/PieChartPro/index.js +1 -0
  29. package/dist/PopulationPyramid/index.js +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/utils/index.js +1 -0
  32. package/package.json +21 -20
  33. package/src/BarChart/Animated2DWithGradient.tsx +0 -197
  34. package/src/BarChart/RenderBars.tsx +0 -527
  35. package/src/BarChart/RenderStackBars.tsx +0 -359
  36. package/src/BarChart/index.tsx +0 -391
  37. package/src/BarChart/styles.tsx +0 -47
  38. package/src/Components/AnimatedThreeDBar/index.tsx +0 -258
  39. package/src/Components/AnimatedThreeDBar/styles.tsx +0 -14
  40. package/src/Components/BarAndLineChartsWrapper/index.tsx +0 -246
  41. package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +0 -607
  42. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +0 -151
  43. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +0 -175
  44. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +0 -86
  45. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +0 -42
  46. package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +0 -131
  47. package/src/Components/BarSpecificComponents/barBackgroundPattern.tsx +0 -30
  48. package/src/Components/BarSpecificComponents/cap.tsx +0 -34
  49. package/src/Components/BarSpecificComponents/tooltip.tsx +0 -59
  50. package/src/Components/common/LinearGradient.tsx +0 -27
  51. package/src/Components/common/Pointer.tsx +0 -37
  52. package/src/Components/common/StripAndLabel.tsx +0 -98
  53. package/src/Components/lineSvg.tsx +0 -42
  54. package/src/LineChart/LineChartBicolor.tsx +0 -740
  55. package/src/LineChart/index.tsx +0 -2231
  56. package/src/LineChart/styles.tsx +0 -47
  57. package/src/PieChart/index.tsx +0 -168
  58. package/src/PieChart/main.tsx +0 -363
  59. package/src/PieChartPro/index.tsx +0 -267
  60. package/src/PopulationPyramid/index.tsx +0 -603
  61. package/src/index.tsx +0 -26
  62. package/src/todos.md +0 -24
  63. package/src/utils/index.ts +0 -16
@@ -1,246 +0,0 @@
1
- import React, {Fragment, useEffect} from 'react';
2
- import {View, ScrollView, StyleSheet, I18nManager} from 'react-native';
3
- import {renderHorizSections} from './renderHorizSections';
4
- import RenderLineInBarChart from './renderLineInBarChart';
5
- import RenderVerticalLines from './renderVerticalLines';
6
- import {
7
- chartTypes,
8
- yAxisSides,
9
- BarAndLineChartsWrapperTypes,
10
- useBarAndLineChartsWrapper,
11
- } from 'gifted-charts-core';
12
-
13
- const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
14
- const {
15
- chartType,
16
- containerHeight,
17
- noOfSectionsBelowXAxis,
18
- stepHeight,
19
- labelsExtraHeight,
20
- yAxisLabelWidth,
21
- horizontal,
22
- scrollRef,
23
- initialSpacing,
24
- data,
25
- barWidth,
26
- xAxisThickness,
27
- totalWidth,
28
- disableScroll,
29
- showScrollIndicator,
30
- scrollToEnd,
31
- scrollToIndex,
32
- scrollAnimation,
33
- indicatorColor,
34
- spacing,
35
- showLine,
36
- points2,
37
- renderChartContent,
38
- remainingScrollViewProps,
39
- endSpacing,
40
- hideAxesAndRules,
41
-
42
- showXAxisIndices,
43
- xAxisIndicesHeight,
44
- xAxisIndicesWidth,
45
- xAxisIndicesColor,
46
-
47
- pointerConfig,
48
- getPointerProps,
49
- pointerIndex,
50
- pointerX,
51
- pointerY,
52
-
53
- onEndReached,
54
- onStartReached,
55
- onMomentumScrollEnd,
56
- nestedScrollEnabled,
57
- 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
58
- } = props;
59
-
60
- const {
61
- containerHeightIncludingBelowXAxis,
62
- xAxisLabelsVerticalShift,
63
- trimYAxisAtTop,
64
- yAxisExtraHeight,
65
- overflowTop,
66
- xAxisLabelsHeight,
67
- xAxisTextNumberOfLines,
68
- actualContainerWidth,
69
- transformForHorizontal,
70
- horizSectionProps,
71
- referenceLinesOverChartContent,
72
- setCanMomentum,
73
- isCloseToStart,
74
- isCloseToEnd,
75
- canMomentum,
76
- yAxisAtTop,
77
- yAxisThickness,
78
- yAxisSide,
79
- showVerticalLines,
80
- verticalLinesProps,
81
- lineInBarChartProps,
82
- lineInBarChartProps2,
83
- } = useBarAndLineChartsWrapper({...props, isRTL: I18nManager.isRTL});
84
-
85
- useEffect(() => {
86
- if (pointerConfig && getPointerProps) {
87
- getPointerProps({pointerIndex, pointerX, pointerY});
88
- }
89
- }, [pointerIndex, pointerX, pointerY]);
90
-
91
- /*******************************************************************************************************************************************/
92
- /*******************************************************************************************************************************************/
93
-
94
- const styles = StyleSheet.create({
95
- container: {
96
- width: '100%',
97
- height:
98
- containerHeightIncludingBelowXAxis +
99
- labelsExtraHeight +
100
- xAxisLabelsVerticalShift +
101
- (trimYAxisAtTop ? 0 : yAxisExtraHeight) +
102
- 50 -
103
- overflowTop,
104
- marginTop: trimYAxisAtTop ? containerHeight / 20 : 0,
105
- marginBottom: (xAxisLabelsHeight ?? xAxisTextNumberOfLines * 18) - 55, //This is to not let the Things that should be rendered below the chart overlap with it
106
- },
107
- });
108
-
109
- return (
110
- <View
111
- style={[
112
- styles.container,
113
- horizontal && {
114
- width: actualContainerWidth,
115
- transform: transformForHorizontal,
116
- },
117
- ]}>
118
- {hideAxesAndRules !== true
119
- ? renderHorizSections({
120
- ...horizSectionProps,
121
- onlyReferenceLines: false,
122
- renderReferenceLines: !referenceLinesOverChartContent,
123
- })
124
- : null}
125
- <ScrollView
126
- onScrollBeginDrag={() => {
127
- setCanMomentum(true);
128
- }}
129
- nestedScrollEnabled={nestedScrollEnabled}
130
- onMomentumScrollEnd={({nativeEvent}) => {
131
- if (onMomentumScrollEnd) {
132
- onMomentumScrollEnd();
133
- }
134
- if (isCloseToEnd(nativeEvent) && canMomentum) {
135
- onEndReached ? onEndReached() : null;
136
- setCanMomentum(false);
137
- }
138
- if (isCloseToStart(nativeEvent) && canMomentum) {
139
- onStartReached ? onStartReached() : null;
140
- setCanMomentum(false);
141
- }
142
- }}
143
- scrollEventThrottle={
144
- props.scrollEventThrottle ? props.scrollEventThrottle : 16
145
- }
146
- horizontal
147
- ref={scrollRef}
148
- style={[
149
- {
150
- marginLeft:
151
- horizontal && !yAxisAtTop
152
- ? -yAxisThickness -
153
- (props.width ? 20 : 0) -
154
- (data[data.length - 1]?.barWidth ?? barWidth ?? 0) / 2
155
- : yAxisSide === yAxisSides.RIGHT
156
- ? 0
157
- : yAxisLabelWidth + yAxisThickness,
158
- position: 'absolute',
159
- bottom: chartType === chartTypes.LINE_BI_COLOR ? 0 : xAxisThickness,
160
- },
161
- !!props.width && {width: props.width + extraWidthDueToDataPoint},
162
- horizontal && {
163
- width:
164
- (props.width ?? totalWidth) + (props.width ? endSpacing : -20),
165
- },
166
- ]}
167
- contentContainerStyle={[
168
- {
169
- height:
170
- containerHeightIncludingBelowXAxis +
171
- yAxisExtraHeight +
172
- labelsExtraHeight +
173
- (50 + xAxisLabelsVerticalShift),
174
- width:
175
- Math.max(props.width ?? 0, totalWidth - spacing + endSpacing) +
176
- extraWidthDueToDataPoint,
177
- paddingLeft: initialSpacing,
178
- paddingBottom:
179
- noOfSectionsBelowXAxis * stepHeight + labelsExtraHeight,
180
- alignItems: 'flex-end',
181
- },
182
- !props.width && {width: totalWidth},
183
- ]}
184
- scrollEnabled={!disableScroll}
185
- showsHorizontalScrollIndicator={showScrollIndicator}
186
- indicatorStyle={indicatorColor}
187
- onContentSizeChange={() => {
188
- if (scrollRef.current && scrollToEnd) {
189
- scrollRef.current.scrollToEnd({animated: scrollAnimation});
190
- } else if (scrollRef.current && scrollToIndex) {
191
- scrollRef.current.scrollTo({
192
- x:
193
- initialSpacing +
194
- ((barWidth ?? 0) + spacing) * scrollToIndex -
195
- spacing,
196
- });
197
- }
198
- }}
199
- {...remainingScrollViewProps}>
200
- <Fragment>
201
- {showVerticalLines ? (
202
- <RenderVerticalLines {...verticalLinesProps} />
203
- ) : null}
204
- {
205
- // Only For Bar Charts-
206
- showLine ? <RenderLineInBarChart {...lineInBarChartProps} /> : null
207
- }
208
- {
209
- // Only For Bar Charts-
210
- showLine && points2?.length ? (
211
- <RenderLineInBarChart {...lineInBarChartProps2} />
212
- ) : null
213
- }
214
- {
215
- // Only For Line Charts-
216
- chartType === chartTypes.LINE &&
217
- data.map((item: any, index: number) => {
218
- return showXAxisIndices || item.showXAxisIndex ? (
219
- <View
220
- key={index + '' + item.value}
221
- style={{
222
- position: 'absolute',
223
- height: xAxisIndicesHeight,
224
- width: xAxisIndicesWidth,
225
- backgroundColor: xAxisIndicesColor,
226
- bottom: 60 - xAxisIndicesHeight / 2,
227
- left:
228
- index * spacing +
229
- (initialSpacing - xAxisIndicesWidth / 2) -
230
- 3,
231
- }}
232
- />
233
- ) : null;
234
- })
235
- }
236
- {renderChartContent()}
237
- </Fragment>
238
- </ScrollView>
239
- {referenceLinesOverChartContent
240
- ? renderHorizSections({...horizSectionProps, onlyReferenceLines: true})
241
- : null}
242
- </View>
243
- );
244
- };
245
-
246
- export default BarAndLineChartsWrapper;