react-native-gifted-charts 1.3.33 → 1.4.0

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 (31) hide show
  1. package/README.md +9 -2
  2. package/package.json +2 -1
  3. package/src/BarChart/Animated2DWithGradient.tsx +13 -154
  4. package/src/BarChart/RenderBars.tsx +29 -179
  5. package/src/BarChart/RenderStackBars.tsx +22 -104
  6. package/src/BarChart/index.tsx +87 -686
  7. package/src/Components/AnimatedThreeDBar/index.tsx +16 -48
  8. package/src/Components/BarAndLineChartsWrapper/index.tsx +38 -283
  9. package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +17 -339
  10. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +147 -0
  11. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +157 -0
  12. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +86 -0
  13. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +42 -0
  14. package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +1 -1
  15. package/src/Components/BarSpecificComponents/cap.tsx +1 -1
  16. package/src/Components/common/StripAndLabel.tsx +3 -56
  17. package/src/Components/lineSvg.tsx +1 -1
  18. package/src/LineChart/LineChartBicolor.tsx +80 -516
  19. package/src/LineChart/index.tsx +266 -1778
  20. package/src/PieChart/index.tsx +20 -84
  21. package/src/PieChart/main.tsx +47 -119
  22. package/src/PopulationPyramid/index.tsx +90 -203
  23. package/src/index.tsx +2 -14
  24. package/src/BarChart/types.ts +0 -394
  25. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart.tsx +0 -402
  26. package/src/LineChart/types.ts +0 -575
  27. package/src/PieChart/types.ts +0 -77
  28. package/src/PopulationPyramid/types.ts +0 -200
  29. package/src/utils/constants.ts +0 -333
  30. package/src/utils/index.tsx +0 -1137
  31. package/src/utils/types.ts +0 -360
@@ -1,12 +1,5 @@
1
- import React, {
2
- Fragment,
3
- useCallback,
4
- useEffect,
5
- useMemo,
6
- useState,
7
- useRef,
8
- } from 'react';
9
- import {View, Animated, Easing, Text, ColorValue} from 'react-native';
1
+ import React, {Fragment, useCallback, useEffect, useMemo, useRef} from 'react';
2
+ import {View, Animated, Easing, Text} from 'react-native';
10
3
  import {styles} from './styles';
11
4
  import Svg, {
12
5
  Path,
@@ -18,97 +11,76 @@ import Svg, {
18
11
  } from 'react-native-svg';
19
12
  import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
20
13
  import {
21
- getAxesAndRulesProps,
22
- getExtendedContainerHeightWithPadding,
23
- } from '../utils';
24
- import {
25
- AxesAndRulesDefaults,
26
- LineDefaults,
27
- chartTypes,
28
- yAxisSides,
29
- } from '../utils/constants';
30
- import {BarAndLineChartsWrapperTypes, RuleType} from '../utils/types';
31
- import { LineChartBicolorPropsType, bicolorLineDataItem } from './types';
32
-
33
- let initialData: Array<bicolorLineDataItem> | null = null;
34
-
35
- type Points = {
36
- points: string;
37
- color: string;
38
- };
14
+ LineChartBicolorPropsType,
15
+ bicolorLineDataItem,
16
+ useLineChartBiColor,
17
+ } from 'gifted-charts-core';
39
18
 
