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,373 +0,0 @@
1
- import React, {useCallback, useEffect, useMemo, useRef} from 'react';
2
- import {Animated, Easing, View} from 'react-native';
3
- import RenderBars from './RenderBars';
4
- import RenderStackBars from './RenderStackBars';
5
- import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
6
- import {BarChartPropsType, useBarChart} from 'gifted-charts-core';
7
- import {StripAndLabel} from '../Components/common/StripAndLabel';
8
- import {Pointer} from '../Components/common/Pointer';
9
- import {screenWidth} from '../utils';
10
-
11
- export const BarChart = (props: BarChartPropsType) => {
12
- const heightValue = useMemo(() => new Animated.Value(0), []);
13
- const opacValue = useMemo(() => new Animated.Value(0), []);
14
- const widthValue = useMemo(() => new Animated.Value(0), []);
15
-
16
- const scrollRef = props.scrollRef ?? useRef(null);
17
- const remainingScrollViewProps = {
18
- onScroll: (ev: any) => props.onScroll?.(ev),
19
- onTouchStart: evt => {
20
- if (props.renderTooltip) {
21
- setSelectedIndex(-1);
22
- }
23
- },
24
- };
25
-
26
- const {
27
- lineConfig,
28
- hidePointer1,
29
- pointerItem,
30
- pointerY,
31
- pointerConfig,
32
- pointerColor,
33
- pointerX,
34
- pointerComponent,
35
- pointerHeight,
36
- pointerRadius,
37
- pointerWidth,
38
- autoAdjustPointerLabelPosition,
39
- pointerLabelWidth,
40
- activatePointersOnLongPress,
41
- yAxisLabelWidth,
42
- shiftPointerLabelX,
43
- pointerLabelHeight,
44
- pointerStripUptoDataPoint,
45
- pointerStripHeight,
46
- shiftPointerLabelY,
47
- showPointerStrip,
48
- pointerStripWidth,
49
- containerHeight,
50
- xAxisThickness,
51
- pointerStripColor,
52
- pointerEvents,
53
- setResponderStartTime,
54
- setPointerY,
55
- setPointerItem,
56
- initialSpacing,
57
- spacing,
58
- data,
59
- barWidth,
60
- setPointerX,
61
- setPointerIndex,
62
- maxValue,
63
- responderStartTime,
64
- setResponderActive,
65
- activatePointersDelay,
66
- persistPointer,
67
- pointerVanishDelay,
68
- containerHeightIncludingBelowXAxis,
69
- extendedContainerHeight,
70
- totalWidth,
71
- stripBehindBars,
72
- noOfSectionsBelowXAxis,
73
- stepHeight,
74
- xAxisLabelsVerticalShift,
75
- labelsExtraHeight,
76
- stripOverPointer,
77
- pointerLabelComponent,
78
- setSelectedIndex,
79
- isAnimated,
80
- animationDuration,
81
- side,
82
- labelWidth,
83
- isThreeD,
84
- animatedHeight,
85
- appearingOpacity,
86
- autoShiftLabels,
87
- getPropsCommonForBarAndStack,
88
- barAndLineChartsWrapperProps,
89
- } = useBarChart({...props, heightValue, widthValue, opacValue});
90
-
91
- const labelsAppear = useCallback(() => {
92
- opacValue.setValue(0);
93
- Animated.timing(opacValue, {
94
- toValue: 1,
95
- duration: 500,
96
- easing: Easing.ease,
97
- useNativeDriver: false,
98
- }).start();
99
- }, [opacValue]);
100
-
101
- const decreaseWidth = useCallback(() => {
102
- widthValue.setValue(0);
103
- Animated.timing(widthValue, {
104
- toValue: 1,
105
- duration: lineConfig.animationDuration,
106
- easing: Easing.linear,
107
- useNativeDriver: false,
108
- }).start();
109
- }, [lineConfig.animationDuration, widthValue]);
110
-
111
- useEffect(() => {
112
- if (lineConfig.isAnimated) {
113
- setTimeout(() => decreaseWidth(), lineConfig.delay || 0);
114
- }
115
- setTimeout(() => labelsAppear(), animationDuration);
116
- }, [decreaseWidth, labelsAppear, animationDuration]);
117
-
118
- const renderPointer = (lineNumber: number) => {
119
- if (lineNumber === 1 && hidePointer1) return;
120
-
121
- const pointerItemLocal = pointerItem;
122
- const pointerYLocal = pointerY;
123
- const pointerColorLocal = pointerConfig?.pointer1Color || pointerColor;
124
-
125
- return Pointer({
126
- pointerX,
127
- pointerYLocal,
128
- pointerComponent,
129
- pointerHeight,
130
- pointerRadius,
131
- pointerWidth,
132
- pointerItemLocal,
133
- pointerColorLocal,
134
- });
135
- };
136
-
137
- const renderStripAndLabel = pointerLabelComponent => {
138
- let pointerItemLocal,
139
- pointerYLocal = pointerY;
140
-
141
- pointerItemLocal = [pointerItem];
142
- return StripAndLabel({
143
- autoAdjustPointerLabelPosition,
144
- pointerX,
145
- pointerLabelWidth,
146
- activatePointersOnLongPress,
147
- yAxisLabelWidth,
148
- pointerRadius,
149
- pointerWidth,
150
- shiftPointerLabelX,
151
- pointerLabelHeight,
152
- pointerYLocal,
153
- pointerStripUptoDataPoint,
154
- pointerStripHeight,
155
- shiftPointerLabelY,
156
- pointerItemLocal,
157
- showPointerStrip,
158
- pointerStripWidth,
159
- containerHeight,
160
- xAxisThickness,
161
- pointerStripColor,
162
- pointerConfig,
163
- pointerLabelComponent,
164
- scrollX: 0,
165
- pointerEvents,
166
- isBarChart: true,
167
- });
168
- };
169
-
170
- const renderChartContent = () => {
171
- if (pointerConfig) {
172
- return (
173
- <View
174
- onStartShouldSetResponder={evt => (pointerConfig ? true : false)}
175
- onMoveShouldSetResponder={evt => (pointerConfig ? true : false)}
176
- onResponderGrant={evt => {
177
- if (!pointerConfig) return;
178
- setResponderStartTime(evt.timeStamp);
179
- if (activatePointersOnLongPress) {
180
- return;
181
- }
182
- let x = evt.nativeEvent.locationX;
183
- if (
184
- !activatePointersOnLongPress &&
185
- x > (props.width || screenWidth)
186
- )
187
- return;
188
- let factor =
189
- (x - initialSpacing - barWidth / 2) / (spacing + barWidth);
190
- factor = Math.round(factor);
191
- factor = Math.min(factor, data.length - 1);
192
- factor = Math.max(factor, 0);
193
- let z =
194
- initialSpacing +
195
- (spacing + barWidth) * factor -
196
- (pointerRadius || pointerWidth / 2) +
197
- barWidth / 2;
198
- setPointerX(z);
199
- setPointerIndex(factor);
200
- let item, y;
201
- item = (props.stackData ?? data)[factor];
202
- const stackSum = item.stacks?.reduce(
203
- (acc, stack) => acc + (stack.value ?? 0),
204
- 0,
205
- );
206
- y =
207
- containerHeight -
208
- ((stackSum ?? item.value) * containerHeight) / maxValue -
209
- (pointerRadius || pointerHeight / 2) +
210
- 10;
211
- setPointerY(y);
212
- setPointerItem(item);
213
- }}
214
- onResponderMove={evt => {
215
- if (!pointerConfig) return;
216
- if (
217
- activatePointersOnLongPress &&
218
- evt.timeStamp - responderStartTime < activatePointersDelay
219
- ) {
220
- return;
221
- } else {
222
- setResponderActive(true);
223
- }
224
- let x = evt.nativeEvent.locationX;
225
- if (
226
- !activatePointersOnLongPress &&
227
- x > (props.width || screenWidth)
228
- )
229
- return;
230
- let factor =
231
- (x - initialSpacing - barWidth / 2) / (spacing + barWidth);
232
- factor = Math.round(factor);
233
- factor = Math.min(factor, (props.stackData ?? data).length - 1);
234
- factor = Math.max(factor, 0);
235
- let z =
236
- initialSpacing +
237
- (spacing + barWidth) * factor -
238
- (pointerRadius || pointerWidth / 2) +
239
- barWidth / 2;
240
- let item, y;
241
- setPointerX(z);
242
- setPointerIndex(factor);
243
- item = (props.stackData ?? data)[factor];
244
- const stackSum = item.stacks?.reduce(
245
- (acc, stack) => acc + (stack.value ?? 0),
246
- 0,
247
- );
248
- y =
249
- containerHeight -
250
- ((stackSum ?? item.value) * containerHeight) / maxValue -
251
- (pointerRadius || pointerHeight / 2) +
252
- 10;
253
- setPointerY(y);
254
- setPointerItem(item);
255
- }}
256
- onResponderEnd={evt => {
257
- setResponderStartTime(0);
258
- setPointerIndex(-1);
259
- setResponderActive(false);
260
- if (!persistPointer)
261
- setTimeout(() => setPointerX(0), pointerVanishDelay);
262
- }}
263
- onResponderTerminationRequest={evt => false}
264
- style={{
265
- position: 'absolute',
266
- height: containerHeightIncludingBelowXAxis,
267
- bottom: 60,
268
- paddingLeft: initialSpacing,
269
- width: totalWidth,
270
- flexDirection: 'row',
271
- }}>
272
- {pointerX > 0 && stripBehindBars ? (
273
- <View
274
- pointerEvents={pointerEvents ?? 'none'}
275
- style={{
276
- position: 'absolute',
277
- height:
278
- extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
279
- bottom: xAxisLabelsVerticalShift + labelsExtraHeight,
280
- width: totalWidth,
281
- }}>
282
- {renderStripAndLabel(null)}
283
- </View>
284
- ) : null}
285
- {renderChart()}
286
- {pointerX > 0 ? (
287
- <View
288
- pointerEvents={pointerEvents ?? 'none'}
289
- style={{
290
- position: 'absolute',
291
- height:
292
- extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
293
- bottom: xAxisLabelsVerticalShift + labelsExtraHeight,
294
- width: totalWidth,
295
- zIndex: 20,
296
- }}>
297
- {!stripOverPointer &&
298
- !stripBehindBars &&
299
- renderStripAndLabel(null)}
300
- {renderPointer(1)}
301
- {stripOverPointer &&
302
- !stripBehindBars &&
303
- renderStripAndLabel(null)}
304
- {
305
- pointerLabelComponent &&
306
- renderStripAndLabel(pointerLabelComponent) // no matter what, pointerLabelComponent will be rendered at last -> over the chart content
307
- }
308
- </View>
309
- ) : null}
310
- </View>
311
- );
312
- } else {
313
- return renderChart();
314
- }
315
- };
316
-
317
- const renderChart = () => {
318
- if (props.stackData) {
319
- return props.stackData.map((item, index) => {
320
- return (
321
- <RenderStackBars
322
- stackData={props.stackData || []}
323
- isAnimated={isAnimated}
324
- animationDuration={animationDuration}
325
- stackBorderRadius={props.stackBorderRadius}
326
- stackBorderTopLeftRadius={props.stackBorderTopLeftRadius}
327
- stackBorderTopRightRadius={props.stackBorderTopRightRadius}
328
- stackBorderBottomLeftRadius={props.stackBorderBottomLeftRadius}
329
- stackBorderBottomRightRadius={props.stackBorderBottomRightRadius}
330
- {...getPropsCommonForBarAndStack(item, index)}
331
- />
332
- );
333
- });
334
- } else {
335
- return data.map((item, index) => (
336
- <RenderBars
337
- data={data}
338
- side={side}
339
- minHeight={props.minHeight ?? (isAnimated && !isThreeD ? 0.1 : 0)}
340
- sideWidth={props.sideWidth}
341
- labelWidth={labelWidth}
342
- isThreeD={isThreeD}
343
- isAnimated={isAnimated}
344
- animationDuration={animationDuration}
345
- animatedHeight={animatedHeight}
346
- appearingOpacity={appearingOpacity}
347
- roundedTop={props.roundedTop}
348
- roundedBottom={props.roundedBottom}
349
- frontColor={props.frontColor}
350
- sideColor={props.sideColor}
351
- topColor={props.topColor}
352
- cappedBars={props.cappedBars}
353
- capThickness={props.capThickness}
354
- capColor={props.capColor}
355
- capRadius={props.capRadius}
356
- autoShiftLabels={autoShiftLabels}
357
- barMarginBottom={props.barMarginBottom}
358
- barStyle={props.barStyle}
359
- {...getPropsCommonForBarAndStack(item, index)}
360
- />
361
- ));
362
- }
363
- };
364
-
365
- return (
366
- <BarAndLineChartsWrapper
367
- {...barAndLineChartsWrapperProps}
368
- scrollRef={scrollRef}
369
- renderChartContent={renderChartContent}
370
- remainingScrollViewProps={remainingScrollViewProps}
371
- />
372
- );
373
- };
@@ -1,47 +0,0 @@
1
- import {StyleSheet} from 'react-native';
2
-
3
- export const styles = StyleSheet.create({
4
- container: {
5
- width: '100%',
6
- marginBottom: 40,
7
- marginRight: 40,
8
- },
9
- horizBar: {
10
- flexDirection: 'row',
11
- },
12
- leftLabel: {
13
- justifyContent: 'center',
14
- alignItems: 'center',
15
- },
16
- lastLeftLabel: {
17
- justifyContent: 'center',
18
- alignItems: 'center',
19
- },
20
- leftPart: {
21
- justifyContent: 'center',
22
- width: '100%',
23
- },
24
- lastLeftPart: {
25
- justifyContent: 'flex-end',
26
- width: '100%',
27
- },
28
- line: {
29
- width: '100%',
30
- height: 1,
31
- backgroundColor: 'gray',
32
- opacity: 0.5,
33
- },
34
- lastLine: {
35
- width: '100%',
36
- height: 1,
37
- backgroundColor: 'black',
38
- },
39
- bottomLabel: {
40
- width: '100%',
41
- },
42
- customDataPointContainer: {
43
- position: 'absolute',
44
- justifyContent: 'center',
45
- alignItems: 'center',
46
- },
47
- });
@@ -1,258 +0,0 @@
1
- import React, {useEffect, useState} from 'react';
2
- import {
3
- View,
4
- StyleSheet,
5
- LayoutAnimation,
6
- Platform,
7
- UIManager,
8
- Text,
9
- } from 'react-native';
10
- import Svg, {Defs, Rect} from 'react-native-svg';
11
- import {styles} from './styles';
12
- import LinearGradient from "../common/LinearGradient";
13
- import {
14
- useAnimatedThreeDBar,
15
- animatedBarPropTypes,
16
- trianglePropTypes,
17
- } from 'gifted-charts-core';
18
-
19
- if (Platform.OS === 'android') {
20
- UIManager.setLayoutAnimationEnabledExperimental &&
21
- UIManager.setLayoutAnimationEnabledExperimental(true);
22
- }
23
-
24
- const TriangleCorner = (props: trianglePropTypes) => {
25
- return (
26
- <View
27
- style={[
28
- triangleStyles.triangleCorner,
29
- props.style,
30
- {
31
- borderRightWidth: props.width / 2,
32
- borderTopWidth: props.width / 2,
33
- borderTopColor: props.color,
34
- },
35
- ]}
36
- />
37
- );
38
- };
39
-
40
- const triangleStyles = StyleSheet.create({
41
- triangleCorner: {
42
- width: 0,
43
- height: 0,
44
- backgroundColor: 'transparent',
45
- borderStyle: 'solid',
46
- borderRightColor: 'transparent',
47
- transform: [{rotate: '90deg'}],
48
- },
49
- });
50
-
51
- const AnimatedThreeDBar = (props: animatedBarPropTypes) => {
52
- const heightCopy = props.height;
53
- const [height, setHeight] = useState(
54
- props.isAnimated ? (Platform.OS === 'ios' ? 0 : 20) : heightCopy,
55
- );
56
-
57
- const {
58
- isAnimated,
59
- animationDuration,
60
- item,
61
- index,
62
- barWidth,
63
- sideWidth,
64
- barStyle,
65
- barBackgroundPattern,
66
- barInnerComponent,
67
- patternId,
68
- intactTopLabel,
69
- showValuesAsTopLabel,
70
- topLabelContainerStyle,
71
- topLabelTextStyle,
72
- } = props;
73
-
74
- const {
75
- showGradient,
76
- gradientColor,
77
- frontColor,
78
- sideColor,
79
- topColor,
80
- opacity,
81
- initialRender,
82
- setInitialRender,
83
- } = useAnimatedThreeDBar(props);
84
-
85
- useEffect(() => {
86
- if (isAnimated) {
87
- if (initialRender) {
88
- setTimeout(() => {
89
- layoutAppear();
90
- }, 20);
91
- } else {
92
- elevate();
93
- }
94
- }
95
- }, [props.height]);
96
-
97
- const elevate = () => {
98
- LayoutAnimation.configureNext({
99
- duration: animationDuration,
100
- update: {type: 'linear', property: 'scaleY'},
101
- });
102
- setHeight(props.height);
103
- };
104
-
105
- const layoutAppear = () => {
106
- LayoutAnimation.configureNext({
107
- duration: Platform.OS == 'ios' ? animationDuration : 20,
108
- create: {type: 'linear', property: 'scaleY'},
109
- // update: { type: 'linear' }
110
- });
111
- setInitialRender(false);
112
- setTimeout(() => elevate(), Platform.OS == 'ios' ? 10 : 100);
113
- };
114
-
115
- return (
116
- <View style={styles.container}>
117
- {!initialRender && (
118
- <View
119
- style={[
120
- styles.row,
121
- {opacity: opacity, position: 'absolute', bottom: 0},
122
- props.side === 'right' && {transform: [{rotateY: '180deg'}]},
123
- ]}>
124
- {/******************* Top View *****************/}
125
- {props.height ? (
126
- <>
127
- <View style={{position: 'absolute', top: sideWidth / -2}}>
128
- <TriangleCorner
129
- color={topColor}
130
- width={sideWidth}
131
- style={{transform: [{rotate: '90deg'}], opacity: opacity}}
132
- />
133
- </View>
134
- <View style={{position: 'absolute', top: sideWidth / -2}}>
135
- <View
136
- style={{
137
- width: barWidth,
138
- height: barWidth,
139
- // left: width / 2,
140
- backgroundColor: topColor,
141
- opacity: opacity,
142
- }}
143
- />
144
- </View>
145
- <View
146
- style={{
147
- position: 'absolute',
148
- top: sideWidth / -2,
149
- left: barWidth - 1,
150
- }}>
151
- <TriangleCorner
152
- color={topColor}
153
- width={sideWidth}
154
- style={{transform: [{rotate: '-90deg'}], opacity: opacity}}
155
- />
156
- </View>
157
- </>
158
- ) : null}
159
-
160
- {/*******************************************************************/}
161
-
162
- <View style={{marginTop: sideWidth / -2 - 1}}>
163
- <TriangleCorner
164
- color={height ? sideColor : 'transparent'}
165
- width={sideWidth}
166
- style={{transform: [{rotate: '-90deg'}], opacity: opacity}}
167
- />
168
- <View
169
- style={{
170
- width: sideWidth / 2 + 1,
171
- height: height - sideWidth / 2, //animatedSideHeight
172
- backgroundColor: sideColor,
173
- opacity: opacity,
174
- }}
175
- />
176
- <TriangleCorner
177
- color={height ? sideColor : 'transparent'}
178
- width={sideWidth + 1}
179
- style={{transform: [{rotate: '90deg'}], opacity: opacity}}
180
- />
181
- </View>
182
-
183
- <View
184
- style={[
185
- {
186
- width: barWidth,
187
- height: height, //animatedHeight
188
- backgroundColor: frontColor,
189
- borderLeftWidth: StyleSheet.hairlineWidth,
190
- borderTopWidth: StyleSheet.hairlineWidth,
191
- borderColor: 'white',
192
- opacity: opacity,
193
- },
194
- item.barStyle || barStyle,
195
- ]}>
196
- {showGradient && (
197
- <LinearGradient
198
- style={{position: 'absolute', width: '100%', height: '100%'}}
199
- start={{x: 0, y: 0}}
200
- end={{x: 1, y: 1}}
201
- colors={[gradientColor, frontColor]}
202
- />
203
- )}
204
- {barBackgroundPattern && (
205
- <Svg>
206
- <Defs>{barBackgroundPattern()}</Defs>
207
- <Rect
208
- stroke="transparent"
209
- x="1"
210
- y="1"
211
- width={barWidth || 30}
212
- height={height}
213
- fill={`url(#${patternId})`}
214
- />
215
- </Svg>
216
- )}
217
- {barInnerComponent ? (
218
- <View style={{height: '100%', width: '100%'}}>
219
- {barInnerComponent(item, index)}
220
- </View>
221
- ) : null}
222
- </View>
223
-
224
- {/******************* Top Label *****************/}
225
-
226
- {(item.topLabelComponent || showValuesAsTopLabel) && (
227
- <View
228
- style={[
229
- {
230
- position: 'absolute',
231
- top: barWidth * -2,
232
- height: (barWidth * 3) / 2,
233
- width: (barWidth * 3) / 2,
234
- justifyContent: 'flex-end',
235
- alignItems: 'center',
236
- opacity: opacity,
237
- },
238
- props.horizontal &&
239
- !intactTopLabel && {transform: [{rotate: '270deg'}]},
240
- props.side === 'right' && {transform: [{rotateY: '180deg'}]},
241
- topLabelContainerStyle ?? item.topLabelContainerStyle,
242
- ]}>
243
- {showValuesAsTopLabel ? (
244
- <Text style={topLabelTextStyle}>{item.value}</Text>
245
- ) : (
246
- item.topLabelComponent?.()
247
- )}
248
- </View>
249
- )}
250
-
251
- {/*******************************************************************/}
252
- </View>
253
- )}
254
- </View>
255
- );
256
- };
257
-
258
- export default AnimatedThreeDBar;
@@ -1,14 +0,0 @@
1
- import {StyleSheet} from 'react-native';
2
-
3
- export const styles = StyleSheet.create({
4
- container: {
5
- flex: 1,
6
- // width: '100%',
7
- // height: '100%',
8
- justifyContent: 'center',
9
- alignItems: 'center',
10
- },
11
- row: {
12
- flexDirection: 'row',
13
- },
14
- });