react-native-gifted-charts 1.4.10 → 1.4.12

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 (61) hide show
  1. package/README.md +2 -2
  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/common/LinearGradient.js +1 -0
  19. package/dist/Components/common/Pointer.js +1 -0
  20. package/dist/Components/common/StripAndLabel.js +1 -0
  21. package/dist/Components/lineSvg.js +1 -0
  22. package/dist/LineChart/LineChartBicolor.js +1 -0
  23. package/dist/LineChart/index.js +1 -0
  24. package/dist/LineChart/styles.js +1 -0
  25. package/dist/PieChart/index.js +1 -0
  26. package/dist/PieChart/main.js +1 -0
  27. package/dist/PieChartPro/index.js +1 -0
  28. package/dist/PopulationPyramid/index.js +1 -0
  29. package/dist/index.js +1 -0
  30. package/dist/utils/index.js +1 -0
  31. package/package.json +10 -5
  32. package/src/BarChart/Animated2DWithGradient.tsx +0 -197
  33. package/src/BarChart/RenderBars.tsx +0 -454
  34. package/src/BarChart/RenderStackBars.tsx +0 -383
  35. package/src/BarChart/index.tsx +0 -373
  36. package/src/BarChart/styles.tsx +0 -47
  37. package/src/Components/AnimatedThreeDBar/index.tsx +0 -258
  38. package/src/Components/AnimatedThreeDBar/styles.tsx +0 -14
  39. package/src/Components/BarAndLineChartsWrapper/index.tsx +0 -244
  40. package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +0 -590
  41. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +0 -147
  42. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +0 -157
  43. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +0 -86
  44. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +0 -42
  45. package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +0 -131
  46. package/src/Components/BarSpecificComponents/barBackgroundPattern.tsx +0 -30
  47. package/src/Components/BarSpecificComponents/cap.tsx +0 -34
  48. package/src/Components/common/LinearGradient.tsx +0 -27
  49. package/src/Components/common/Pointer.tsx +0 -37
  50. package/src/Components/common/StripAndLabel.tsx +0 -98
  51. package/src/Components/lineSvg.tsx +0 -42
  52. package/src/LineChart/LineChartBicolor.tsx +0 -739
  53. package/src/LineChart/index.tsx +0 -2077
  54. package/src/LineChart/styles.tsx +0 -47
  55. package/src/PieChart/index.tsx +0 -165
  56. package/src/PieChart/main.tsx +0 -363
  57. package/src/PieChartPro/index.tsx +0 -267
  58. package/src/PopulationPyramid/index.tsx +0 -603
  59. package/src/index.tsx +0 -25
  60. package/src/todos.md +0 -23
  61. package/src/utils/index.ts +0 -16