40
19
  export const LineChartBicolor = (props: LineChartBicolorPropsType) => {
41
20
  const scrollRef = useRef();
42
- const [toggle, setToggle] = useState(false);
43
- const [pointsArray, setPointsArray] = useState<Array<Points>>([]);
44
- const [fillPointsArray, setFillPointsArray] = useState<Array<Points>>([]);
45
- const [selectedIndex, setSelectedIndex] = useState(-1);
46
- const containerHeight = props.height || AxesAndRulesDefaults.containerHeight;
47
- const noOfSections = props.noOfSections || AxesAndRulesDefaults.noOfSections;
48
- let data = useMemo(() => {
49
- if (!props.data) {
50
- return [];
51
- }
52
- if (props.yAxisOffset) {
53
- return props.data.map(item => {
54
- item.value = item.value - (props.yAxisOffset ?? 0);
55
- return item;
56
- });
57
- }
58
- return props.data;
59
- }, [props.yAxisOffset, props.data]);
60
-
61
- const scrollToEnd = props.scrollToEnd ?? LineDefaults.scrollToEnd;
62
- const scrollAnimation = props.scrollAnimation ?? LineDefaults.scrollAnimation;
63
- const scrollEventThrottle =
64
- props.scrollEventThrottle ?? LineDefaults.scrollEventThrottle;
65
-
66
21
  const opacValue = useMemo(() => new Animated.Value(0), []);
67
22
  const widthValue = useMemo(() => new Animated.Value(0), []);
68
- const labelsExtraHeight = props.labelsExtraHeight || 0;
69
-
70
- const animationDuration =
71
- props.animationDuration || LineDefaults.animationDuration;
72
-
73
- const startIndex1 = props.startIndex || 0;
74
-
75
- let endIndex1;
76
- if (props.endIndex === undefined || props.endIndex === null) {
77
- endIndex1 = data.length - 1;
78
- } else {
79
- endIndex1 = props.endIndex;
80
- }
81
-
82
- if (!initialData) {
83
- initialData = [...data];
84
- }
85
-
86
- const adjustToWidth = props.adjustToWidth || false;
87
-
88
- const initialSpacing = props.initialSpacing ?? LineDefaults.initialSpacing;
89
- const endSpacing =
90
- props.endSpacing ?? (adjustToWidth ? 0 : LineDefaults.endSpacing);
91
- const thickness = props.thickness || LineDefaults.thickness;
92
-
93
- const spacing =
94
- props.spacing ??
95
- (adjustToWidth
96
- ? ((props.width || AxesAndRulesDefaults.width) - initialSpacing) /
97
- data.length
98
- : LineDefaults.spacing);
99
23
 
100
- const xAxisThickness =
101
- props.xAxisThickness ?? AxesAndRulesDefaults.xAxisThickness;
102
- const dataPointsHeight1 =
103
- props.dataPointsHeight ?? LineDefaults.dataPointsHeight;
104
- const dataPointsWidth1 =
105
- props.dataPointsWidth ?? LineDefaults.dataPointsWidth;
106
- const dataPointsRadius1 =
107
- props.dataPointsRadius ?? LineDefaults.dataPointsRadius;
108
- const dataPointsColor1 =
109
- props.dataPointsColor ?? LineDefaults.dataPointsColor;
110
- const dataPointsShape1 =
111
- props.dataPointsShape ?? LineDefaults.dataPointsShape;
24
+ const {
25
+ pointsArray,
26
+ fillPointsArray,
27
+ selectedIndex,
28
+ setSelectedIndex,
29
+ containerHeight,
30
+ data,
31
+ labelsExtraHeight,
32
+ animationDuration,
33
+ startIndex1,
34
+ endIndex1,
35
+ initialSpacing,
36
+ thickness,
37
+ spacing,
38
+ xAxisThickness,
39
+ dataPointsHeight1,
40
+ dataPointsWidth1,
41
+ dataPointsRadius1,
42
+ dataPointsColor1,
43
+ dataPointsShape1,
44
+ areaChart,
45
+ textFontSize1,
46
+ textColor1,
47
+ totalWidth,
48
+ maxValue,
49
+ extendedContainerHeight,
50
+ getX,
51
+ getY,
52
+ stepHeight,
53
+ noOfSectionsBelowXAxis,
54
+ thickness1,
55
+ zIndex,
56
+ strokeDashArray1,
57
+ rotateLabel,
58
+ isAnimated,
59
+ hideDataPoints1,
60
+ color,
61
+ colorNegative,
62
+ startFillColor,
63
+ endFillColor,
64
+ startOpacity,
65
+ endOpacity,
66
+ startFillColorNegative,
67
+ endFillColorNegative,
68
+ startOpacityNegative,
69
+ endOpacityNegative,
70
+ gradientDirection,
71
+ xAxisTextNumberOfLines,
72
+ focusEnabled,
73
+ showDataPointOnFocus,
74
+ showStripOnFocus,
75
+ showTextOnFocus,
76
+ stripHeight,
77
+ stripWidth,
78
+ stripColor,
79
+ stripOpacity,
80
+ unFocusOnPressOut,
81
+ delayBeforeUnFocus,
82
+ barAndLineChartsWrapperProps,
83
+ } = useLineChartBiColor(props);
112
84
 
113
85
  const labelsAppear = useCallback(() => {
114
86
  opacValue.setValue(0);
@@ -135,355 +107,11 @@ export const LineChartBicolor = (props: LineChartBicolorPropsType) => {
135
107
  }).start();
136
108
  }, [animationDuration, widthValue]);
