react-native-gifted-charts 1.0.0 → 1.0.1
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie and Donut charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"files": [
|
|
@@ -223,12 +223,13 @@ const Animated2DWithGradient = (props: propTypes) => {
|
|
|
223
223
|
height: item.barWidth || 30,
|
|
224
224
|
width: item.barWidth || 30,
|
|
225
225
|
justifyContent:
|
|
226
|
-
props.horizontal && !props.intactTopLabel
|
|
226
|
+
(props.horizontal && !props.intactTopLabel) || item.value < 0
|
|
227
227
|
? 'center'
|
|
228
228
|
: 'flex-end',
|
|
229
229
|
alignItems: 'center',
|
|
230
230
|
opacity: opacity,
|
|
231
231
|
},
|
|
232
|
+
item.value < 0 && {transform:[{rotate:'180deg'}]},
|
|
232
233
|
props.horizontal &&
|
|
233
234
|
!props.intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
234
235
|
item.topLabelContainerStyle,
|
|
@@ -242,4 +243,4 @@ const Animated2DWithGradient = (props: propTypes) => {
|
|
|
242
243
|
);
|
|
243
244
|
};
|
|
244
245
|
|
|
245
|
-
export default Animated2DWithGradient;
|
|
246
|
+
export default Animated2DWithGradient;
|
|
@@ -57,6 +57,7 @@ type Props = {
|
|
|
57
57
|
horizontal: Boolean;
|
|
58
58
|
intactTopLabel: Boolean;
|
|
59
59
|
barBorderRadius?: number;
|
|
60
|
+
autoShiftLabels?: Boolean;
|
|
60
61
|
};
|
|
61
62
|
type itemType = {
|
|
62
63
|
value?: number;
|
|
@@ -99,8 +100,9 @@ const RenderBars = (props: Props) => {
|
|
|
99
100
|
appearingOpacity,
|
|
100
101
|
opacity,
|
|
101
102
|
animationDuration,
|
|
103
|
+
autoShiftLabels,
|
|
102
104
|
} = props;
|
|
103
|
-
const renderLabel = (label: String, labelTextStyle: any) => {
|
|
105
|
+
const renderLabel = (label: String, labelTextStyle: any, value: number) => {
|
|
104
106
|
return (
|
|
105
107
|
<View
|
|
106
108
|
style={[
|
|
@@ -119,10 +121,12 @@ const RenderBars = (props: Props) => {
|
|
|
119
121
|
rotateLabel
|
|
120
122
|
? props.horizontal
|
|
121
123
|
? {transform: [{rotate: '330deg'}]}
|
|
122
|
-
: {transform: [{rotate: '60deg'}]}
|
|
124
|
+
: {transform: [{rotate: value < 0 ? '240deg' : '60deg'}, {translateX: value < 0 ? 56 : 0}, {translateY: value < 0 ? 32 : 0}]}
|
|
123
125
|
: props.horizontal
|
|
124
126
|
? {transform: [{rotate: '-90deg'}]}
|
|
125
|
-
:
|
|
127
|
+
: value < 0
|
|
128
|
+
?{transform:[{rotate:'180deg'},{translateY:autoShiftLabels?0:32}]}
|
|
129
|
+
:{},
|
|
126
130
|
]}>
|
|
127
131
|
{item.labelComponent ? (
|
|
128
132
|
item.labelComponent()
|
|
@@ -137,7 +141,7 @@ const RenderBars = (props: Props) => {
|
|
|
137
141
|
);
|
|
138
142
|
};
|
|
139
143
|
|
|
140
|
-
const renderAnimatedLabel = (label: String, labelTextStyle: any) => {
|
|
144
|
+
const renderAnimatedLabel = (label: String, labelTextStyle: any, value: number) => {
|
|
141
145
|
return (
|
|
142
146
|
<Animated.View
|
|
143
147
|
style={[
|
|
@@ -150,9 +154,11 @@ const RenderBars = (props: Props) => {
|
|
|
150
154
|
30) +
|
|
151
155
|
spacing / 2,
|
|
152
156
|
position: 'absolute',
|
|
157
|
+
left: -4,
|
|
153
158
|
bottom: rotateLabel ? -40 : -25,
|
|
154
159
|
opacity: appearingOpacity,
|
|
155
160
|
},
|
|
161
|
+
value < 0 && {transform:[{rotate:'180deg'}]},
|
|
156
162
|
rotateLabel
|
|
157
163
|
? props.horizontal
|
|
158
164
|
? {transform: [{rotate: '330deg'}]}
|
|
@@ -244,11 +250,12 @@ const RenderBars = (props: Props) => {
|
|
|
244
250
|
height: item.barWidth || props.barWidth || 30,
|
|
245
251
|
width: item.barWidth || props.barWidth || 30,
|
|
246
252
|
justifyContent:
|
|
247
|
-
props.horizontal && !props.intactTopLabel
|
|
253
|
+
(props.horizontal && !props.intactTopLabel) || item.value < 0
|
|
248
254
|
? 'center'
|
|
249
255
|
: 'flex-end',
|
|
250
256
|
alignItems: 'center',
|
|
251
257
|
},
|
|
258
|
+
item.value < 0 && {transform:[{rotate:'180deg'}]},
|
|
252
259
|
props.horizontal &&
|
|
253
260
|
!props.intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
254
261
|
item.topLabelContainerStyle,
|
|
@@ -270,12 +277,13 @@ const RenderBars = (props: Props) => {
|
|
|
270
277
|
// overflow: 'visible',
|
|
271
278
|
marginBottom: 60,
|
|
272
279
|
width: item.barWidth || props.barWidth || 30,
|
|
273
|
-
height: item.topLabelComponent
|
|
280
|
+
height: item.value>=0 &&(!isThreeD || isAnimated) && item.topLabelComponent
|
|
274
281
|
? (item.topLabelComponentHeight || 30) +
|
|
275
|
-
(item.value * (containerHeight || 200)) / (maxValue || 200)
|
|
276
|
-
: (item.value * (containerHeight || 200)) / (maxValue || 200),
|
|
282
|
+
(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200)
|
|
283
|
+
: (Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200),
|
|
277
284
|
marginRight: spacing,
|
|
278
285
|
},
|
|
286
|
+
item.value < 0 && {transform:[{translateY:(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200)},{rotateZ:'180deg'}]},
|
|
279
287
|
// !isThreeD && !item.showGradient && !props.showGradient &&
|
|
280
288
|
// { backgroundColor: item.frontColor || props.frontColor || 'black' },
|
|
281
289
|
side !== 'right' && {zIndex: data.length - index},
|
|
@@ -325,7 +333,7 @@ const RenderBars = (props: Props) => {
|
|
|
325
333
|
topLabelComponent={item.topLabelComponent}
|
|
326
334
|
opacity={opacity || 1}
|
|
327
335
|
animationDuration={animationDuration || 800}
|
|
328
|
-
height={(item.value * (containerHeight || 200)) / (maxValue || 200)}
|
|
336
|
+
height={(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200)}
|
|
329
337
|
intactTopLabel={props.intactTopLabel}
|
|
330
338
|
horizontal={props.horizontal}
|
|
331
339
|
/>
|
|
@@ -350,7 +358,8 @@ const RenderBars = (props: Props) => {
|
|
|
350
358
|
opacity={opacity || 1}
|
|
351
359
|
horizontal={props.horizontal}
|
|
352
360
|
intactTopLabel={props.intactTopLabel}
|
|
353
|
-
height={(item.value * (containerHeight || 200)) / (maxValue || 200)}
|
|
361
|
+
height={(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200)}
|
|
362
|
+
value={item.value}
|
|
354
363
|
/>
|
|
355
364
|
)
|
|
356
365
|
) : item.showGradient || props.showGradient ? (
|
|
@@ -364,7 +373,7 @@ const RenderBars = (props: Props) => {
|
|
|
364
373
|
roundedTop={props.roundedTop || false}
|
|
365
374
|
gradientColor={props.gradientColor}
|
|
366
375
|
frontColor={props.frontColor || 'black'}
|
|
367
|
-
height={(item.value * (containerHeight || 200)) / (maxValue || 200)}
|
|
376
|
+
height={(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200)}
|
|
368
377
|
cappedBars={props.cappedBars}
|
|
369
378
|
capThickness={props.capThickness}
|
|
370
379
|
capColor={props.capColor}
|
|
@@ -387,7 +396,7 @@ const RenderBars = (props: Props) => {
|
|
|
387
396
|
gradientColor={props.gradientColor}
|
|
388
397
|
noGradient
|
|
389
398
|
frontColor={props.frontColor || 'black'}
|
|
390
|
-
height={(item.value * (containerHeight || 200)) / (maxValue || 200)}
|
|
399
|
+
height={(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200)}
|
|
391
400
|
cappedBars={props.cappedBars}
|
|
392
401
|
capThickness={props.capThickness}
|
|
393
402
|
capColor={props.capColor}
|
|
@@ -408,7 +417,7 @@ const RenderBars = (props: Props) => {
|
|
|
408
417
|
noGradient
|
|
409
418
|
noAnimation
|
|
410
419
|
frontColor={props.frontColor || 'black'}
|
|
411
|
-
height={(item.value * (containerHeight || 200)) / (maxValue || 200)}
|
|
420
|
+
height={(Math.abs(item.value) * (containerHeight || 200)) / (maxValue || 200)}
|
|
412
421
|
cappedBars={props.cappedBars}
|
|
413
422
|
capThickness={props.capThickness}
|
|
414
423
|
capColor={props.capColor}
|
|
@@ -419,10 +428,10 @@ const RenderBars = (props: Props) => {
|
|
|
419
428
|
/>
|
|
420
429
|
)}
|
|
421
430
|
{isAnimated
|
|
422
|
-
? renderAnimatedLabel(item.label || '', item.labelTextStyle)
|
|
423
|
-
: renderLabel(item.label || '', item.labelTextStyle)}
|
|
431
|
+
? renderAnimatedLabel(item.label || '', item.labelTextStyle,item.value)
|
|
432
|
+
: renderLabel(item.label || '', item.labelTextStyle,item.value)}
|
|
424
433
|
</TouchableOpacity>
|
|
425
434
|
);
|
|
426
435
|
};
|
|
427
436
|
|
|
428
|
-
export default RenderBars;
|
|
437
|
+
export default RenderBars;
|
package/src/BarChart/index.tsx
CHANGED
|
@@ -24,7 +24,9 @@ type PropTypes = {
|
|
|
24
24
|
width?: number;
|
|
25
25
|
height?: number;
|
|
26
26
|
noOfSections?: number;
|
|
27
|
+
noOfSectionsBelowXAxis?: number;
|
|
27
28
|
maxValue?: number;
|
|
29
|
+
minValue?: number;
|
|
28
30
|
stepHeight?: number;
|
|
29
31
|
stepValue?: number;
|
|
30
32
|
spacing?: number;
|
|
@@ -114,6 +116,7 @@ type PropTypes = {
|
|
|
114
116
|
yAxisLabelTexts?: Array<string>;
|
|
115
117
|
yAxisLabelPrefix?: String;
|
|
116
118
|
yAxisLabelSuffix?: String;
|
|
119
|
+
autoShiftLabels?: Boolean;
|
|
117
120
|
};
|
|
118
121
|
type lineConfigType = {
|
|
119
122
|
curved?: Boolean;
|
|
@@ -216,13 +219,14 @@ export const BarChart = (props: PropTypes) => {
|
|
|
216
219
|
const containerHeight = props.height || 200;
|
|
217
220
|
const noOfSections = props.noOfSections || 10;
|
|
218
221
|
const horizSections = [{value: '0'}];
|
|
222
|
+
const horizSectionsBelow = [];
|
|
219
223
|
const stepHeight = props.stepHeight || containerHeight / noOfSections;
|
|
220
224
|
const data = useMemo(() => props.data || [], [props.data]);
|
|
221
225
|
const spacing = props.spacing === 0 ? 0 : props.spacing ? props.spacing : 20;
|
|
222
226
|
const labelWidth = props.labelWidth || 0;
|
|
223
227
|
|
|
224
228
|
let totalWidth = spacing;
|
|
225
|
-
let maxItem = 0;
|
|
229
|
+
let maxItem = 0, minItem = 0;
|
|
226
230
|
if (props.stackData) {
|
|
227
231
|
props.stackData.forEach(stackItem => {
|
|
228
232
|
// console.log('stackItem', stackItem);
|
|
@@ -243,6 +247,9 @@ export const BarChart = (props: PropTypes) => {
|
|
|
243
247
|
if (item.value > maxItem) {
|
|
244
248
|
maxItem = item.value;
|
|
245
249
|
}
|
|
250
|
+
if(item.value < minItem){
|
|
251
|
+
minItem = item.value;
|
|
252
|
+
}
|
|
246
253
|
totalWidth +=
|
|
247
254
|
(item.barWidth || props.barWidth || 30) +
|
|
248
255
|
(item.spacing === 0 ? 0 : item.spacing || spacing);
|
|
@@ -256,11 +263,16 @@ export const BarChart = (props: PropTypes) => {
|
|
|
256
263
|
maxItem = parseFloat(maxItem.toFixed(props.roundToDigits || 1));
|
|
257
264
|
} else {
|
|
258
265
|
maxItem = maxItem + (10 - (maxItem % 10));
|
|
266
|
+
if(minItem!==0){
|
|
267
|
+
minItem = minItem - (10 + (minItem % 10))
|
|
268
|
+
}
|
|
259
269
|
}
|
|
260
270
|
|
|
261
271
|
const maxValue = props.maxValue || maxItem;
|
|
272
|
+
const minValue = props.minValue || minItem;
|
|
262
273
|
|
|
263
274
|
const stepValue = props.stepValue || maxValue / noOfSections;
|
|
275
|
+
const noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis || (-minValue / stepValue);
|
|
264
276
|
const disableScroll = props.disableScroll || false;
|
|
265
277
|
const showScrollIndicator = props.showScrollIndicator || false;
|
|
266
278
|
const initialSpacing =
|
|
@@ -326,6 +338,7 @@ export const BarChart = (props: PropTypes) => {
|
|
|
326
338
|
const heightValue = useMemo(() => new Animated.Value(0), []);
|
|
327
339
|
const opacValue = useMemo(() => new Animated.Value(0), []);
|
|
328
340
|
const widthValue = useMemo(() => new Animated.Value(0), []);
|
|
341
|
+
const autoShiftLabels = props.autoShiftLabels || false;
|
|
329
342
|
|
|
330
343
|
const labelsAppear = useCallback(() => {
|
|
331
344
|
opacValue.setValue(0);
|
|
@@ -505,6 +518,19 @@ export const BarChart = (props: PropTypes) => {
|
|
|
505
518
|
: value.toString(),
|
|
506
519
|
});
|
|
507
520
|
}
|
|
521
|
+
if(noOfSectionsBelowXAxis){
|
|
522
|
+
for (let i = 1; i <= noOfSectionsBelowXAxis; i++) {
|
|
523
|
+
let value = stepValue * -i;
|
|
524
|
+
if (props.showFractionalValues || props.roundToDigits) {
|
|
525
|
+
value = parseFloat(value.toFixed(props.roundToDigits || 1));
|
|
526
|
+
}
|
|
527
|
+
horizSectionsBelow.push({
|
|
528
|
+
value: props.yAxisLabelTexts
|
|
529
|
+
? props.yAxisLabelTexts[noOfSectionsBelowXAxis - i] ?? value.toString()
|
|
530
|
+
: value.toString(),
|
|
531
|
+
})
|
|
532
|
+
}
|
|
533
|
+
}
|
|
508
534
|
|
|
509
535
|
const animatedHeight = heightValue.interpolate({
|
|
510
536
|
inputRange: [0, 1],
|
|
@@ -683,6 +709,81 @@ export const BarChart = (props: PropTypes) => {
|
|
|
683
709
|
</View>
|
|
684
710
|
);
|
|
685
711
|
})}
|
|
712
|
+
{horizSectionsBelow.map((sectionItems, index) => {
|
|
713
|
+
let label = getLabel(sectionItems.value);
|
|
714
|
+
if (hideOrigin && index === horizSections.length - 1) {
|
|
715
|
+
label = '';
|
|
716
|
+
}
|
|
717
|
+
return (
|
|
718
|
+
<View
|
|
719
|
+
key={index}
|
|
720
|
+
style={[
|
|
721
|
+
styles.horizBar,
|
|
722
|
+
{
|
|
723
|
+
width: horizontal
|
|
724
|
+
? props.width || totalWidth
|
|
725
|
+
: props.width || totalWidth + 11,
|
|
726
|
+
},
|
|
727
|
+
index===0&&{marginTop:stepHeight/2}
|
|
728
|
+
]}>
|
|
729
|
+
<View
|
|
730
|
+
style={[
|
|
731
|
+
styles.leftLabel,
|
|
732
|
+
{
|
|
733
|
+
borderRightWidth: yAxisThickness,
|
|
734
|
+
borderColor: yAxisColor,
|
|
735
|
+
},
|
|
736
|
+
horizontal &&
|
|
737
|
+
!yAxisAtTop && {
|
|
738
|
+
transform: [{translateX: totalWidth + yAxisThickness}],
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
height: index===0?stepHeight*1.5:stepHeight,
|
|
742
|
+
width: yAxisLabelWidth,
|
|
743
|
+
},
|
|
744
|
+
index===0&&{marginTop:-stepHeight/2}
|
|
745
|
+
]}>
|
|
746
|
+
{!hideYAxisText ? (
|
|
747
|
+
<Text
|
|
748
|
+
numberOfLines={1}
|
|
749
|
+
ellipsizeMode={'clip'}
|
|
750
|
+
style={[
|
|
751
|
+
yAxisTextStyle,
|
|
752
|
+
index === 0 && {marginBottom: stepHeight / -2},
|
|
753
|
+
horizontal && {
|
|
754
|
+
transform: [
|
|
755
|
+
{rotate: '270deg'},
|
|
756
|
+
{translateY: yAxisAtTop ? 0 : 50},
|
|
757
|
+
],
|
|
758
|
+
},
|
|
759
|
+
]}>
|
|
760
|
+
{label}
|
|
761
|
+
</Text>
|
|
762
|
+
) : null}
|
|
763
|
+
</View>
|
|
764
|
+
<View
|
|
765
|
+
style={[
|
|
766
|
+
styles.leftPart,
|
|
767
|
+
{backgroundColor: backgroundColor},
|
|
768
|
+
]}>
|
|
769
|
+
{hideRules ? null : (
|
|
770
|
+
<Rule
|
|
771
|
+
config={{
|
|
772
|
+
thickness: rulesThickness,
|
|
773
|
+
color: rulesColor,
|
|
774
|
+
width: horizontal
|
|
775
|
+
? props.width || totalWidth
|
|
776
|
+
: (props.width || totalWidth) + 11,
|
|
777
|
+
dashWidth: dashWidth,
|
|
778
|
+
dashGap: dashGap,
|
|
779
|
+
type: rulesType,
|
|
780
|
+
}}
|
|
781
|
+
/>
|
|
782
|
+
)}
|
|
783
|
+
</View>
|
|
784
|
+
</View>
|
|
785
|
+
)
|
|
786
|
+
})}
|
|
686
787
|
</>
|
|
687
788
|
);
|
|
688
789
|
};
|
|
@@ -975,7 +1076,7 @@ export const BarChart = (props: PropTypes) => {
|
|
|
975
1076
|
style={[
|
|
976
1077
|
styles.container,
|
|
977
1078
|
{
|
|
978
|
-
height: containerHeight,
|
|
1079
|
+
height: containerHeight + horizSectionsBelow.length * stepHeight,
|
|
979
1080
|
},
|
|
980
1081
|
props.width && {width: props.width},
|
|
981
1082
|
horizontal && {transform: [{rotate: '90deg'}, {translateY: -15}]},
|
|
@@ -995,8 +1096,9 @@ export const BarChart = (props: PropTypes) => {
|
|
|
995
1096
|
contentContainerStyle={[
|
|
996
1097
|
{
|
|
997
1098
|
// backgroundColor: 'yellow',
|
|
998
|
-
height: containerHeight + 130,
|
|
1099
|
+
height: containerHeight + 130 + horizSectionsBelow.length * stepHeight,
|
|
999
1100
|
paddingLeft: initialSpacing,
|
|
1101
|
+
paddingBottom:horizSectionsBelow.length * stepHeight,
|
|
1000
1102
|
alignItems: 'flex-end',
|
|
1001
1103
|
},
|
|
1002
1104
|
!props.width && {width: totalWidth},
|
|
@@ -1083,10 +1185,11 @@ export const BarChart = (props: PropTypes) => {
|
|
|
1083
1185
|
horizontal={horizontal}
|
|
1084
1186
|
intactTopLabel={intactTopLabel}
|
|
1085
1187
|
barBorderRadius={props.barBorderRadius}
|
|
1188
|
+
autoShiftLabels={autoShiftLabels}
|
|
1086
1189
|
/>
|
|
1087
1190
|
))}
|
|
1088
1191
|
</Fragment>
|
|
1089
1192
|
</ScrollView>
|
|
1090
1193
|
</View>
|
|
1091
1194
|
);
|
|
1092
|
-
};
|
|
1195
|
+
};
|
|
@@ -87,7 +87,7 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
87
87
|
const elevate = () => {
|
|
88
88
|
LayoutAnimation.configureNext({
|
|
89
89
|
duration: animationDuration,
|
|
90
|
-
update: {type: 'linear', property: '
|
|
90
|
+
update: {type: 'linear', property: 'scaleY'},
|
|
91
91
|
});
|
|
92
92
|
setHeight(props.height);
|
|
93
93
|
};
|
|
@@ -95,7 +95,7 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
95
95
|
const layoutAppear = () => {
|
|
96
96
|
LayoutAnimation.configureNext({
|
|
97
97
|
duration: Platform.OS == 'ios' ? animationDuration : 20,
|
|
98
|
-
create: {type: 'linear', property: '
|
|
98
|
+
create: {type: 'linear', property: 'scaleY'},
|
|
99
99
|
// update: { type: 'linear' }
|
|
100
100
|
});
|
|
101
101
|
setInitialRender(false);
|
|
@@ -237,4 +237,4 @@ const AnimatedBar = (props: animatedBarPropTypes) => {
|
|
|
237
237
|
);
|
|
238
238
|
};
|
|
239
239
|
|
|
240
|
-
export default AnimatedBar;
|
|
240
|
+
export default AnimatedBar;
|
|
@@ -20,6 +20,7 @@ type PropTypes = {
|
|
|
20
20
|
side: String;
|
|
21
21
|
horizontal: Boolean;
|
|
22
22
|
intactTopLabel: Boolean;
|
|
23
|
+
value: number;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
type TriangleProps = {
|
|
@@ -59,6 +60,7 @@ const ThreeDBar = (props: PropTypes) => {
|
|
|
59
60
|
const width = props.width;
|
|
60
61
|
const sideWidth = props.sideWidth;
|
|
61
62
|
const height = props.height;
|
|
63
|
+
const value = props.value;
|
|
62
64
|
|
|
63
65
|
const showGradient = props.showGradient || false;
|
|
64
66
|
const gradientColor = props.gradientColor || 'white';
|
|
@@ -160,12 +162,13 @@ const ThreeDBar = (props: PropTypes) => {
|
|
|
160
162
|
style={[
|
|
161
163
|
{
|
|
162
164
|
position: 'absolute',
|
|
163
|
-
top: width * -2,
|
|
165
|
+
top: value < 0 ? width * -1 : width * -2,
|
|
164
166
|
height: (width * 3) / 2,
|
|
165
167
|
width: width,
|
|
166
168
|
justifyContent: 'flex-end',
|
|
167
169
|
alignItems: 'center',
|
|
168
170
|
},
|
|
171
|
+
value < 0 && {transform:[{rotate:'180deg'}]},
|
|
169
172
|
props.horizontal &&
|
|
170
173
|
!props.intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
171
174
|
props.side === 'right'
|
|
@@ -182,4 +185,4 @@ const ThreeDBar = (props: PropTypes) => {
|
|
|
182
185
|
);
|
|
183
186
|
};
|
|
184
187
|
|
|
185
|
-
export default ThreeDBar;
|
|
188
|
+
export default ThreeDBar;
|