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,391 +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: any) => {
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
- autoShiftLabelsForNegativeStacks,
90
- } = useBarChart({
91
- ...props,
92
- heightValue,
93
- widthValue,
94
- opacValue,
95
- parentWidth: props.parentWidth ?? screenWidth,
96
- });
97
-
98
- const labelsAppear = useCallback(() => {
99
- opacValue.setValue(0);
100
- Animated.timing(opacValue, {
101
- toValue: 1,
102
- duration: 500,
103
- easing: Easing.ease,
104
- useNativeDriver: false,
105
- }).start();
106
- }, [opacValue]);
107
-
108
- const decreaseWidth = useCallback(() => {
109
- widthValue.setValue(0);
110
- Animated.timing(widthValue, {
111
- toValue: 1,
112
- duration: lineConfig.animationDuration,
113
- easing: Easing.linear,
114
- useNativeDriver: false,
115
- }).start();
116
- }, [lineConfig.animationDuration, widthValue]);
117
-
118
- useEffect(() => {
119
- if (lineConfig.isAnimated) {
120
- setTimeout(() => decreaseWidth(), lineConfig.delay || 0);
121
- }
122
- setTimeout(() => labelsAppear(), animationDuration);
123
- }, [decreaseWidth, labelsAppear, animationDuration]);
124
-
125
- const renderPointer = (lineNumber: number) => {
126
- if (lineNumber === 1 && hidePointer1) return;
127
-
128
- const pointerItemLocal = pointerItem;
129
- const pointerYLocal = pointerY;
130
- const pointerColorLocal = pointerConfig?.pointer1Color || pointerColor;
131
-
132
- return Pointer({
133
- pointerX,
134
- pointerYLocal,
135
- pointerComponent,
136
- pointerHeight,
137
- pointerRadius,
138
- pointerWidth,
139
- pointerItemLocal,
140
- pointerColorLocal,
141
- });
142
- };
143
-
144
- const renderStripAndLabel = (pointerLabelComponent: any) => {
145
- let pointerItemLocal,
146
- pointerYLocal = pointerY;
147
-
148
- pointerItemLocal = [pointerItem];
149
- return StripAndLabel({
150
- autoAdjustPointerLabelPosition,
151
- pointerX,
152
- pointerLabelWidth,
153
- activatePointersOnLongPress,
154
- yAxisLabelWidth,
155
- pointerRadius,
156
- pointerWidth,
157
- shiftPointerLabelX,
158
- pointerLabelHeight,
159
- pointerYLocal,
160
- pointerStripUptoDataPoint,
161
- pointerStripHeight,
162
- shiftPointerLabelY,
163
- pointerItemLocal,
164
- showPointerStrip,
165
- pointerStripWidth,
166
- containerHeight,
167
- xAxisThickness,
168
- pointerStripColor,
169
- pointerConfig,
170
- pointerLabelComponent,
171
- scrollX: 0,
172
- pointerEvents,
173
- isBarChart: true,
174
- });
175
- };
176
-
177
- const renderChartContent = () => {
178
- if (pointerConfig) {
179
- return (
180
- <View
181
- onStartShouldSetResponder={evt => (pointerConfig ? true : false)}
182
- onMoveShouldSetResponder={evt => (pointerConfig ? true : false)}
183
- onResponderGrant={evt => {
184
- if (!pointerConfig) return;
185
- setResponderStartTime(evt.timeStamp);
186
- if (activatePointersOnLongPress) {
187
- return;
188
- }
189
- let x = evt.nativeEvent.locationX;
190
- if (
191
- !activatePointersOnLongPress &&
192
- x > (props.width || screenWidth)
193
- )
194
- return;
195
- let factor =
196
- (x - initialSpacing - barWidth / 2) / (spacing + barWidth);
197
- factor = Math.round(factor);
198
- factor = Math.min(factor, data.length - 1);
199
- factor = Math.max(factor, 0);
200
- let z =
201
- initialSpacing +
202
- (spacing + barWidth) * factor -
203
- (pointerRadius || pointerWidth / 2) +
204
- barWidth / 2;
205
- setPointerX(z);
206
- setPointerIndex(factor);
207
-
208
- let item, y;
209
- item = (props.stackData ?? data)[factor];
210
- let stackSum = 0;
211
- if ('stacks' in item) {
212
- stackSum = item.stacks.reduce(
213
- (acc: number, stack: any) => acc + (stack.value ?? 0),
214
- 0,
215
- );
216
- }
217
- y =
218
- containerHeight -
219
- ((stackSum ?? item.value) * containerHeight) / maxValue -
220
- (pointerRadius || pointerHeight / 2) +
221
- 10;
222
- setPointerY(y);
223
- setPointerItem(item);
224
- }}
225
- onResponderMove={evt => {
226
- if (!pointerConfig) return;
227
- if (
228
- activatePointersOnLongPress &&
229
- evt.timeStamp - responderStartTime < activatePointersDelay
230
- ) {
231
- return;
232
- } else {
233
- setResponderActive(true);
234
- }
235
- let x = evt.nativeEvent.locationX;
236
- if (
237
- !activatePointersOnLongPress &&
238
- x > (props.width || screenWidth)
239
- )
240
- return;
241
- let factor =
242
- (x - initialSpacing - barWidth / 2) / (spacing + barWidth);
243
- factor = Math.round(factor);
244
- factor = Math.min(factor, (props.stackData ?? data).length - 1);
245
- factor = Math.max(factor, 0);
246
- let z =
247
- initialSpacing +
248
- (spacing + barWidth) * factor -
249
- (pointerRadius || pointerWidth / 2) +
250
- barWidth / 2;
251
- let item, y;
252
- setPointerX(z);
253
- setPointerIndex(factor);
254
- item = (props.stackData ?? data)[factor];
255
- let stackSum = 0;
256
- if ('stacks' in item) {
257
- item.stacks?.reduce(
258
- (acc: number, stack: any) => acc + (stack.value ?? 0),
259
- 0,
260
- );
261
- }
262
- y =
263
- containerHeight -
264
- ((stackSum ?? item.value) * containerHeight) / maxValue -
265
- (pointerRadius || pointerHeight / 2) +
266
- 10;
267
- setPointerY(y);
268
- setPointerItem(item);
269
- }}
270
- onResponderEnd={evt => {
271
- setResponderStartTime(0);
272
- setPointerIndex(-1);
273
- setResponderActive(false);
274
- if (!persistPointer)
275
- setTimeout(() => setPointerX(0), pointerVanishDelay);
276
- }}
277
- onResponderTerminationRequest={evt => false}
278
- style={{
279
- position: 'absolute',
280
- height: containerHeightIncludingBelowXAxis,
281
- bottom: 60,
282
- paddingLeft: initialSpacing,
283
- width: totalWidth,
284
- flexDirection: 'row',
285
- }}>
286
- {pointerX > 0 && stripBehindBars ? (
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
- }}>
296
- {renderStripAndLabel(null)}
297
- </View>
298
- ) : null}
299
- {renderChart()}
300
- {pointerX > 0 ? (
301
- <View
302
- pointerEvents={pointerEvents ?? 'none'}
303
- style={{
304
- position: 'absolute',
305
- height:
306
- extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
307
- bottom: xAxisLabelsVerticalShift + labelsExtraHeight,
308
- width: totalWidth,
309
- zIndex: 20,
310
- }}>
311
- {!stripOverPointer &&
312
- !stripBehindBars &&
313
- renderStripAndLabel(null)}
314
- {renderPointer(1)}
315
- {stripOverPointer &&
316
- !stripBehindBars &&
317
- renderStripAndLabel(null)}
318
- {
319
- pointerLabelComponent &&
320
- renderStripAndLabel(pointerLabelComponent) // no matter what, pointerLabelComponent will be rendered at last -> over the chart content
321
- }
322
- </View>
323
- ) : null}
324
- </View>
325
- );
326
- } else {
327
- return renderChart();
328
- }
329
- };
330
-
331
- const renderChart = () => {
332
- if (props.stackData) {
333
- return props.stackData.map((item, index) => {
334
- return (
335
- <RenderStackBars
336
- key={index}
337
- stackData={props.stackData || []}
338
- isAnimated={isAnimated}
339
- animationDuration={animationDuration}
340
- stackBorderRadius={props.stackBorderRadius}
341
- stackBorderTopLeftRadius={props.stackBorderTopLeftRadius}
342
- stackBorderTopRightRadius={props.stackBorderTopRightRadius}
343
- stackBorderBottomLeftRadius={props.stackBorderBottomLeftRadius}
344
- stackBorderBottomRightRadius={props.stackBorderBottomRightRadius}
345
- autoShiftLabelsForNegativeStacks={autoShiftLabelsForNegativeStacks}
346
- {...getPropsCommonForBarAndStack(item, index)}
347
- />
348
- );
349
- });
350
- } else {
351
- return data.map((item, index) => (
352
- <RenderBars
353
- key={index}
354
- data={data}
355
- side={side}
356
- minHeight={props.minHeight ?? (isAnimated && !isThreeD ? 0.1 : 0)}
357
- sideWidth={props.sideWidth}
358
- labelWidth={labelWidth}
359
- isThreeD={isThreeD}
360
- isAnimated={isAnimated}
361
- animationDuration={animationDuration}
362
- animatedHeight={animatedHeight}
363
- appearingOpacity={appearingOpacity}
364
- roundedTop={props.roundedTop}
365
- roundedBottom={props.roundedBottom}
366
- frontColor={props.frontColor}
367
- sideColor={props.sideColor}
368
- topColor={props.topColor}
369
- cappedBars={props.cappedBars}
370
- capThickness={props.capThickness}
371
- capColor={props.capColor}
372
- capRadius={props.capRadius}
373
- autoShiftLabels={autoShiftLabels}
374
- barMarginBottom={props.barMarginBottom}
375
- barStyle={props.barStyle}
376
- {...getPropsCommonForBarAndStack(item, index)}
377
- />
378
- ));
379
- }
380
- };
381
-
382
- return (
383
- <BarAndLineChartsWrapper
384
- {...barAndLineChartsWrapperProps}
385
- scrollRef={scrollRef}
386
- renderChartContent={renderChartContent}
387
- remainingScrollViewProps={remainingScrollViewProps}
388
- nestedScrollEnabled={props.nestedScrollEnabled}
389
- />
390
- );
391
- };
@@ -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
- });