137
109
 
138
- const areaChart = props.areaChart || false;
139
- const textFontSize1 = props.textFontSize || LineDefaults.textFontSize;
140
- const textColor1 = props.textColor || LineDefaults.textColor;
141
-
142
- let totalWidth = initialSpacing;
143
- let maxItem = 0,
144
- minItem = 0;
145
- data.forEach((item: bicolorLineDataItem) => {
146
- if (item.value > maxItem) {
147
- maxItem = item.value;
148
- }
149
- if (item.value < minItem) {
150
- minItem = item.value;
151
- }
152
- totalWidth += spacing;
153
- });
154
-
155
- if (props.showFractionalValues || props.roundToDigits) {
156
- maxItem *= 10 * (props.roundToDigits || 1);
157
- maxItem = maxItem + (10 - (maxItem % 10));
158
- maxItem /= 10 * (props.roundToDigits || 1);
159
- maxItem = parseFloat(maxItem.toFixed(props.roundToDigits || 1));
160
-
161
- if (minItem !== 0) {
162
- minItem *= 10 * (props.roundToDigits || 1);
163
- minItem = minItem - (10 + (minItem % 10));
164
- minItem /= 10 * (props.roundToDigits || 1);
165
- minItem = parseFloat(minItem.toFixed(props.roundToDigits || 1));
166
- }
167
- } else {
168
- maxItem = maxItem + (10 - (maxItem % 10));
169
- if (minItem !== 0) {
170
- minItem = minItem - (10 + (minItem % 10));
171
- }
172
- }
173
-
174
- const maxValue = props.maxValue || maxItem;
175
- const mostNegativeValue = props.mostNegativeValue || minItem;
176
-
177
110
  useEffect(() => {
178
111
  decreaseWidth();
179
112
  labelsAppear();
180
113
  }, [animationDuration, decreaseWidth, labelsAppear]);
181
114
 