@@ -1,739 +0,0 @@
1
- import React, {Fragment, useCallback, useEffect, useMemo, useRef} from 'react';
2
- import {View, Animated, Easing, Text} from 'react-native';
3
- import {styles} from './styles';
4
- import Svg, {
5
- Path,
6
- LinearGradient,
7
- Stop,
8
- Circle,
9
- Rect,
10
- Text as CanvasText,
11
- } from 'react-native-svg';
12
- import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
13
- import {
14
- LineChartBicolorPropsType,
15
- bicolorLineDataItem,
16
- useLineChartBiColor,
17
- } from 'gifted-charts-core';
18
-
19
- export const LineChartBicolor = (props: LineChartBicolorPropsType) => {
20
- const scrollRef = useRef();
21
- // const heightValue = useMemo(() => new Animated.Value(0), []);
22
- const widthValue = useMemo(() => new Animated.Value(0), []);
23
- const opacValue = useMemo(() => new Animated.Value(0), []);
24
-
25
- const {
26
- pointsArray,
27
- fillPointsArray,
28
- selectedIndex,
29
- setSelectedIndex,
30
- containerHeight,
31
- data,
32
- labelsExtraHeight,
33
- animationDuration,
34
- startIndex1,
35
- endIndex1,
36
- initialSpacing,
37
- thickness,
38
- spacing,
39
- xAxisThickness,
40
- dataPointsHeight1,
41
- dataPointsWidth1,
42
- dataPointsRadius1,
43
- dataPointsColor1,
44
- dataPointsShape1,
45
- areaChart,
46
- textFontSize1,
47
- textColor1,
48
- totalWidth,
49
- maxValue,
50
- extendedContainerHeight,
51
- getX,
52
- getY,
53
- stepHeight,
54
- noOfSectionsBelowXAxis,
55
- thickness1,
56
- zIndex,
57
- strokeDashArray1,
58
- rotateLabel,
59
- isAnimated,
60
- hideDataPoints1,
61
- color,
62
- colorNegative,
63
- startFillColor,
64
- endFillColor,
65
- startOpacity,
66
- endOpacity,
67
- startFillColorNegative,
68
- endFillColorNegative,
69
- startOpacityNegative,
70
- endOpacityNegative,
71
- gradientDirection,
72
- xAxisTextNumberOfLines,
73
- focusEnabled,
74
- showDataPointOnFocus,
75
- showStripOnFocus,
76
- showTextOnFocus,
77
- stripHeight,
78
- stripWidth,
79
- stripColor,
80
- stripOpacity,
81
- unFocusOnPressOut,
82
- delayBeforeUnFocus,
83
- barAndLineChartsWrapperProps,
84
- } = useLineChartBiColor(props);
85
-
86
- const labelsAppear = useCallback(() => {
87
- opacValue.setValue(0);
88
- Animated.timing(opacValue, {
89
- toValue: 1,
90
- duration: 500,
91
- easing: Easing.ease,
92
- useNativeDriver: false,
93
- }).start();
94
- }, [opacValue]);
95
-
96
- const appearingOpacity = opacValue.interpolate({
97
- inputRange: [0, 1],
98
- outputRange: [0, 1],
99
- });
100
-
101
- const decreaseWidth = useCallback(() => {
102
- widthValue.setValue(0);
103
- Animated.timing(widthValue, {
104
- toValue: 1,
105
- duration: animationDuration,
106
- easing: Easing.linear,
107
- useNativeDriver: false,
108
- }).start();
109
- }, [animationDuration, widthValue]);
110
-
111
- useEffect(() => {
112
- decreaseWidth();
113
- labelsAppear();
114
- }, [animationDuration, decreaseWidth, labelsAppear]);
115
-
116
- const renderLabel = (
117
- index: number,
118
- label: String,
119
- labelTextStyle: any,
120
- labelComponent?: Function,
121
- ) => {
122
- return (
123
- <View
124
- style={[
125
- {
126
- position: 'absolute',
127
- bottom: 30,
128
- zIndex: 10,
129
- width: spacing + labelsExtraHeight,
130
- left:
131
- index === 0 && initialSpacing < 10
132
- ? getX(index) - spacing / 2 + 8
133
- : getX(index) - spacing / 2,
134
- justifyContent: 'center',
135
- },
136
- rotateLabel && {transform: [{rotate: '60deg'}]},
137
- ]}>
138
- {labelComponent ? (
139
- labelComponent()
140
- ) : (
141
- <Text
142
- style={labelTextStyle || {textAlign: 'center'}}
143
- numberOfLines={xAxisTextNumberOfLines}>
144
- {label || ''}
145
- </Text>
146
- )}
147
- </View>
148
- );
149
- };
150
-
151
- const renderAnimatedLabel = (
152
- index: number,
153
- label: String,
154
- labelTextStyle: any,
155
- labelComponent?: Function,
156
- ) => {
157
- return (
158
- <Animated.View
159
- style={[
160
- {
161
- height: rotateLabel ? 40 : 20,
162
- // backgroundColor: 'yellow',
163
- position: 'absolute',
164
- bottom: rotateLabel ? 10 : 30,
165
- zIndex: 10,
166
- width: spacing,
167
- left:
168
- index === 0 && initialSpacing < 10
169
- ? getX(index) - spacing / 2 + 8
170
- : getX(index) - spacing / 2,
171
- opacity: appearingOpacity,
172
- },
173
- rotateLabel && {transform: [{rotate: '60deg'}]},
174
- ]}>
175
- {labelComponent ? (
176
- labelComponent()
177
- ) : (
178
- <Text
179
- style={labelTextStyle || {textAlign: 'center'}}
180
- numberOfLines={xAxisTextNumberOfLines}>
181
- {label || ''}
182
- </Text>
183
- )}
184
- </Animated.View>
185
- );
186
- };
187
-
188
- const animatedWidth = widthValue.interpolate({
189
- inputRange: [0, 1],
190
- outputRange: [0, totalWidth],
191
- });
192
-
193
- const onStripPress = (item, index) => {
194
- setSelectedIndex(index);
195
- if (props.onFocus) {
196
- props.onFocus(item, index);
197
- }
198
- };
199
-
200
- const renderDataPoints = (
201
- dataForRender,
202
- dataPtsShape,
203
- dataPtsWidth,
204
- dataPtsHeight,
205
- dataPtsColor,
206
- dataPtsRadius,
207
- textColor,
208
- textFontSize,
209
- startIndex,
210
- endIndex,
211
- ) => {
212
- return dataForRender.map((item: bicolorLineDataItem, index: number) => {
213
- if (index < startIndex || index > endIndex) return null;
214
- if (item.hideDataPoint) {
215
- return null;
216
- }
217
- let dataPointsShape,
218
- dataPointsWidth,
219
- dataPointsHeight,
220
- dataPointsColor,
221
- dataPointsRadius,
222
- text,
223
- customDataPoint,
224
- dataPointLabelComponent;
225
- if (index === selectedIndex) {
226
- dataPointsShape =
227
- item.focusedDataPointShape ||
228
- props.focusedDataPointShape ||
229
- item.dataPointShape ||
230
- dataPtsShape;
231
- dataPointsWidth =
232
- item.focusedDataPointWidth ||
233
- props.focusedDataPointWidth ||
234
- item.dataPointWidth ||
235
- dataPtsWidth;
236
- dataPointsHeight =
237
- item.focusedDataPointHeight ||
238
- props.focusedDataPointHeight ||
239
- item.dataPointHeight ||
240
- dataPtsHeight;
241
- dataPointsColor =
242
- item.focusedDataPointColor || props.focusedDataPointColor || 'orange';
243
- dataPointsRadius =
244
- item.focusedDataPointRadius ||
245
- props.focusedDataPointRadius ||
246
- item.dataPointRadius ||
247
- dataPtsRadius;
248
- if (showTextOnFocus) {
249
- text = item.dataPointText;
250
- }
251
- customDataPoint =
252
- item.focusedCustomDataPoint ||
253
- props.focusedCustomDataPoint ||
254
- item.customDataPoint ||
255
- props.customDataPoint;
256
- dataPointLabelComponent =
257
- item.focusedDataPointLabelComponent || item.dataPointLabelComponent;
258
- } else {
259
- dataPointsShape = item.dataPointShape || dataPtsShape;
260
- dataPointsWidth = item.dataPointWidth || dataPtsWidth;
261
- dataPointsHeight = item.dataPointHeight || dataPtsHeight;
262
- dataPointsColor = item.dataPointColor || dataPtsColor;
263
- dataPointsRadius = item.dataPointRadius || dataPtsRadius;
264
- if (showTextOnFocus) {
265
- text = '';
266
- }
267
- customDataPoint = item.customDataPoint || props.customDataPoint;
268
- dataPointLabelComponent = item.dataPointLabelComponent;
269
- }
270
-
271
- const currentStripHeight = item.stripHeight ?? stripHeight;
272
- const currentStripWidth = item.stripWidth ?? stripWidth;
273
- const currentStripOpacity = item.stripOpacity ?? stripOpacity;
274
- const currentStripColor = item.stripColor || stripColor;
275
-
276
- return (
277
- <Fragment key={index}>
278
- {focusEnabled ? (
279
- <>
280
- {unFocusOnPressOut ? (
281
- <Rect
282
- onPressIn={() => onStripPress(item, index)}
283
- onPressOut={() =>
284
- setTimeout(() => setSelectedIndex(-1), delayBeforeUnFocus)
285
- }
286
- x={initialSpacing + (spacing * index - spacing / 2)}
287
- y={8}
288
- width={spacing}
289
- height={containerHeight}
290
- fill={'none'}
291
- />
292
- ) : (
293
- <Rect
294
- onPress={() => onStripPress(item, index)}
295
- x={initialSpacing + (spacing * index - spacing / 2)}
296
- y={8}
297
- width={spacing}
298
- height={containerHeight}
299
- fill={'none'}
300
- />
301
- )}
302
- </>
303
- ) : null}
304
- {item.showStrip ||
305
- (focusEnabled && index === selectedIndex && showStripOnFocus) ? (
306
- <Rect
307
- x={initialSpacing + (spacing * index - dataPointsWidth / 2)}
308
- y={
309
- currentStripHeight
310
- ? containerHeight - currentStripHeight + 8
311
- : containerHeight -
312
- dataPointsHeight / 2 +
313
- 20 -
314
- (item.value * containerHeight) / maxValue
315
- }
316
- width={currentStripWidth}
317
- height={
318
- currentStripHeight ||
319
- containerHeight - dataPointsHeight / 2 + 20
320
- }
321
- opacity={currentStripOpacity}
322
- fill={currentStripColor}
323
- />
324
- ) : null}
325
- {customDataPoint ? (
326
- <View
327
- style={[
328
- styles.customDataPointContainer,
329
- {
330
- height: dataPointsHeight,
331
- width: dataPointsWidth,
332
- top:
333
- containerHeight - (item.value * containerHeight) / maxValue,
334
- left: getX(index) - dataPointsWidth,
335
- },
336
- ]}>
337
- {customDataPoint()}
338
- </View>
339
- ) : null}
340
- {dataPointsShape === 'rectangular' ? (
341
- <Fragment key={index}>
342
- {customDataPoint ? null : (
343
- <Rect
344
- x={getX(index) - dataPointsWidth}
345
- y={
346
- extendedContainerHeight +
347
- dataPointsHeight / 2 -
348
- (item.value * containerHeight) / maxValue
349
- }
350
- width={dataPointsWidth}
351
- height={dataPointsHeight}
352
- fill={
353
- showDataPointOnFocus
354
- ? index === selectedIndex
355
- ? dataPointsColor
356
- : 'none'
357
- : dataPointsColor
358
- }
359
- onPress={() => {
360
- item.onPress
361
- ? item.onPress(item, index)
362
- : props.onPress
363
- ? props.onPress(item, index)
364
- : null;
365
- }}
366
- />
367
- )}
368
- </Fragment>
369
- ) : (
370
- <Fragment key={index}>
371
- {customDataPoint ? null : (
372
- <Circle
373
- cx={getX(index)}
374
- cy={getY(index)}
375
- r={dataPointsRadius}
376
- fill={
377
- showDataPointOnFocus
378
- ? index === selectedIndex
379
- ? dataPointsColor
380
- : 'none'
381
- : dataPointsColor
382
- }
383
- onPress={() => {
384
- item.onPress
385
- ? item.onPress(item, index)
386
- : props.onPress
387
- ? props.onPress(item, index)
388
- : null;
389
- }}
390
- />
391
- )}
392
- </Fragment>
393
- )}
394
- {dataPointLabelComponent ? (
395
- !showTextOnFocus || index === selectedIndex ? (
396
- <View
397
- style={[
398
- styles.customDataPointContainer,
399
- {
400
- top:
401
- containerHeight +
402
- (item.dataPointLabelShiftY ||
403
- props.dataPointLabelShiftY ||
404
- 0) -
405
- (item.value * containerHeight) / maxValue,
406
- left:
407
- initialSpacing +
408
- (item.dataPointLabelShiftX ||
409
- props.dataPointLabelShiftX ||
410
- 0) -
411
- (item.dataPointLabelWidth
412
- ? item.dataPointLabelWidth + 20
413
- : props.dataPointLabelWidth
414
- ? props.dataPointLabelWidth + 20
415
- : 50) /
416
- 2 +
417
- spacing * index,
418
- },
419
- ]}>
420
- {dataPointLabelComponent()}
421
- </View>
422
- ) : null
423
- ) : text || item.dataPointText ? (
424
- !showTextOnFocus || index === selectedIndex ? (
425
- <CanvasText
426
- fill={item.textColor || textColor}
427
- fontSize={item.textFontSize || textFontSize}
428
- x={
429
- initialSpacing -
430
- dataPointsWidth +
431
- spacing * index +
432
- (item.textShiftX || props.textShiftX || 0)
433
- }
434
- y={
435
- extendedContainerHeight -
436
- dataPointsHeight / 2 -
437
- (item.value * containerHeight) / maxValue +
438
- (item.textShiftY || props.textShiftY || 0)
439
- }>
440
- {!showTextOnFocus ? item.dataPointText : text}
441
- </CanvasText>
442
- ) : null
443
- ) : null}
444
- </Fragment>
445
- );
446
- });
447
- };
448
-
449
- const renderSpecificVerticalLines = (dataForRender: any) => {
450
- return dataForRender.map((item: bicolorLineDataItem, index: number) => {
451
- if (item.showVerticalLine) {
452
- return (
453
- <Rect
454
- key={index}
455
- x={
456
- initialSpacing -
457
- (item.verticalLineThickness || 1) / 2 -
458
- 1 +
459
- spacing * index
460
- }
461
- y={
462
- item.verticalLineUptoDataPoint
463
- ? containerHeight -
464
- (item.value * containerHeight) / maxValue +
465
- 10
466
- : -xAxisThickness
467
- }
468
- width={item.verticalLineThickness || 1}
469
- height={
470
- item.verticalLineUptoDataPoint
471
- ? (item.value * containerHeight) / maxValue - xAxisThickness
472
- : containerHeight + 10 - xAxisThickness
473
- }
474
- fill={item.verticalLineColor || 'lightgray'}
475
- />
476
- );
477
- }
478
- return null;
479
- });
480
- };
481
-
482
- const lineSvgComponent = (
483
- pointsArray: any,
484
- currentLineThickness: number | undefined,
485
- color: string,
486
- startFillColor: string,
487
- endFillColor: string,
488
- startOpacity: number,
489
- endOpacity: number,
490
- strokeDashArray: Array<number> | undefined | null,
491
- ) => {
492
- return (
493
- <Svg>
494
- {strokeDashArray &&
495
- strokeDashArray.length === 2 &&
496
- typeof strokeDashArray[0] === 'number' &&
497
- typeof strokeDashArray[1] === 'number'
498
- ? pointsArray.map((points, index) => (
499
- <Path
500
- key={index}
501
- d={points.points}
502
- fill="none"
503
- stroke={points.color === 'green' ? color : colorNegative}
504
- strokeWidth={currentLineThickness || thickness}
505
- strokeDasharray={strokeDashArray}
506
- />
507
- ))
508
- : pointsArray.map((points, index) => {
509
- return (
510
- <Path
511
- key={index}
512
- d={points.points}
513
- fill="none"
514
- stroke={points.color === 'green' ? color : colorNegative}
515
- strokeWidth={currentLineThickness || thickness}
516
- />
517
- );
518
- })}
519
-
520
- {/*********************** For Area Chart ************/}
521
-
522
- {areaChart && (
523
- <>
524
- <LinearGradient
525
- id="Gradient"
526
- x1="0"
527
- y1="0"
528
- x2={gradientDirection === 'horizontal' ? '1' : '0'}
529
- y2={gradientDirection === 'vertical' ? '1' : '0'}>
530
- <Stop
531
- offset="0"
532
- stopColor={startFillColor}
533
- stopOpacity={startOpacity.toString()}
534
- />
535
- <Stop
536
- offset="1"
537
- stopColor={endFillColor}
538
- stopOpacity={endOpacity.toString()}
539
- />
540
- </LinearGradient>
541
- <LinearGradient
542
- id="GradientNegative"
543
- x1="0"
544
- y1="0"
545
- x2={gradientDirection === 'horizontal' ? '1' : '0'}
546
- y2={gradientDirection === 'vertical' ? '1' : '0'}>
547
- <Stop
548
- offset="1"
549
- stopColor={startFillColorNegative}
550
- stopOpacity={startOpacityNegative.toString()}
551
- />
552
- <Stop
553
- offset="0"
554
- stopColor={endFillColorNegative}
555
- stopOpacity={endOpacityNegative.toString()}
556
- />
557
- </LinearGradient>
558
- </>
559
- )}
560
- {areaChart
561
- ? fillPointsArray.map((item, index) => {
562
- return (
563
- <Path
564
- key={index}
565
- d={item.points}
566
- fill={
567
- item.color === 'green'
568
- ? 'url(#Gradient)'
569
- : 'url(#GradientNegative)'
570
- }
571
- stroke={'transparent'}
572
- strokeWidth={currentLineThickness || thickness}
573
- />
574
- );
575
- })
576
- : null}
577
-
578
- {/******************************************************************/}
579
-
580
- {renderSpecificVerticalLines(data)}
581
-
582
- {/*** !!! Here it's done thrice intentionally, trying to make it to only 1 breaks things !!! ***/}
583
- {!hideDataPoints1
584
- ? renderDataPoints(
585
- data,
586
- dataPointsShape1,
587
- dataPointsWidth1,
588
- dataPointsHeight1,
589
- dataPointsColor1,
590
- dataPointsRadius1,
591
- textColor1,
592
- textFontSize1,
593
- startIndex1,
594
- endIndex1,
595
- )
596
- : null}
597
- </Svg>
598
- );
599
- };
600
-
601
- const renderLine = (
602
- zIndex: number,
603
- pointsArray: any,
604
- currentLineThickness: number | undefined,
605
- color: string,
606
- startFillColor: string,
607
- endFillColor: string,
608
- startOpacity: number,
609
- endOpacity: number,
610
- strokeDashArray: Array<number> | undefined | null,
611
- ) => {
612
- return (
613
- <View
614
- style={{
615
- position: 'absolute',
616
- height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
617
- bottom: 60 + labelsExtraHeight,
618
- width: totalWidth,
619
- zIndex: zIndex,
620
- }}>
621
- {pointsArray.length
622
- ? lineSvgComponent(
623
- pointsArray,
624
- currentLineThickness,
625
- color,
626
- startFillColor,
627
- endFillColor,
628
- startOpacity,
629
- endOpacity,
630
- strokeDashArray,
631
- )
632
- : null}
633
- </View>
634
- );
635
- };
636
-
637
- const renderAnimatedLine = (
638
- zIndex: number,
639
- points: any,
640
- animatedWidth: any,
641
- currentLineThickness: number | undefined,
642
- color: string,
643
- startFillColor: string,
644
- endFillColor: string,
645
- startOpacity: number,
646
- endOpacity: number,
647
- strokeDashArray: Array<number> | undefined | null,
648
- ) => {
649
- return (
650
- <Animated.View
651
- style={{
652
- position: 'absolute',
653
- height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
654
- bottom: 60, //stepHeight * -0.5 + xAxisThickness,
655
- width: animatedWidth,
656
- zIndex: zIndex,
657
- // backgroundColor: 'wheat',
658
- }}>
659
- {lineSvgComponent(
660
- points,
661
- currentLineThickness,
662
- color,
663
- startFillColor,
664
- endFillColor,
665
- startOpacity,
666
- endOpacity,
667
- strokeDashArray,
668
- )}
669
- </Animated.View>
670
- );
671
- };
672
-
673
- const renderChartContent = () => {
674
- return (
675
- <>
676
- {isAnimated
677
- ? renderAnimatedLine(
678
- zIndex,
679
- pointsArray,
680
- animatedWidth,
681
- thickness1,
682
- color,
683
- startFillColor,
684
- endFillColor,
685
- startOpacity,
686
- endOpacity,
687
- strokeDashArray1,
688
- )
689
- : renderLine(
690
- zIndex,
691
- pointsArray,
692
- thickness1,
693
- color,
694
- startFillColor,
695
- endFillColor,
696
- startOpacity,
697
- endOpacity,
698
- strokeDashArray1,
699
- )}
700
- {data.map((item: bicolorLineDataItem, index: number) => {
701
- return (
702
- <View key={index}>
703
- {isAnimated
704
- ? renderAnimatedLabel(
705
- index,
706
- item.label ||
707
- (props.xAxisLabelTexts && props.xAxisLabelTexts[index]
708
- ? props.xAxisLabelTexts[index]
709
- : ''),
710
- item.labelTextStyle || props.xAxisLabelTextStyle,
711
- item.labelComponent,
712
- )
713
- : renderLabel(
714
- index,
715
- item.label ||
716
- (props.xAxisLabelTexts && props.xAxisLabelTexts[index]
717
- ? props.xAxisLabelTexts[index]
718
- : ''),
719
- item.labelTextStyle || props.xAxisLabelTextStyle,
720
- item.labelComponent,
721
- )}
722
- {/* {renderLabel(index, item.label, item.labelTextStyle)} */}
723
- </View>
724
- );
725
- })}
726
- </>
727
- );
728
- };
729
-
730
- return (
731
- <BarAndLineChartsWrapper
732
- {...barAndLineChartsWrapperProps}
733
- scrollRef={scrollRef}
734
- animatedWidth={animatedWidth}
735
- renderChartContent={renderChartContent}
736
- remainingScrollViewProps={{onScroll: (ev: any) => props.onScroll?.(ev)}}
737
- />
738
- );
739
- };