182
- const extendedContainerHeight = getExtendedContainerHeightWithPadding(
183
- containerHeight,
184
- props.overflowTop,
185
- );
186
-
187
- let yAtxAxis = extendedContainerHeight - xAxisThickness / 2;
188
- const getX = index => initialSpacing + spacing * index;
189
- const getY = index =>
190
- yAtxAxis - (data[index].value * containerHeight) / maxValue;
191
-
192
- useEffect(() => {
193
- let ppArray: Array<Points> = [];
194
- let pp = 'M' + initialSpacing + ' ' + getY(0),
195
- prevValuev,
196
- nextValue;
197
- for (let i = 0; i < data.length - 1; i++) {
198
- prevValuev = data[i].value;
199
- nextValue = data[i + 1].value;
200
-
201
- if (prevValuev < 0 && nextValue < 0) {
202
- pp += 'L' + getX(i) + ' ' + getY(i) + ' ';
203
- } else if (prevValuev < 0 && nextValue > 0) {
204
- pp += 'L' + getX(i) + ' ' + getY(i) + ' ';
205
- let prevX = getX(i);
206
- let prevY = getY(i);
207
- let nextX = getX(i + 1);
208
- let nextY = getY(i + 1);
209
- let slope = (nextY - prevY) / (nextX - prevX);
210
- let x = (yAtxAxis - prevY) / slope + prevX;
211
- pp += 'L' + (x - thickness / 2) + ' ' + yAtxAxis + ' ';
212
-
213
- let pointsOb = {
214
- points: pp.startsWith('L') ? pp.replace('L', 'M') : pp,
215
- color: 'red',
216
- };
217
- ppArray.push(pointsOb);
218
- setPointsArray([...ppArray]);
219
- pp = 'M' + x + ' ' + yAtxAxis + ' L' + nextX + ' ' + nextY + ' ';
220
- pointsOb = {
221
- points: pp,
222
- color: 'green',
223
- };
224
- ppArray.push(pointsOb);
225
- } else if (prevValuev > 0 && nextValue < 0) {
226
- pp += 'L' + getX(i) + ' ' + getY(i) + ' ';
227
- let prevX = getX(i);
228
- let prevY = getY(i);
229
- let nextX = getX(i + 1);
230
- let nextY = getY(i + 1);
231
- let slope = (nextY - prevY) / (nextX - prevX);
232
-
233
- let x = (yAtxAxis - prevY) / slope + prevX;
234
- pp += 'L' + (x - thickness / 2) + ' ' + yAtxAxis + ' ';
235
-
236
- let pointsOb = {
237
- points: pp.startsWith('L') ? pp.replace('L', 'M') : pp,
238
- color: 'green',
239
- };
240
- ppArray.push(pointsOb);
241
- setPointsArray([...ppArray]);
242
- pp = 'M' + x + ' ' + yAtxAxis + ' L' + nextX + ' ' + nextY + ' ';
243
- pointsOb = {
244
- points: pp,
245
- color: 'red',
246
- };
247
- ppArray.push(pointsOb);
248
- } else {
249
- pp += 'L' + getX(i) + ' ' + getY(i) + ' ';
250
- }
251
- }
252
- let i = data.length - 1;
253
- prevValuev = data[i - 1].value;
254
- nextValue = data[i].value;
255
- if (
256
- (prevValuev > 0 && nextValue > 0) ||
257
- (prevValuev < 0 && nextValue < 0)
258
- ) {
259
- pp += 'L' + getX(i) + ' ' + getY(i) + ' ';
260
- }
261
- let pointsOb = {
262
- points: pp.startsWith('L') ? pp.replace('L', 'M') : pp,
263
- color: nextValue > 0 ? 'green' : 'red',
264
- };
265
- ppArray.push(pointsOb);
266
- setPointsArray([...ppArray]);
267
-
268
- /*************************** For Area Charts *************************/
269
-
270
- let startIndex = -1,
271
- endIndex = -1,
272
- startX,
273
- startY,
274
- endY,
275
- color = 'green',
276
- localArray: Array<Points> = [],
277
- broken = false;
278
-
279
- pp = 'M' + initialSpacing + ' ' + yAtxAxis;
280
- for (i = 0; i < data.length - 1; i++) {
281
- prevValuev = data[i].value;
282
- nextValue = data[i + 1].value;
283
- pp += 'L' + getX(i) + ' ' + getY(i) + ' ';
284
- if (
285
- (prevValuev > 0 && nextValue < 0) ||
286
- (prevValuev < 0 && nextValue > 0)
287
- ) {
288
- let prevX = getX(i);
289
- let prevY = getY(i);
290
- let nextX = getX(i + 1);
291
- let nextY = getY(i + 1);
292
- let slope = (nextY - prevY) / (nextX - prevX);
293
-
294
- let x = (yAtxAxis - prevY) / slope + prevX;
295
- pp += 'L' + (x - thickness / 2) + ' ' + yAtxAxis + ' ';
296
- broken = true;
297
- break;
298
- }
299
- }
300
- if (!broken) {
301
- i = data.length - 1;
302
- pp +=
303
- 'L' +
304
- getX(i) +
305
- ' ' +
306
- getY(i) +
307
- ' L' +
308
- getX(i) +
309
- ' ' +
310
- (yAtxAxis - xAxisThickness / 2);
311
- }
312
- localArray.push({points: pp, color: data[0].value >= 0 ? 'green' : 'red'});
313
-
314
- let xs: Array<string> = [];
315
- data.forEach((item, index) => {
316
- let x = getX(index);
317
- xs.push(x + '');
318
- });
319
-
320
- pointsArray.forEach((item: any, index) => {
321
- let splitArray = item.points
322
- .split(' ')
323
- .filter(spItem => spItem && spItem !== ' ');
324
-
325
- if (
326
- splitArray[1] === yAtxAxis + '' &&
327
- !xs.includes(splitArray[0].replace('M', '').replace('L', ''))
328
- ) {
329
- startIndex = index;
330
- startX = splitArray[0].replace('M', '').replace('L', '');
331
- if (splitArray.length > 3) {
332
- startY = splitArray[1].replace('M', '').replace('L', '');
333
- endY = splitArray[3].replace('M', '').replace('L', '');
334
- if (Number(startY) < Number(endY)) {
335
- color = 'red';
336
- } else {
337
- color = 'green';
338
- }
339
- }
340
- }
341
- if (
342
- splitArray[splitArray.length - 1] === yAtxAxis + '' &&
343
- !xs.includes(
344
- splitArray[splitArray.length - 2].replace('M', '').replace('L', ''),
345
- )
346
- ) {
347
- endIndex = index;
348
- }
349
- if (startX) {
350
- let filPts = '';
351
- for (let j = startIndex; j <= endIndex; j++) {
352
- if (pointsArray[j]) {
353
- filPts += pointsArray[j].points.replaceAll('M', 'L');
354
- }
355
- }
356
- filPts += 'L ' + startX + ' ' + yAtxAxis;
357
- localArray.push({points: filPts.replace('L', 'M'), color});
358
- }
359
- });
360
- if (broken) {
361
- pp = 'M' + getX(data.length - 1) + ' ' + yAtxAxis;
362
- for (let i = data.length - 1; i > 0; i--) {
363
- prevValuev = data[i].value;
364
- nextValue = data[i - 1].value;
365
- pp += 'L' + getX(i) + ' ' + getY(i) + ' ';
366
- if (
367
- (prevValuev > 0 && nextValue < 0) ||
368
- (prevValuev < 0 && nextValue > 0)
369
- ) {
370
- let prevX = getX(i);
371
- let prevY = getY(i);
372
- let nextX = getX(i - 1);
373
- let nextY = getY(i - 1);
374
- let slope = (nextY - prevY) / (nextX - prevX);
375
-
376
- let x = (yAtxAxis - prevY) / slope + prevX;
377
- pp += 'L' + x + ' ' + yAtxAxis + ' ';
378
- break;
379
- }
380
- }
381
-
382
- localArray.push({
383
- points: pp,
384
- color: data[data.length - 1].value > 0 ? 'green' : 'red',
385
- });
386
- }
387
-
388
- setFillPointsArray([...localArray]);
389
- setToggle(true);
390
- }, [
391
- areaChart,
392
- containerHeight,
393
- data,
394
- dataPointsWidth1,
395
- initialSpacing,
396
- spacing,
397
- xAxisThickness,
398
- toggle,
399
- maxValue,
400
- ]);
401
-
402
- const horizSections = [{value: '0'}];
403
- const stepHeight = props.stepHeight || containerHeight / noOfSections;
404
- const stepValue = props.stepValue || maxValue / noOfSections;
405
- const noOfSectionsBelowXAxis =
406
- props.noOfSectionsBelowXAxis || -mostNegativeValue / stepValue;
407
- const thickness1 = props.thickness || LineDefaults.thickness;
408
- const zIndex = props.zIndex || 0;
409
-
410
- const strokeDashArray1 = props.strokeDashArray;
411
-
412
- const rotateLabel = props.rotateLabel ?? AxesAndRulesDefaults.rotateLabel;
413
- const isAnimated = props.isAnimated ?? LineDefaults.isAnimated;
414
- const hideDataPoints1 = props.hideDataPoints ?? LineDefaults.hideDataPoints;
415
-
416
- const color = props.color || 'green';
417
- const colorNegative = props.colorNegative || 'red';
418
-
419
- const startFillColor = props.startFillColor || 'lightgreen';
420
- const endFillColor = props.endFillColor || 'white';
421
- const startOpacity = props.startOpacity ?? LineDefaults.startOpacity;
422
- const endOpacity = props.endOpacity ?? LineDefaults.endOpacity;
423
- const startFillColorNegative = props.startFillColorNegative || 'pink';
424
- const endFillColorNegative = props.endFillColorNegative || 'white';
425
- const startOpacityNegative =
426
- props.startOpacityNegative ?? LineDefaults.startOpacity;
427
- const endOpacityNegative =
428
- props.endOpacityNegative ?? LineDefaults.endOpacity;
429
-
430
- const gradientDirection = props.gradientDirection || 'vertical';
431
-
432
- const showXAxisIndices =
433
- props.showXAxisIndices ?? AxesAndRulesDefaults.showXAxisIndices;
434
- const xAxisIndicesHeight =
435
- props.xAxisIndicesHeight ?? AxesAndRulesDefaults.xAxisIndicesHeight;
436
- const xAxisIndicesWidth =
437
- props.xAxisIndicesWidth ?? AxesAndRulesDefaults.xAxisIndicesWidth;
438
- const xAxisIndicesColor =
439
- props.xAxisIndicesColor ?? AxesAndRulesDefaults.xAxisIndicesColor;
440
-
441
- const xAxisTextNumberOfLines =
442
- props.xAxisTextNumberOfLines ?? AxesAndRulesDefaults.xAxisTextNumberOfLines;
443
- const horizontalRulesStyle = props.horizontalRulesStyle;
444
- const showFractionalValues =
445
- props.showFractionalValues ?? AxesAndRulesDefaults.showFractionalValues;
446
- const yAxisLabelWidth =
447
- props.yAxisLabelWidth ??
448
- (props.hideYAxisText
449
- ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
450
- : AxesAndRulesDefaults.yAxisLabelWidth);
451
-
452
- const horizontal = false;
453
- const yAxisAtTop = false;
454
-
455
- const disableScroll = props.disableScroll ?? LineDefaults.disableScroll;
456
- const showScrollIndicator =
457
- props.showScrollIndicator || LineDefaults.showScrollIndicator;
458
-
459
- const focusEnabled = props.focusEnabled ?? LineDefaults.focusEnabled;
460
- const showDataPointOnFocus =
461
- props.showDataPointOnFocus ?? LineDefaults.showDataPointOnFocus;
462
- const showStripOnFocus =
463
- props.showStripOnFocus ?? LineDefaults.showStripOnFocus;
464
- const showTextOnFocus = props.showTextOnFocus ?? LineDefaults.showTextOnFocus;
465
- const stripHeight = props.stripHeight;
466
- const stripWidth = props.stripWidth ?? LineDefaults.stripWidth;
467
- const stripColor = props.stripColor ?? color;
468
- const stripOpacity = props.stripOpacity ?? (startOpacity + endOpacity) / 2;
469
- const unFocusOnPressOut =
470
- props.unFocusOnPressOut ?? LineDefaults.unFocusOnPressOut;
471
- const delayBeforeUnFocus =
472
- props.delayBeforeUnFocus ?? LineDefaults.delayBeforeUnFocus;
473
-
474
- horizSections.pop();
475
- for (let i = 0; i <= noOfSections; i++) {
476
- let value = maxValue - stepValue * i;
477
- if (props.showFractionalValues || props.roundToDigits) {
478
- value = parseFloat(value.toFixed(props.roundToDigits || 1));
479
- }
480
- horizSections.push({
481
- value: props.yAxisLabelTexts
482
- ? props.yAxisLabelTexts[noOfSections - i] ?? value.toString()
483
- : value.toString(),
484
- });
485
- }
486
-
487
115
  const renderLabel = (
488
116
  index: number,
489
117
  label: String,
@@ -731,8 +359,8 @@ export const LineChartBicolor = (props: LineChartBicolorPropsType) => {
731
359
  item.onPress
732
360
  ? item.onPress(item, index)
733
361
  : props.onPress
734
- ? props.onPress(item, index)
735
- : null;
362
+ ? props.onPress(item, index)
363
+ : null;
736
364
  }}
737
365
  />
738
366
  )}
@@ -755,8 +383,8 @@ export const LineChartBicolor = (props: LineChartBicolorPropsType) => {
755
383
  item.onPress
756
384
  ? item.onPress(item, index)
757
385
  : props.onPress
758
- ? props.onPress(item, index)
759
- : null;
386
+ ? props.onPress(item, index)
387
+ : null;
760
388
  }}
761
389
  />
762
390
  )}
@@ -782,8 +410,8 @@ export const LineChartBicolor = (props: LineChartBicolorPropsType) => {
782
410
  (item.dataPointLabelWidth
783
411
  ? item.dataPointLabelWidth + 20
784
412
  : props.dataPointLabelWidth
785
- ? props.dataPointLabelWidth + 20
786
- : 50) /
413
+ ? props.dataPointLabelWidth + 20
414
+ : 50) /
787
415
  2 +
788
416
  spacing * index,
789
417
  },
@@ -1098,76 +726,12 @@ export const LineChartBicolor = (props: LineChartBicolorPropsType) => {
1098
726
  );
1099
727
  };
1100
728
 
1101
- const barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes = {
1102
- chartType: chartTypes.LINE_BI_COLOR,
1103
- containerHeight,
1104
- noOfSectionsBelowXAxis,
1105
- stepHeight,
1106
- labelsExtraHeight,
1107
- yAxisLabelWidth,
1108
- horizontal,
1109
- rtl: false,
1110
- shiftX: 0,
1111
- shiftY: 0,
1112
- scrollRef,
1113
- yAxisAtTop,
1114
- initialSpacing,
1115
- data,
1116
- stackData: undefined, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1117
- secondaryData: [],
1118
- barWidth: 0, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1119
- xAxisThickness,
1120
- totalWidth,
1121
- disableScroll,
1122
- showScrollIndicator,
1123
- scrollToEnd,
1124
- scrollToIndex: props.scrollToIndex,
1125
- scrollAnimation,
1126
- scrollEventThrottle,
1127
- indicatorColor: props.indicatorColor,
1128
- setSelectedIndex,
1129
- spacing,
1130
- showLine: false,
1131
- lineConfig: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1132
- lineConfig2: null, // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1133
- maxValue,
1134
- lineData: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1135
- lineData2: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1136
- animatedWidth,
1137
- lineBehindBars: false,
1138
- points: pointsArray,
1139
- points2: '', // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1140
- arrowPoints: [], // Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1141
- renderChartContent,
1142
- remainingScrollViewProps: {},
1143
-
1144
- //horizSectionProps-
1145
- width: props.width,
1146
- horizSections,
1147
- endSpacing,
1148
- horizontalRulesStyle,
1149
- noOfSections,
1150
- showFractionalValues,
1151
-
1152
- axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
1153
-
1154
- yAxisLabelTexts: props.yAxisLabelTexts,
1155
- yAxisOffset: props.yAxisOffset,
1156
- rotateYAxisTexts: 0,
1157
- hideAxesAndRules: props.hideAxesAndRules,
1158
-
1159
- showXAxisIndices,
1160
- xAxisIndicesHeight,
1161
- xAxisIndicesWidth,
1162
- xAxisIndicesColor,
1163
-
1164
- // These are Not needed but passing this prop to maintain consistency (between LineChart and BarChart props)
1165
- pointerConfig: null,
1166
- getPointerProps: null,
1167
- pointerIndex: 0,
1168
- pointerX: 0,
1169
- pointerY: 0,
1170
- };
1171
-
1172
- return <BarAndLineChartsWrapper {...barAndLineChartsWrapperProps} />;
729
+ return (
730
+ <BarAndLineChartsWrapper
731
+ {...barAndLineChartsWrapperProps}
732
+ scrollRef={scrollRef}
733
+ animatedWidth={animatedWidth}
734
+ renderChartContent={renderChartContent}
735
+ />
736
+ );
1173
737
  };