react-native-gifted-charts 1.4.63 → 1.4.65
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/README.md +1 -1
- package/dist/BarChart/Animated2DWithGradient.js +52 -92
- package/dist/BarChart/RenderBars.js +5 -5
- package/dist/BarChart/RenderStackBars.js +14 -25
- package/dist/BarChart/index.js +11 -5
- package/dist/Components/AnimatedThreeDBar/index.js +30 -56
- package/dist/Components/AnimatedThreeDBar/styles.d.ts +4 -3
- package/dist/Components/AnimatedThreeDBar/styles.js +4 -5
- package/dist/Components/BarAndLineChartsWrapper/index.js +9 -11
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +166 -114
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +1 -1
- package/dist/LineChart/LineChartBicolor.js +3 -3
- package/dist/LineChart/index.js +5 -9
- package/dist/PieChart/index.d.ts +1 -1
- package/dist/PieChart/index.js +8 -5
- package/dist/PieChart/main.js +2 -2
- package/dist/RadarChart/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Populati
|
|
|
28
28
|
|
|
29
29
|
- Plenty of features with minimal code
|
|
30
30
|
- Apply animations to your charts on load and on value change, just by adding a prop
|
|
31
|
-
- Smooth animations implemented using
|
|
31
|
+
- Smooth animations implemented using the `Animated` API (no external library used for animations)
|
|
32
32
|
- Clickable and scrollable
|
|
33
33
|
- Three-D and gradient effects
|
|
34
34
|
- Fully customizable (see the [props](docs/docs.md))
|
|
@@ -1,106 +1,66 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
-
import { useEffect,
|
|
19
|
-
import { View,
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { View, Text, Animated } from 'react-native';
|
|
20
4
|
import Svg, { Defs, Rect } from 'react-native-svg';
|
|
21
5
|
import Cap from '../Components/BarSpecificComponents/cap';
|
|
22
6
|
import LinearGradient from '../Components/common/LinearGradient';
|
|
23
|
-
if (Platform.OS === 'android') {
|
|
24
|
-
UIManager.setLayoutAnimationEnabledExperimental &&
|
|
25
|
-
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
26
|
-
}
|
|
27
7
|
var Animated2DWithGradient = function (props) {
|
|
28
8
|
var _a, _b;
|
|
29
|
-
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, bWidth = props.barWidth, barStyle = props.barStyle, item = props.item, index = props.index, opacity = props.opacity, animationDuration = props.animationDuration, noGradient = props.noGradient, noAnimation = props.noAnimation, barInnerComponent = props.barInnerComponent, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, commonStyleForBar = props.commonStyleForBar, barStyleWithBackground = props.barStyleWithBackground, yAxisOffset = props.yAxisOffset;
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
9
|
+
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, bWidth = props.barWidth, barStyle = props.barStyle, item = props.item, index = props.index, opacity = props.opacity, animationDuration = props.animationDuration, noGradient = props.noGradient, noAnimation = props.noAnimation, barInnerComponent = props.barInnerComponent, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, commonStyleForBar = props.commonStyleForBar, barStyleWithBackground = props.barStyleWithBackground, yAxisOffset = props.yAxisOffset, height = props.height;
|
|
10
|
+
var barWidth = (_a = item.barWidth) !== null && _a !== void 0 ? _a : bWidth; // setting width in state for animation purpose
|
|
11
|
+
var topLabelPosition = (item.barWidth || barWidth || 30) * -1;
|
|
12
|
+
var animatedHeight = useRef(new Animated.Value(0)).current; // initial height = 0
|
|
13
|
+
var animatedLabelHeight = useRef(new Animated.Value(height + topLabelPosition)).current;
|
|
14
|
+
var elevate = function () {
|
|
15
|
+
Animated.parallel([
|
|
16
|
+
Animated.timing(animatedHeight, {
|
|
17
|
+
toValue: height,
|
|
18
|
+
duration: animationDuration,
|
|
19
|
+
useNativeDriver: false,
|
|
20
|
+
}),
|
|
21
|
+
Animated.timing(animatedLabelHeight, {
|
|
22
|
+
toValue: topLabelPosition,
|
|
23
|
+
duration: animationDuration,
|
|
24
|
+
useNativeDriver: false,
|
|
25
|
+
}),
|
|
26
|
+
]).start();
|
|
27
|
+
};
|
|
33
28
|
useEffect(function () {
|
|
34
|
-
var _a;
|
|
35
29
|
if (!noAnimation) {
|
|
36
|
-
|
|
37
|
-
setTimeout(function () { return layoutAppear(); }, 20);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
elevate();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
setHeight(props.height);
|
|
45
|
-
setBarWidth((_a = item.barWidth) !== null && _a !== void 0 ? _a : bWidth);
|
|
30
|
+
elevate();
|
|
46
31
|
}
|
|
47
|
-
}, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
width: '100%',
|
|
77
|
-
height: noAnimation
|
|
78
|
-
? Math.max(props.minHeight, Math.abs(height))
|
|
79
|
-
: height,
|
|
80
|
-
},
|
|
81
|
-
item.barStyle || barStyle,
|
|
82
|
-
], children: [noGradient ? (_jsx(View, { style: barStyleWithBackground, children: props.cappedBars && item.value ? (_jsx(Cap, { capThicknessFromItem: item.capThickness, capThicknessFromProps: props.capThickness, capColorFromItem: item.capColor, capColorFromProps: props.capColor, capRadiusFromItem: item.capRadius, capRadiusFromProps: props.capRadius })) : null })) : (_jsx(LinearGradient, { style: commonStyleForBar, start: { x: 0, y: 0 }, end: { x: 1, y: 1 }, colors: [
|
|
83
|
-
item.gradientColor || props.gradientColor || 'white',
|
|
84
|
-
item.frontColor || props.frontColor || 'black',
|
|
85
|
-
], children: props.cappedBars && (_jsx(View, { style: {
|
|
86
|
-
position: 'absolute',
|
|
87
|
-
width: '100%',
|
|
88
|
-
height: item.capThickness === 0
|
|
89
|
-
? 0
|
|
90
|
-
: item.capThickness || props.capThickness || 6,
|
|
91
|
-
backgroundColor: item.capColor || props.capColor || 'black',
|
|
92
|
-
borderTopLeftRadius: item.capRadius === 0
|
|
93
|
-
? 0
|
|
94
|
-
: item.capRadius || props.capRadius || 0,
|
|
95
|
-
borderTopRightRadius: item.capRadius === 0
|
|
96
|
-
? 0
|
|
97
|
-
: item.capRadius || props.capRadius || 0,
|
|
98
|
-
} })) })), (item.barBackgroundPattern || barBackgroundPattern) && (_jsxs(Svg, { children: [_jsx(Defs, { children: item.barBackgroundPattern
|
|
99
|
-
? item.barBackgroundPattern()
|
|
100
|
-
: barBackgroundPattern === null || barBackgroundPattern === void 0 ? void 0 : barBackgroundPattern() }), _jsx(Rect, { stroke: "none", x: "1", y: "1", width: item.barWidth || barWidth || 30, height: noAnimation ? Math.abs(height) : height, fill: "url(#".concat(item.patternId || patternId, ")") })] })), barInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: barInnerComponent(item, index) })) : null] }) })), item.topLabelComponent || showValuesAsTopLabel ? (_jsx(View, { style: [
|
|
32
|
+
}, []);
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Animated.View, { style: [
|
|
34
|
+
{
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
bottom: 0,
|
|
37
|
+
width: barWidth,
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
height: noAnimation ? height : animatedHeight,
|
|
40
|
+
},
|
|
41
|
+
item.barStyle || barStyle,
|
|
42
|
+
], children: [noGradient ? (_jsx(View, { style: barStyleWithBackground, children: props.cappedBars && item.value ? (_jsx(Cap, { capThicknessFromItem: item.capThickness, capThicknessFromProps: props.capThickness, capColorFromItem: item.capColor, capColorFromProps: props.capColor, capRadiusFromItem: item.capRadius, capRadiusFromProps: props.capRadius })) : null })) : (_jsx(LinearGradient, { style: commonStyleForBar, start: { x: 0, y: 0 }, end: { x: 1, y: 1 }, colors: [
|
|
43
|
+
item.gradientColor || props.gradientColor || 'white',
|
|
44
|
+
item.frontColor || props.frontColor || 'black',
|
|
45
|
+
], children: props.cappedBars && (_jsx(View, { style: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
width: '100%',
|
|
48
|
+
height: item.capThickness === 0
|
|
49
|
+
? 0
|
|
50
|
+
: item.capThickness || props.capThickness || 6,
|
|
51
|
+
backgroundColor: item.capColor || props.capColor || 'black',
|
|
52
|
+
borderTopLeftRadius: item.capRadius === 0
|
|
53
|
+
? 0
|
|
54
|
+
: item.capRadius || props.capRadius || 0,
|
|
55
|
+
borderTopRightRadius: item.capRadius === 0
|
|
56
|
+
? 0
|
|
57
|
+
: item.capRadius || props.capRadius || 0,
|
|
58
|
+
} })) })), (item.barBackgroundPattern || barBackgroundPattern) && (_jsxs(Svg, { children: [_jsx(Defs, { children: item.barBackgroundPattern
|
|
59
|
+
? item.barBackgroundPattern()
|
|
60
|
+
: barBackgroundPattern === null || barBackgroundPattern === void 0 ? void 0 : barBackgroundPattern() }), _jsx(Rect, { stroke: "none", x: "1", y: "1", width: item.barWidth || barWidth || 30, height: noAnimation ? Math.abs(height) : height, fill: "url(#".concat(item.patternId || patternId, ")") })] })), barInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: barInnerComponent(item, index) })) : null] }), item.topLabelComponent || showValuesAsTopLabel ? (_jsx(Animated.View, { style: [
|
|
101
61
|
{
|
|
102
62
|
position: 'absolute',
|
|
103
|
-
top:
|
|
63
|
+
top: noAnimation ? topLabelPosition : animatedLabelHeight,
|
|
104
64
|
height: item.barWidth || barWidth || 30,
|
|
105
65
|
width: item.barWidth || barWidth || 30,
|
|
106
66
|
justifyContent: (props.horizontal && !intactTopLabel) || item.value < 0
|
|
@@ -145,10 +145,10 @@ var RenderBars = function (props) {
|
|
|
145
145
|
var barWrapperStyle = [
|
|
146
146
|
{
|
|
147
147
|
// overflow: 'visible',
|
|
148
|
-
opacity: highlightEnabled
|
|
149
|
-
isIndexSelected(highlightedBarIndex, -1)
|
|
150
|
-
? 1
|
|
151
|
-
isIndexSelected(highlightedBarIndex, index)
|
|
148
|
+
opacity: highlightEnabled
|
|
149
|
+
? isIndexSelected(highlightedBarIndex, -1)
|
|
150
|
+
? 1
|
|
151
|
+
: isIndexSelected(highlightedBarIndex, index)
|
|
152
152
|
? 1
|
|
153
153
|
: lowlightOpacity
|
|
154
154
|
: 1,
|
|
@@ -184,7 +184,7 @@ var RenderBars = function (props) {
|
|
|
184
184
|
backgroundColor: props.xAxisIndicesColor,
|
|
185
185
|
} })), isBarBelowXaxisAndInvisible ? null : isThreeD ? (_jsx(AnimatedThreeDBar, __assign({}, commonPropsFor2dAnd3dBars, { sideWidth: item.sideWidth ||
|
|
186
186
|
props.sideWidth ||
|
|
187
|
-
(item.barWidth || barWidth) / 2, side: side || 'left', sideColor: item.sideColor || props.sideColor || '', topColor: item.topColor || props.topColor || '', horizontal: horizontal, isAnimated: isAnimated, animationDuration: animationDuration || 800, selectedIndex: selectedIndex }))) : item.showGradient || props.showGradient ? (isAnimated ? (animated2DWithGradient(false, false)) : (animated2DWithGradient(false, true))) : isAnimated ? (animated2DWithGradient(true, false)) : (animated2DWithGradient(true, true)), isAnimated
|
|
187
|
+
(item.barWidth || barWidth) / 2, side: side || 'left', sideColor: item.sideColor || props.sideColor || '', topColor: item.topColor || props.topColor || '', horizontal: horizontal, isAnimated: isAnimated, animationDuration: animationDuration || 800, selectedIndex: selectedIndex, containerHeight: containerHeight || 200 }))) : item.showGradient || props.showGradient ? (isAnimated ? (animated2DWithGradient(false, false)) : (animated2DWithGradient(false, true))) : isAnimated ? (animated2DWithGradient(true, false)) : (animated2DWithGradient(true, true)), isAnimated
|
|
188
188
|
? renderAnimatedLabel(false, label, labelTextStyle, item.value)
|
|
189
189
|
: renderLabel(false, label, labelTextStyle, item.value), secondaryXAxis
|
|
190
190
|
? isAnimated
|
|
@@ -10,16 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
import { useEffect } from 'react';
|
|
14
|
-
import { View, TouchableOpacity, Text,
|
|
13
|
+
import { useEffect, useRef } from 'react';
|
|
14
|
+
import { View, TouchableOpacity, Text, Animated } from 'react-native';
|
|
15
15
|
import Svg, { Defs, Rect } from 'react-native-svg';
|
|
16
16
|
import LinearGradient from '../Components/common/LinearGradient';
|
|
17
17
|
import { useRenderStackBars, BarDefaults, } from 'gifted-charts-core';
|
|
18
18
|
import Tooltip from '../Components/BarSpecificComponents/tooltip';
|
|
19
|
-
if (Platform.OS === 'android') {
|
|
20
|
-
UIManager.setLayoutAnimationEnabledExperimental &&
|
|
21
|
-
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
22
|
-
}
|
|
23
19
|
var RenderStackBars = function (props) {
|
|
24
20
|
var _a;
|
|
25
21
|
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, stackData = props.stackData, item = props.item, index = props.index, containerHeight = props.containerHeight, spacing = props.spacing, rotateLabel = props.rotateLabel, label = props.label, labelTextStyle = props.labelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, activeOpacity = props.activeOpacity, _b = props.animationDuration, animationDuration = _b === void 0 ? BarDefaults.animationDuration : _b, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, stackBorderRadius = props.stackBorderRadius, stackBorderTopLeftRadius = props.stackBorderTopLeftRadius, stackBorderTopRightRadius = props.stackBorderTopRightRadius, stackBorderBottomLeftRadius = props.stackBorderBottomLeftRadius, stackBorderBottomRightRadius = props.stackBorderBottomRightRadius, showValuesAsTopLabel = props.showValuesAsTopLabel, _c = props.autoShiftLabelsForNegativeStacks, autoShiftLabelsForNegativeStacks = _c === void 0 ? true : _c, _d = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _d === void 0 ? 0 : _d, horizontal = props.horizontal, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue, barMarginBottom = props.barMarginBottom, highlightEnabled = props.highlightEnabled, highlightedBarIndex = props.highlightedBarIndex, lowlightOpacity = props.lowlightOpacity, stackHighlightEnabled = props.stackHighlightEnabled, selectedStackIndex = props.selectedStackIndex, setSelectedStackIndex = props.setSelectedStackIndex;
|
|
@@ -71,26 +67,19 @@ var RenderStackBars = function (props) {
|
|
|
71
67
|
: {},
|
|
72
68
|
], children: item.labelComponent ? (item.labelComponent()) : (_jsx(Text, { style: [labelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label || '' })) }));
|
|
73
69
|
};
|
|
74
|
-
|
|
75
|
-
if (!noAnimation) {
|
|
76
|
-
layoutAppear();
|
|
77
|
-
}
|
|
78
|
-
}, [totalHeight]);
|
|
70
|
+
var animatedHeight = useRef(new Animated.Value(0)).current;
|
|
79
71
|
var elevate = function () {
|
|
80
|
-
|
|
72
|
+
Animated.timing(animatedHeight, {
|
|
73
|
+
toValue: totalHeight,
|
|
81
74
|
duration: animationDuration,
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
setHeight(totalHeight);
|
|
85
|
-
};
|
|
86
|
-
var layoutAppear = function () {
|
|
87
|
-
LayoutAnimation.configureNext({
|
|
88
|
-
duration: Platform.OS == 'ios' ? animationDuration : 20,
|
|
89
|
-
create: { type: 'linear', property: 'opacity' },
|
|
90
|
-
update: { type: 'linear', property: 'scaleXY' },
|
|
91
|
-
});
|
|
92
|
-
setTimeout(function () { return elevate(); }, Platform.OS == 'ios' ? 10 : 100);
|
|
75
|
+
useNativeDriver: false,
|
|
76
|
+
}).start();
|
|
93
77
|
};
|
|
78
|
+
useEffect(function () {
|
|
79
|
+
if (!noAnimation) {
|
|
80
|
+
elevate();
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
94
83
|
var static2DSimple = function () {
|
|
95
84
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
96
85
|
var remainingBarMarginBottom = barMarginBottom;
|
|
@@ -180,10 +169,10 @@ var RenderStackBars = function (props) {
|
|
|
180
169
|
], children: showValuesAsTopLabel ? (_jsx(Text, { style: (_j = item.topLabelTextStyle) !== null && _j !== void 0 ? _j : props.topLabelTextStyle, children: stackData[index].stacks.reduce(function (acc, stack) { return acc + stack.value; }, 0) })) : ((_k = item.topLabelComponent) === null || _k === void 0 ? void 0 : _k.call(item)) }))] }));
|
|
181
170
|
};
|
|
182
171
|
var barWrapper = function () {
|
|
183
|
-
return noAnimation ? (static2DSimple()) : (_jsx(View, { style: {
|
|
172
|
+
return noAnimation ? (static2DSimple()) : (_jsx(Animated.View, { style: {
|
|
184
173
|
position: 'absolute',
|
|
185
174
|
bottom: 0,
|
|
186
|
-
height:
|
|
175
|
+
height: animatedHeight,
|
|
187
176
|
width: '100%',
|
|
188
177
|
}, children: static2DSimple() }));
|
|
189
178
|
};
|
package/dist/BarChart/index.js
CHANGED
|
@@ -22,14 +22,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
25
|
-
import { Animated, Easing, Pressable, View } from 'react-native';
|
|
25
|
+
import { Animated, Easing, I18nManager, Pressable, View, } from 'react-native';
|
|
26
26
|
import RenderBars from './RenderBars';
|
|
27
27
|
import RenderStackBars from './RenderStackBars';
|
|
28
28
|
import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
|
|
29
|
-
import { useBarChart } from 'gifted-charts-core';
|
|
29
|
+
import { useBarAndLineChartsWrapper, useBarChart, } from 'gifted-charts-core';
|
|
30
30
|
import { StripAndLabel } from '../Components/common/StripAndLabel';
|
|
31
31
|
import { Pointer } from '../Components/common/Pointer';
|
|
32
32
|
import { screenWidth } from '../utils';
|
|
33
|
+
import RenderLineInBarChart from '../Components/BarAndLineChartsWrapper/renderLineInBarChart';
|
|
33
34
|
export var BarChart = function (props) {
|
|
34
35
|
var _a, _b, _c;
|
|
35
36
|
var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
@@ -46,7 +47,8 @@ export var BarChart = function (props) {
|
|
|
46
47
|
bounces: props.bounces,
|
|
47
48
|
overScrollMode: (_b = props.overScrollMode) !== null && _b !== void 0 ? _b : 'auto',
|
|
48
49
|
};
|
|
49
|
-
var _d = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue, opacityValue: opacityValue, parentWidth: (_c = props.parentWidth) !== null && _c !== void 0 ? _c : screenWidth })), lineConfig = _d.lineConfig, hidePointer1 = _d.hidePointer1, pointerItem = _d.pointerItem, pointerY = _d.pointerY, pointerConfig = _d.pointerConfig, pointerColor = _d.pointerColor, pointerX = _d.pointerX, pointerComponent = _d.pointerComponent, pointerHeight = _d.pointerHeight, pointerRadius = _d.pointerRadius, pointerWidth = _d.pointerWidth, autoAdjustPointerLabelPosition = _d.autoAdjustPointerLabelPosition, pointerLabelWidth = _d.pointerLabelWidth, activatePointersOnLongPress = _d.activatePointersOnLongPress, yAxisLabelWidth = _d.yAxisLabelWidth, shiftPointerLabelX = _d.shiftPointerLabelX, pointerLabelHeight = _d.pointerLabelHeight, pointerStripUptoDataPoint = _d.pointerStripUptoDataPoint, pointerStripHeight = _d.pointerStripHeight, shiftPointerLabelY = _d.shiftPointerLabelY, showPointerStrip = _d.showPointerStrip, pointerStripWidth = _d.pointerStripWidth, containerHeight = _d.containerHeight, xAxisThickness = _d.xAxisThickness, pointerStripColor = _d.pointerStripColor, pointerEvents = _d.pointerEvents, setResponderStartTime = _d.setResponderStartTime, setPointerY = _d.setPointerY, setPointerItem = _d.setPointerItem, initialSpacing = _d.initialSpacing, spacing = _d.spacing, data = _d.data, barWidth = _d.barWidth, setPointerX = _d.setPointerX, pointerIndex = _d.pointerIndex, setPointerIndex = _d.setPointerIndex, maxValue = _d.maxValue, responderStartTime = _d.responderStartTime, setResponderActive = _d.setResponderActive, activatePointersDelay = _d.activatePointersDelay, persistPointer = _d.persistPointer, pointerVanishDelay = _d.pointerVanishDelay, containerHeightIncludingBelowXAxis = _d.containerHeightIncludingBelowXAxis, extendedContainerHeight = _d.extendedContainerHeight, totalWidth = _d.totalWidth, stripBehindBars = _d.stripBehindBars, noOfSectionsBelowXAxis = _d.noOfSectionsBelowXAxis, stepHeight = _d.stepHeight, xAxisLabelsVerticalShift = _d.xAxisLabelsVerticalShift, labelsExtraHeight = _d.labelsExtraHeight, stripOverPointer = _d.stripOverPointer, pointerLabelComponent = _d.pointerLabelComponent, selectedIndex = _d.selectedIndex, setSelectedIndex = _d.setSelectedIndex, selectedStackIndex = _d.selectedStackIndex, setSelectedStackIndex = _d.setSelectedStackIndex, isAnimated = _d.isAnimated, animationDuration = _d.animationDuration, side = _d.side, labelWidth = _d.labelWidth, isThreeD = _d.isThreeD, animatedHeight = _d.animatedHeight, appearingOpacity = _d.appearingOpacity, autoShiftLabels = _d.autoShiftLabels, getPropsCommonForBarAndStack = _d.getPropsCommonForBarAndStack, barAndLineChartsWrapperProps = _d.barAndLineChartsWrapperProps, autoShiftLabelsForNegativeStacks = _d.autoShiftLabelsForNegativeStacks;
|
|
50
|
+
var _d = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue, opacityValue: opacityValue, parentWidth: (_c = props.parentWidth) !== null && _c !== void 0 ? _c : screenWidth })), lineConfig = _d.lineConfig, hidePointer1 = _d.hidePointer1, pointerItem = _d.pointerItem, pointerY = _d.pointerY, pointerConfig = _d.pointerConfig, pointerColor = _d.pointerColor, pointerX = _d.pointerX, pointerComponent = _d.pointerComponent, pointerHeight = _d.pointerHeight, pointerRadius = _d.pointerRadius, pointerWidth = _d.pointerWidth, autoAdjustPointerLabelPosition = _d.autoAdjustPointerLabelPosition, pointerLabelWidth = _d.pointerLabelWidth, activatePointersOnLongPress = _d.activatePointersOnLongPress, yAxisLabelWidth = _d.yAxisLabelWidth, shiftPointerLabelX = _d.shiftPointerLabelX, pointerLabelHeight = _d.pointerLabelHeight, pointerStripUptoDataPoint = _d.pointerStripUptoDataPoint, pointerStripHeight = _d.pointerStripHeight, shiftPointerLabelY = _d.shiftPointerLabelY, showPointerStrip = _d.showPointerStrip, pointerStripWidth = _d.pointerStripWidth, containerHeight = _d.containerHeight, xAxisThickness = _d.xAxisThickness, pointerStripColor = _d.pointerStripColor, pointerEvents = _d.pointerEvents, setResponderStartTime = _d.setResponderStartTime, setPointerY = _d.setPointerY, setPointerItem = _d.setPointerItem, initialSpacing = _d.initialSpacing, spacing = _d.spacing, data = _d.data, barWidth = _d.barWidth, setPointerX = _d.setPointerX, pointerIndex = _d.pointerIndex, setPointerIndex = _d.setPointerIndex, maxValue = _d.maxValue, responderStartTime = _d.responderStartTime, setResponderActive = _d.setResponderActive, activatePointersDelay = _d.activatePointersDelay, persistPointer = _d.persistPointer, pointerVanishDelay = _d.pointerVanishDelay, containerHeightIncludingBelowXAxis = _d.containerHeightIncludingBelowXAxis, extendedContainerHeight = _d.extendedContainerHeight, totalWidth = _d.totalWidth, stripBehindBars = _d.stripBehindBars, noOfSectionsBelowXAxis = _d.noOfSectionsBelowXAxis, stepHeight = _d.stepHeight, xAxisLabelsVerticalShift = _d.xAxisLabelsVerticalShift, labelsExtraHeight = _d.labelsExtraHeight, stripOverPointer = _d.stripOverPointer, pointerLabelComponent = _d.pointerLabelComponent, selectedIndex = _d.selectedIndex, setSelectedIndex = _d.setSelectedIndex, selectedStackIndex = _d.selectedStackIndex, setSelectedStackIndex = _d.setSelectedStackIndex, isAnimated = _d.isAnimated, animationDuration = _d.animationDuration, side = _d.side, labelWidth = _d.labelWidth, isThreeD = _d.isThreeD, animatedHeight = _d.animatedHeight, appearingOpacity = _d.appearingOpacity, autoShiftLabels = _d.autoShiftLabels, getPropsCommonForBarAndStack = _d.getPropsCommonForBarAndStack, barAndLineChartsWrapperProps = _d.barAndLineChartsWrapperProps, autoShiftLabelsForNegativeStacks = _d.autoShiftLabelsForNegativeStacks, showLine = _d.showLine, points2 = _d.points2;
|
|
51
|
+
var _e = useBarAndLineChartsWrapper(__assign(__assign({}, barAndLineChartsWrapperProps), { isRTL: I18nManager.isRTL })), lineInBarChartProps = _e.lineInBarChartProps, lineInBarChartProps2 = _e.lineInBarChartProps2;
|
|
50
52
|
var stackData = barAndLineChartsWrapperProps.stackData;
|
|
51
53
|
var labelsAppear = useCallback(function () {
|
|
52
54
|
opacityValue.setValue(0);
|
|
@@ -199,12 +201,16 @@ export var BarChart = function (props) {
|
|
|
199
201
|
height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
200
202
|
bottom: xAxisLabelsVerticalShift,
|
|
201
203
|
width: totalWidth,
|
|
202
|
-
}, children: renderStripAndLabel(null) })) : null, renderChart(),
|
|
204
|
+
}, children: renderStripAndLabel(null) })) : null, renderChart(),
|
|
205
|
+
// Only For Bar Charts-
|
|
206
|
+
showLine ? _jsx(RenderLineInBarChart, __assign({}, lineInBarChartProps)) : null,
|
|
207
|
+
// Only For Bar Charts-
|
|
208
|
+
showLine && (points2 === null || points2 === void 0 ? void 0 : points2.length) ? (_jsx(RenderLineInBarChart, __assign({}, lineInBarChartProps2))) : null, pointerX > 0 ? (_jsxs(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: {
|
|
203
209
|
position: 'absolute',
|
|
204
210
|
height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
205
211
|
bottom: xAxisLabelsVerticalShift,
|
|
206
212
|
width: totalWidth,
|
|
207
|
-
zIndex:
|
|
213
|
+
zIndex: 200000,
|
|
208
214
|
}, children: [!stripOverPointer &&
|
|
209
215
|
!stripBehindBars &&
|
|
210
216
|
renderStripAndLabel(null), renderPointer(1), stripOverPointer &&
|
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
import { useEffect,
|
|
19
|
-
import { View, StyleSheet,
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { View, StyleSheet, Text, Animated } from 'react-native';
|
|
20
4
|
import Svg, { Defs, Rect } from 'react-native-svg';
|
|
21
5
|
import { styles } from './styles';
|
|
22
|
-
import LinearGradient from
|
|
6
|
+
import LinearGradient from '../common/LinearGradient';
|
|
23
7
|
import { useAnimatedThreeDBar, } from 'gifted-charts-core';
|
|
24
|
-
if (Platform.OS === 'android') {
|
|
25
|
-
UIManager.setLayoutAnimationEnabledExperimental &&
|
|
26
|
-
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
27
|
-
}
|
|
28
8
|
var TriangleCorner = function (props) {
|
|
29
9
|
return (_jsx(View, { style: [
|
|
30
10
|
triangleStyles.triangleCorner,
|
|
@@ -48,41 +28,30 @@ var triangleStyles = StyleSheet.create({
|
|
|
48
28
|
});
|
|
49
29
|
var AnimatedThreeDBar = function (props) {
|
|
50
30
|
var _a;
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
if (isAnimated) {
|
|
57
|
-
if (initialRender) {
|
|
58
|
-
setTimeout(function () {
|
|
59
|
-
layoutAppear();
|
|
60
|
-
}, 20);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
elevate();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, [props.height]);
|
|
31
|
+
var height = props.height, side = props.side;
|
|
32
|
+
var isAnimated = props.isAnimated, animationDuration = props.animationDuration, item = props.item, index = props.index, barWidth = props.barWidth, sideWidth = props.sideWidth, barStyle = props.barStyle, barBackgroundPattern = props.barBackgroundPattern, barInnerComponent = props.barInnerComponent, patternId = props.patternId, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, containerHeight = props.containerHeight;
|
|
33
|
+
var _b = useAnimatedThreeDBar(props), showGradient = _b.showGradient, gradientColor = _b.gradientColor, frontColor = _b.frontColor, sideColor = _b.sideColor, topColor = _b.topColor, opacity = _b.opacity;
|
|
34
|
+
var animatedHeight = useRef(new Animated.Value(0)).current;
|
|
67
35
|
var elevate = function () {
|
|
68
|
-
|
|
36
|
+
Animated.timing(animatedHeight, {
|
|
37
|
+
toValue: height,
|
|
69
38
|
duration: animationDuration,
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
setHeight(props.height);
|
|
39
|
+
useNativeDriver: false,
|
|
40
|
+
}).start();
|
|
73
41
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
setInitialRender(false);
|
|
81
|
-
setTimeout(function () { return elevate(); }, Platform.OS == 'ios' ? 10 : 100);
|
|
82
|
-
};
|
|
83
|
-
return (_jsx(View, { style: styles.container, children: !initialRender && (_jsxs(View, { style: [
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
if (isAnimated) {
|
|
44
|
+
elevate();
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
return (_jsx(View, { style: [styles.container, { height: containerHeight }], children: _jsxs(Animated.View, { style: [
|
|
84
48
|
styles.row,
|
|
85
|
-
{
|
|
49
|
+
{
|
|
50
|
+
height: isAnimated ? animatedHeight : height,
|
|
51
|
+
opacity: opacity,
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
bottom: 0,
|
|
54
|
+
},
|
|
86
55
|
props.side === 'right' && { transform: [{ rotateY: '180deg' }] },
|
|
87
56
|
], children: [props.height ? (_jsxs(_Fragment, { children: [_jsx(View, { style: { position: 'absolute', top: sideWidth / -2 }, children: _jsx(TriangleCorner, { color: topColor, width: sideWidth, style: { transform: [{ rotate: '90deg' }], opacity: opacity } }) }), _jsx(View, { style: { position: 'absolute', top: sideWidth / -2 }, children: _jsx(View, { style: {
|
|
88
57
|
width: barWidth,
|
|
@@ -99,7 +68,11 @@ var AnimatedThreeDBar = function (props) {
|
|
|
99
68
|
height: height - sideWidth / 2, //animatedSideHeight
|
|
100
69
|
backgroundColor: sideColor,
|
|
101
70
|
opacity: opacity,
|
|
102
|
-
} }), _jsx(TriangleCorner, { color: height ? sideColor : 'transparent', width: sideWidth + 1, style: {
|
|
71
|
+
} }), _jsx(TriangleCorner, { color: height ? sideColor : 'transparent', width: sideWidth + 1, style: {
|
|
72
|
+
transform: [{ rotate: '90deg' }],
|
|
73
|
+
opacity: opacity,
|
|
74
|
+
right: -0.5,
|
|
75
|
+
} })] }), _jsxs(View, { style: [
|
|
103
76
|
{
|
|
104
77
|
width: barWidth,
|
|
105
78
|
height: height, //animatedHeight
|
|
@@ -114,6 +87,7 @@ var AnimatedThreeDBar = function (props) {
|
|
|
114
87
|
{
|
|
115
88
|
position: 'absolute',
|
|
116
89
|
top: barWidth * -2,
|
|
90
|
+
marginLeft: side === 'right' ? 0 : -Math.min(barWidth / 2 - 4, 8),
|
|
117
91
|
height: (barWidth * 3) / 2,
|
|
118
92
|
width: (barWidth * 3) / 2,
|
|
119
93
|
justifyContent: 'flex-end',
|
|
@@ -124,6 +98,6 @@ var AnimatedThreeDBar = function (props) {
|
|
|
124
98
|
!intactTopLabel && { transform: [{ rotate: '270deg' }] },
|
|
125
99
|
props.side === 'right' && { transform: [{ rotateY: '180deg' }] },
|
|
126
100
|
topLabelContainerStyle !== null && topLabelContainerStyle !== void 0 ? topLabelContainerStyle : item.topLabelContainerStyle,
|
|
127
|
-
], children: showValuesAsTopLabel ? (_jsx(Text, { style: topLabelTextStyle, children: item.value })) : ((_a = item.topLabelComponent) === null || _a === void 0 ? void 0 : _a.call(item)) }))] })
|
|
101
|
+
], children: showValuesAsTopLabel ? (_jsx(Text, { style: topLabelTextStyle, children: item.value })) : ((_a = item.topLabelComponent) === null || _a === void 0 ? void 0 : _a.call(item)) }))] }) }));
|
|
128
102
|
};
|
|
129
103
|
export default AnimatedThreeDBar;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
export var styles = StyleSheet.create({
|
|
3
3
|
container: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
alignItems: 'center',
|
|
4
|
+
width: '150%',
|
|
5
|
+
position: 'absolute',
|
|
6
|
+
bottom: 0,
|
|
7
|
+
overflow: 'hidden',
|
|
9
8
|
},
|
|
10
9
|
row: {
|
|
11
10
|
flexDirection: 'row',
|
|
@@ -11,23 +11,24 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Fragment, useEffect } from 'react';
|
|
14
|
-
import { View, ScrollView, StyleSheet, I18nManager } from 'react-native';
|
|
14
|
+
import { View, ScrollView, StyleSheet, I18nManager, } from 'react-native';
|
|
15
15
|
import { renderHorizSections } from './renderHorizSections';
|
|
16
|
-
import RenderLineInBarChart from './renderLineInBarChart';
|
|
17
16
|
import RenderVerticalLines from './renderVerticalLines';
|
|
18
17
|
import { chartTypes, yAxisSides, useBarAndLineChartsWrapper, } from 'gifted-charts-core';
|
|
19
18
|
var isCloseToRight = function (_a, endReachedOffset) {
|
|
20
19
|
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
21
|
-
return layoutMeasurement.width + contentOffset.x >=
|
|
20
|
+
return (layoutMeasurement.width + contentOffset.x >=
|
|
21
|
+
contentSize.width - endReachedOffset);
|
|
22
22
|
};
|
|
23
23
|
var isCloseToLeft = function (_a, endReachedOffset) {
|
|
24
24
|
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
25
|
-
return layoutMeasurement.width + contentOffset.x <=
|
|
25
|
+
return (layoutMeasurement.width + contentOffset.x <=
|
|
26
|
+
contentSize.width - endReachedOffset);
|
|
26
27
|
};
|
|
27
28
|
var BarAndLineChartsWrapper = function (props) {
|
|
28
29
|
var _a, _b, _c, _d, _e;
|
|
29
|
-
var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, stepHeight = props.stepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, scrollRef = props.scrollRef, initialSpacing = props.initialSpacing, data = props.data, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, disableScroll = props.disableScroll, showScrollIndicator = props.showScrollIndicator, scrollToEnd = props.scrollToEnd, scrollToIndex = props.scrollToIndex, scrollAnimation = props.scrollAnimation, indicatorColor = props.indicatorColor, spacing = props.spacing,
|
|
30
|
-
var _g = useBarAndLineChartsWrapper(__assign(__assign({}, props), { isRTL: I18nManager.isRTL })), containerHeightIncludingBelowXAxis = _g.containerHeightIncludingBelowXAxis, xAxisLabelsVerticalShift = _g.xAxisLabelsVerticalShift, trimYAxisAtTop = _g.trimYAxisAtTop, yAxisExtraHeight = _g.yAxisExtraHeight, overflowTop = _g.overflowTop, xAxisLabelsHeight = _g.xAxisLabelsHeight, xAxisTextNumberOfLines = _g.xAxisTextNumberOfLines, actualContainerWidth = _g.actualContainerWidth, transformForHorizontal = _g.transformForHorizontal, horizSectionProps = _g.horizSectionProps, referenceLinesOverChartContent = _g.referenceLinesOverChartContent, setCanMomentum = _g.setCanMomentum, isCloseToStart = _g.isCloseToStart, isCloseToEnd = _g.isCloseToEnd, canMomentum = _g.canMomentum, yAxisAtTop = _g.yAxisAtTop, yAxisThickness = _g.yAxisThickness, yAxisSide = _g.yAxisSide, showVerticalLines = _g.showVerticalLines, verticalLinesProps = _g.verticalLinesProps
|
|
30
|
+
var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, stepHeight = props.stepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, scrollRef = props.scrollRef, initialSpacing = props.initialSpacing, data = props.data, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, disableScroll = props.disableScroll, showScrollIndicator = props.showScrollIndicator, scrollToEnd = props.scrollToEnd, scrollToIndex = props.scrollToIndex, scrollAnimation = props.scrollAnimation, indicatorColor = props.indicatorColor, spacing = props.spacing, renderChartContent = props.renderChartContent, remainingScrollViewProps = props.remainingScrollViewProps, endSpacing = props.endSpacing, hideAxesAndRules = props.hideAxesAndRules, showXAxisIndices = props.showXAxisIndices, xAxisIndicesHeight = props.xAxisIndicesHeight, xAxisIndicesWidth = props.xAxisIndicesWidth, xAxisIndicesColor = props.xAxisIndicesColor, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, onEndReached = props.onEndReached, onStartReached = props.onStartReached, endReachedOffset = props.endReachedOffset, onMomentumScrollEnd = props.onMomentumScrollEnd, onScrollEndDrag = props.onScrollEndDrag, nestedScrollEnabled = props.nestedScrollEnabled, _f = props.extraWidthDueToDataPoint, extraWidthDueToDataPoint = _f === void 0 ? 0 : _f;
|
|
31
|
+
var _g = useBarAndLineChartsWrapper(__assign(__assign({}, props), { isRTL: I18nManager.isRTL })), containerHeightIncludingBelowXAxis = _g.containerHeightIncludingBelowXAxis, xAxisLabelsVerticalShift = _g.xAxisLabelsVerticalShift, trimYAxisAtTop = _g.trimYAxisAtTop, yAxisExtraHeight = _g.yAxisExtraHeight, overflowTop = _g.overflowTop, xAxisLabelsHeight = _g.xAxisLabelsHeight, xAxisTextNumberOfLines = _g.xAxisTextNumberOfLines, actualContainerWidth = _g.actualContainerWidth, transformForHorizontal = _g.transformForHorizontal, horizSectionProps = _g.horizSectionProps, referenceLinesOverChartContent = _g.referenceLinesOverChartContent, setCanMomentum = _g.setCanMomentum, isCloseToStart = _g.isCloseToStart, isCloseToEnd = _g.isCloseToEnd, canMomentum = _g.canMomentum, yAxisAtTop = _g.yAxisAtTop, yAxisThickness = _g.yAxisThickness, yAxisSide = _g.yAxisSide, showVerticalLines = _g.showVerticalLines, verticalLinesProps = _g.verticalLinesProps;
|
|
31
32
|
useEffect(function () {
|
|
32
33
|
if (pointerConfig && getPointerProps) {
|
|
33
34
|
getPointerProps({ pointerIndex: pointerIndex, pointerX: pointerX, pointerY: pointerY });
|
|
@@ -126,10 +127,6 @@ var BarAndLineChartsWrapper = function (props) {
|
|
|
126
127
|
});
|
|
127
128
|
}
|
|
128
129
|
} }, remainingScrollViewProps, { children: _jsxs(Fragment, { children: [showVerticalLines ? (_jsx(RenderVerticalLines, __assign({}, verticalLinesProps))) : null,
|
|
129
|
-
// Only For Bar Charts-
|
|
130
|
-
showLine ? _jsx(RenderLineInBarChart, __assign({}, lineInBarChartProps)) : null,
|
|
131
|
-
// Only For Bar Charts-
|
|
132
|
-
showLine && (points2 === null || points2 === void 0 ? void 0 : points2.length) ? (_jsx(RenderLineInBarChart, __assign({}, lineInBarChartProps2))) : null,
|
|
133
130
|
// Only For Line Charts-
|
|
134
131
|
chartType === chartTypes.LINE &&
|
|
135
132
|
data.map(function (item, index) {
|
|
@@ -145,6 +142,7 @@ var BarAndLineChartsWrapper = function (props) {
|
|
|
145
142
|
} }, index + '' + item.value)) : null;
|
|
146
143
|
}), renderChartContent(containerHeightIncludingBelowXAxis)] }) })), referenceLinesOverChartContent
|
|
147
144
|
? renderHorizSections(__assign(__assign({}, horizSectionProps), { onlyReferenceLines: true }))
|
|
148
|
-
: null
|
|
145
|
+
: null, horizSectionProps.floatingYAxisLabels &&
|
|
146
|
+
renderHorizSections(__assign(__assign({}, horizSectionProps), { onlyLabels: true }))] }));
|
|
149
147
|
};
|
|
150
148
|
export default BarAndLineChartsWrapper;
|
|
@@ -30,7 +30,7 @@ import { styles } from '../../LineChart/styles';
|
|
|
30
30
|
import { getHorizSectionVals, yAxisSides, chartTypes, } from 'gifted-charts-core';
|
|
31
31
|
export var renderHorizSections = function (props) {
|
|
32
32
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
33
|
-
var chartType = props.chartType, width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, xAxisThickness = props.xAxisThickness, xAxisColor = props.xAxisColor, xAxisLength = props.xAxisLength, xAxisType = props.xAxisType, dashWidth = props.dashWidth, dashGap = props.dashGap, backgroundColor = props.backgroundColor, hideRules = props.hideRules, rulesLength = props.rulesLength, rulesType = props.rulesType, rulesThickness = props.rulesThickness, rulesColor = props.rulesColor, rulesConfigArray = props.rulesConfigArray, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisTextStyle = props.yAxisTextStyle, rotateYAxisTexts = props.rotateYAxisTexts, rtl = props.rtl, containerHeight = props.containerHeight, maxValue = props.maxValue, yAxisOffset = props.yAxisOffset, horizontal = props.horizontal, yAxisAtTop = props.yAxisAtTop, secondaryYAxis = props.secondaryYAxis, onlyReferenceLines = props.onlyReferenceLines, renderReferenceLines = props.renderReferenceLines, secondaryXAxis = props.secondaryXAxis, customBackground = props.customBackground;
|
|
33
|
+
var chartType = props.chartType, width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, xAxisThickness = props.xAxisThickness, xAxisColor = props.xAxisColor, xAxisLength = props.xAxisLength, xAxisType = props.xAxisType, dashWidth = props.dashWidth, dashGap = props.dashGap, backgroundColor = props.backgroundColor, hideRules = props.hideRules, rulesLength = props.rulesLength, rulesType = props.rulesType, rulesThickness = props.rulesThickness, rulesColor = props.rulesColor, rulesConfigArray = props.rulesConfigArray, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisTextStyle = props.yAxisTextStyle, rotateYAxisTexts = props.rotateYAxisTexts, rtl = props.rtl, containerHeight = props.containerHeight, maxValue = props.maxValue, yAxisOffset = props.yAxisOffset, horizontal = props.horizontal, yAxisAtTop = props.yAxisAtTop, secondaryYAxis = props.secondaryYAxis, onlyReferenceLines = props.onlyReferenceLines, onlyLabels = props.onlyLabels, renderReferenceLines = props.renderReferenceLines, secondaryXAxis = props.secondaryXAxis, customBackground = props.customBackground, allowFontScaling = props.allowFontScaling;
|
|
34
34
|
var _k = getHorizSectionVals(props), secondaryYAxisConfig = _k.secondaryYAxisConfig, horizSections = _k.horizSections, yAxisExtraHeightAtTop = _k.yAxisExtraHeightAtTop, secondaryHorizSections = _k.secondaryHorizSections, showReferenceLine1 = _k.showReferenceLine1, referenceLine1Config = _k.referenceLine1Config, referenceLine1Position = _k.referenceLine1Position, showReferenceLine2 = _k.showReferenceLine2, referenceLine2Config = _k.referenceLine2Config, referenceLine2Position = _k.referenceLine2Position, showReferenceLine3 = _k.showReferenceLine3, referenceLine3Config = _k.referenceLine3Config, referenceLine3Position = _k.referenceLine3Position, horizSectionsBelow = _k.horizSectionsBelow, secondaryHorizSectionsBelow = _k.secondaryHorizSectionsBelow, getLabelTexts = _k.getLabelTexts, getLabelTextsForSecondaryYAxis = _k.getLabelTextsForSecondaryYAxis;
|
|
35
35
|
var secondaryYAxisExtraHeightAtBottom = 10;
|
|
36
36
|
var negativeSectionsCountDiffPrimaryVsSecondary = secondaryHorizSectionsBelow.length - horizSectionsBelow.length;
|
|
@@ -150,7 +150,7 @@ export var renderHorizSections = function (props) {
|
|
|
150
150
|
position: 'absolute',
|
|
151
151
|
left: ((_h = secondaryYAxisConfig.yAxisIndicesWidth) !== null && _h !== void 0 ? _h : 0) / -2,
|
|
152
152
|
backgroundColor: secondaryYAxisConfig.yAxisIndicesColor,
|
|
153
|
-
} })) : null, _jsx(Text, { numberOfLines: secondaryYAxisConfig.yAxisTextNumberOfLines, ellipsizeMode: 'clip', style: [
|
|
153
|
+
} })) : null, _jsx(Text, { numberOfLines: secondaryYAxisConfig.yAxisTextNumberOfLines, ellipsizeMode: 'clip', allowFontScaling: allowFontScaling, style: [
|
|
154
154
|
{
|
|
155
155
|
textAlign: 'left',
|
|
156
156
|
width: (_k = (_j = secondaryYAxisConfig.yAxisLabelContainerStyle) === null || _j === void 0 ? void 0 : _j.width) !== null && _k !== void 0 ? _k : secondaryYAxisConfig.yAxisLabelWidth,
|
|
@@ -170,7 +170,7 @@ export var renderHorizSections = function (props) {
|
|
|
170
170
|
left: yAxisSide === yAxisSides.RIGHT
|
|
171
171
|
? 0
|
|
172
172
|
: yAxisLabelWidth + yAxisThickness,
|
|
173
|
-
}, children: [_jsx(Rule, { config: referenceLine1Config }), referenceLine1Config.labelText ? (_jsx(Text, { style: [
|
|
173
|
+
}, children: [_jsx(Rule, { config: referenceLine1Config }), referenceLine1Config.labelText ? (_jsx(Text, { allowFontScaling: allowFontScaling, style: [
|
|
174
174
|
{ position: 'absolute' },
|
|
175
175
|
referenceLine1Config.labelTextStyle,
|
|
176
176
|
], children: referenceLine1Config.labelText })) : null] })) : null, showReferenceLine2 ? (_jsxs(View, { style: {
|
|
@@ -182,7 +182,7 @@ export var renderHorizSections = function (props) {
|
|
|
182
182
|
left: yAxisSide === yAxisSides.RIGHT
|
|
183
183
|
? 0
|
|
184
184
|
: yAxisLabelWidth + yAxisThickness,
|
|
185
|
-
}, children: [_jsx(Rule, { config: referenceLine2Config }), referenceLine2Config.labelText ? (_jsx(Text, { style: [
|
|
185
|
+
}, children: [_jsx(Rule, { config: referenceLine2Config }), referenceLine2Config.labelText ? (_jsx(Text, { allowFontScaling: allowFontScaling, style: [
|
|
186
186
|
{ position: 'absolute' },
|
|
187
187
|
referenceLine2Config.labelTextStyle,
|
|
188
188
|
], children: referenceLine2Config.labelText })) : null] })) : null, showReferenceLine3 ? (_jsxs(View, { style: {
|
|
@@ -194,7 +194,7 @@ export var renderHorizSections = function (props) {
|
|
|
194
194
|
left: yAxisSide === yAxisSides.RIGHT
|
|
195
195
|
? 0
|
|
196
196
|
: yAxisLabelWidth + yAxisThickness,
|
|
197
|
-
}, children: [_jsx(Rule, { config: referenceLine3Config }), referenceLine3Config.labelText ? (_jsx(Text, { style: [
|
|
197
|
+
}, children: [_jsx(Rule, { config: referenceLine3Config }), referenceLine3Config.labelText ? (_jsx(Text, { allowFontScaling: allowFontScaling, style: [
|
|
198
198
|
{ position: 'absolute' },
|
|
199
199
|
referenceLine3Config.labelTextStyle,
|
|
200
200
|
], children: referenceLine3Config.labelText })) : null] })) : null] }));
|
|
@@ -256,138 +256,188 @@ export var renderHorizSections = function (props) {
|
|
|
256
256
|
}, children: _jsx(View, { style: { width: (width !== null && width !== void 0 ? width : totalWidth) + endSpacing }, children: referenceLines() }) })) : (_jsxs(View, { pointerEvents: "none", style: {
|
|
257
257
|
flexDirection: 'row',
|
|
258
258
|
marginTop: stepHeight / -2,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
left: yAxisLabelWidth + ((_d = customBackground.horizontalShift) !== null && _d !== void 0 ? _d : 0),
|
|
268
|
-
top: (_e = customBackground.verticalShift) !== null && _e !== void 0 ? _e : 0,
|
|
269
|
-
}, children: customBackground.component
|
|
270
|
-
? customBackground.component()
|
|
271
|
-
: null })) : null, yAxisExtraHeightAtTop ? renderExtraHeightOfYAxisAtTop() : null, horizSections.map(function (sectionItems, index) {
|
|
272
|
-
return (_jsxs(View, { style: [
|
|
259
|
+
position: onlyLabels ? 'absolute' : 'relative',
|
|
260
|
+
}, children: [_jsx(View, { style: { width: (width !== null && width !== void 0 ? width : totalWidth) + endSpacing }, children: onlyLabels ? (!hideYAxisText &&
|
|
261
|
+
horizSections.map(function (sectionItems, index) {
|
|
262
|
+
var label = getLabelTexts(sectionItems.value, index);
|
|
263
|
+
if (hideOrigin && index === horizSections.length - 1) {
|
|
264
|
+
label = '';
|
|
265
|
+
}
|
|
266
|
+
return (_jsx(View, { style: [
|
|
273
267
|
styles.horizBar,
|
|
268
|
+
styles.leftLabel,
|
|
274
269
|
{
|
|
275
|
-
|
|
270
|
+
position: 'absolute',
|
|
271
|
+
zIndex: 1,
|
|
272
|
+
top: stepHeight * index + yAxisExtraHeightAtTop,
|
|
273
|
+
width: yAxisLabelWidth,
|
|
274
|
+
height: index === noOfSections ? stepHeight / 2 : stepHeight,
|
|
275
|
+
},
|
|
276
|
+
yAxisSide === yAxisSides.RIGHT && {
|
|
277
|
+
left: leftShiftForRIghtYaxis,
|
|
276
278
|
},
|
|
277
279
|
horizontal &&
|
|
278
280
|
!yAxisAtTop && {
|
|
279
|
-
transform: [
|
|
280
|
-
},
|
|
281
|
-
horizontalRulesStyle,
|
|
282
|
-
], children: [_jsx(View, { style: [
|
|
283
|
-
styles.leftLabel,
|
|
281
|
+
transform: [
|
|
284
282
|
{
|
|
285
|
-
|
|
286
|
-
width: yAxisSide === yAxisSides.RIGHT ? 0 : yAxisLabelWidth,
|
|
283
|
+
translateX: (width !== null && width !== void 0 ? width : totalWidth) - 30 + endSpacing,
|
|
287
284
|
},
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
285
|
+
],
|
|
286
|
+
},
|
|
287
|
+
yAxisLabelContainerStyle,
|
|
288
|
+
], children: _jsx(Text, { allowFontScaling: allowFontScaling, numberOfLines: yAxisTextNumberOfLines, ellipsizeMode: 'clip', style: [
|
|
289
|
+
yAxisTextStyle,
|
|
290
|
+
horizontal && {
|
|
291
|
+
transform: [
|
|
292
|
+
{
|
|
293
|
+
rotate: "".concat(rotateYAxisTexts !== null && rotateYAxisTexts !== void 0 ? rotateYAxisTexts : (rtl ? 90 : -90), "deg"),
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
index === noOfSections && {
|
|
298
|
+
marginBottom: stepHeight / -2,
|
|
299
|
+
},
|
|
300
|
+
], children: label }) }, index));
|
|
301
|
+
})) : (_jsxs(_Fragment, { children: [customBackground ? (_jsx(View, { style: {
|
|
302
|
+
position: 'absolute',
|
|
303
|
+
backgroundColor: customBackground.color,
|
|
304
|
+
width: (_a = customBackground.width) !== null && _a !== void 0 ? _a : (width !== null && width !== void 0 ? width : totalWidth) +
|
|
305
|
+
endSpacing -
|
|
306
|
+
9 +
|
|
307
|
+
((_b = customBackground.widthAdjustment) !== null && _b !== void 0 ? _b : 0),
|
|
308
|
+
height: (_c = customBackground.height) !== null && _c !== void 0 ? _c : '100%',
|
|
309
|
+
left: yAxisLabelWidth +
|
|
310
|
+
((_d = customBackground.horizontalShift) !== null && _d !== void 0 ? _d : 0),
|
|
311
|
+
top: (_e = customBackground.verticalShift) !== null && _e !== void 0 ? _e : 0,
|
|
312
|
+
}, children: customBackground.component
|
|
313
|
+
? customBackground.component()
|
|
314
|
+
: null })) : null, yAxisExtraHeightAtTop ? renderExtraHeightOfYAxisAtTop() : null, horizSections.map(function (sectionItems, index) {
|
|
315
|
+
return (_jsxs(View, { style: [
|
|
301
316
|
styles.horizBar,
|
|
302
|
-
styles.leftLabel,
|
|
303
317
|
{
|
|
304
|
-
|
|
305
|
-
zIndex: 1,
|
|
306
|
-
top: stepHeight * index + yAxisExtraHeightAtTop,
|
|
307
|
-
width: yAxisLabelWidth,
|
|
308
|
-
height: index === noOfSections
|
|
309
|
-
? stepHeight / 2
|
|
310
|
-
: stepHeight,
|
|
311
|
-
},
|
|
312
|
-
yAxisSide === yAxisSides.RIGHT && {
|
|
313
|
-
left: leftShiftForRIghtYaxis,
|
|
318
|
+
width: (width !== null && width !== void 0 ? width : totalWidth) + endSpacing,
|
|
314
319
|
},
|
|
315
320
|
horizontal &&
|
|
316
321
|
!yAxisAtTop && {
|
|
317
|
-
transform: [
|
|
322
|
+
transform: [{ rotateY: '180deg' }],
|
|
323
|
+
},
|
|
324
|
+
horizontalRulesStyle,
|
|
325
|
+
], children: [_jsx(View, { style: [
|
|
326
|
+
styles.leftLabel,
|
|
318
327
|
{
|
|
319
|
-
|
|
328
|
+
height: index === noOfSections
|
|
329
|
+
? stepHeight / 2
|
|
330
|
+
: stepHeight,
|
|
331
|
+
width: yAxisSide === yAxisSides.RIGHT
|
|
332
|
+
? 0
|
|
333
|
+
: yAxisLabelWidth,
|
|
320
334
|
},
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
335
|
+
yAxisLabelContainerStyle,
|
|
336
|
+
] }), renderAxesAndRules(index)] }, index));
|
|
337
|
+
}),
|
|
338
|
+
/***********************************************************************************************/
|
|
339
|
+
/************************** Render the y axis labels separately **********************/
|
|
340
|
+
/***********************************************************************************************/
|
|
341
|
+
!hideYAxisText &&
|
|
342
|
+
horizSections.map(function (sectionItems, index) {
|
|
343
|
+
var label = getLabelTexts(sectionItems.value, index);
|
|
344
|
+
if (hideOrigin && index === horizSections.length - 1) {
|
|
345
|
+
label = '';
|
|
346
|
+
}
|
|
347
|
+
return (_jsx(View, { style: [
|
|
348
|
+
styles.horizBar,
|
|
349
|
+
styles.leftLabel,
|
|
350
|
+
{
|
|
351
|
+
position: 'absolute',
|
|
352
|
+
zIndex: 1,
|
|
353
|
+
top: stepHeight * index + yAxisExtraHeightAtTop,
|
|
354
|
+
width: yAxisLabelWidth,
|
|
355
|
+
height: index === noOfSections
|
|
356
|
+
? stepHeight / 2
|
|
357
|
+
: stepHeight,
|
|
358
|
+
},
|
|
359
|
+
yAxisSide === yAxisSides.RIGHT && {
|
|
360
|
+
left: leftShiftForRIghtYaxis,
|
|
361
|
+
},
|
|
362
|
+
horizontal &&
|
|
363
|
+
!yAxisAtTop && {
|
|
327
364
|
transform: [
|
|
328
365
|
{
|
|
329
|
-
|
|
366
|
+
translateX: (width !== null && width !== void 0 ? width : totalWidth) - 30 + endSpacing,
|
|
330
367
|
},
|
|
331
368
|
],
|
|
332
369
|
},
|
|
333
|
-
|
|
334
|
-
|
|
370
|
+
yAxisLabelContainerStyle,
|
|
371
|
+
], children: _jsx(Text, { allowFontScaling: allowFontScaling, numberOfLines: yAxisTextNumberOfLines, ellipsizeMode: 'clip', style: [
|
|
372
|
+
yAxisTextStyle,
|
|
373
|
+
horizontal && {
|
|
374
|
+
transform: [
|
|
375
|
+
{
|
|
376
|
+
rotate: "".concat(rotateYAxisTexts !== null && rotateYAxisTexts !== void 0 ? rotateYAxisTexts : (rtl ? 90 : -90), "deg"),
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
},
|
|
380
|
+
index === noOfSections && {
|
|
381
|
+
marginBottom: stepHeight / -2,
|
|
382
|
+
},
|
|
383
|
+
], children: label }) }, index));
|
|
384
|
+
})
|
|
385
|
+
/***********************************************************************************************/
|
|
386
|
+
/***********************************************************************************************/
|
|
387
|
+
, horizSectionsBelow.map(function (_, index) {
|
|
388
|
+
return horizSectionsBelowRenderer(index, true);
|
|
389
|
+
}),
|
|
390
|
+
/***********************************************************************************************/
|
|
391
|
+
/* If more -ve sections in Secondary Y-axis, then we need to render the Rules for them */
|
|
392
|
+
/***********************************************************************************************/
|
|
393
|
+
secondaryYAxis &&
|
|
394
|
+
negativeSectionsCountDiffPrimaryVsSecondary > 0
|
|
395
|
+
? __spreadArray([], __read(Array(negativeSectionsCountDiffPrimaryVsSecondary).keys()), false).map(function (_, index) {
|
|
396
|
+
return horizSectionsBelowRenderer(index, false);
|
|
397
|
+
})
|
|
398
|
+
: null,
|
|
399
|
+
/***********************************************************************************************/
|
|
400
|
+
/************************* Render the y axis labels below origin *********************/
|
|
401
|
+
/***********************************************************************************************/
|
|
402
|
+
!hideYAxisText &&
|
|
403
|
+
horizSectionsBelow.map(function (_, index) {
|
|
404
|
+
var invertedIndex = horizSectionsBelow.length - 1 - index;
|
|
405
|
+
var label = getLabelTexts(horizSectionsBelow[invertedIndex].value, index);
|
|
406
|
+
return (_jsx(View, { style: [
|
|
407
|
+
styles.horizBar,
|
|
408
|
+
styles.leftLabel,
|
|
409
|
+
{
|
|
410
|
+
position: 'absolute',
|
|
411
|
+
zIndex: 1,
|
|
412
|
+
top: containerHeight +
|
|
413
|
+
negativeStepHeight * (invertedIndex + 1) +
|
|
414
|
+
yAxisExtraHeightAtTop,
|
|
415
|
+
width: yAxisLabelWidth,
|
|
416
|
+
height: index === noOfSectionsBelowXAxis
|
|
417
|
+
? negativeStepHeight / 2
|
|
418
|
+
: negativeStepHeight,
|
|
335
419
|
},
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
return horizSectionsBelowRenderer(index, true);
|
|
342
|
-
}),
|
|
343
|
-
/***********************************************************************************************/
|
|
344
|
-
/* If more -ve sections in Secondary Y-axis, then we need to render the Rules for them */
|
|
345
|
-
/***********************************************************************************************/
|
|
346
|
-
secondaryYAxis && negativeSectionsCountDiffPrimaryVsSecondary > 0
|
|
347
|
-
? __spreadArray([], __read(Array(negativeSectionsCountDiffPrimaryVsSecondary).keys()), false).map(function (_, index) { return horizSectionsBelowRenderer(index, false); })
|
|
348
|
-
: null,
|
|
349
|
-
/***********************************************************************************************/
|
|
350
|
-
/************************* Render the y axis labels below origin *********************/
|
|
351
|
-
/***********************************************************************************************/
|
|
352
|
-
!hideYAxisText &&
|
|
353
|
-
horizSectionsBelow.map(function (_, index) {
|
|
354
|
-
var invertedIndex = horizSectionsBelow.length - 1 - index;
|
|
355
|
-
var label = getLabelTexts(horizSectionsBelow[invertedIndex].value, index);
|
|
356
|
-
return (_jsx(View, { style: [
|
|
357
|
-
styles.horizBar,
|
|
358
|
-
styles.leftLabel,
|
|
359
|
-
{
|
|
360
|
-
position: 'absolute',
|
|
361
|
-
zIndex: 1,
|
|
362
|
-
top: containerHeight +
|
|
363
|
-
negativeStepHeight * (invertedIndex + 1) +
|
|
364
|
-
yAxisExtraHeightAtTop,
|
|
365
|
-
width: yAxisLabelWidth,
|
|
366
|
-
height: index === noOfSectionsBelowXAxis
|
|
367
|
-
? negativeStepHeight / 2
|
|
368
|
-
: negativeStepHeight,
|
|
369
|
-
},
|
|
370
|
-
yAxisSide === yAxisSides.RIGHT && {
|
|
371
|
-
left: (width
|
|
372
|
-
? width - 15
|
|
373
|
-
: totalWidth - (isLineChart ? 65 : 35)) +
|
|
374
|
-
yAxisLabelWidth,
|
|
375
|
-
},
|
|
376
|
-
yAxisLabelContainerStyle,
|
|
377
|
-
], children: _jsx(Text, { numberOfLines: yAxisTextNumberOfLines, ellipsizeMode: 'clip', style: [
|
|
378
|
-
yAxisTextStyle,
|
|
379
|
-
index === noOfSectionsBelowXAxis && {
|
|
380
|
-
marginBottom: negativeStepHeight / -2,
|
|
420
|
+
yAxisSide === yAxisSides.RIGHT && {
|
|
421
|
+
left: (width
|
|
422
|
+
? width - 15
|
|
423
|
+
: totalWidth - (isLineChart ? 65 : 35)) +
|
|
424
|
+
yAxisLabelWidth,
|
|
381
425
|
},
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
426
|
+
yAxisLabelContainerStyle,
|
|
427
|
+
], children: _jsx(Text, { allowFontScaling: allowFontScaling, numberOfLines: yAxisTextNumberOfLines, ellipsizeMode: 'clip', style: [
|
|
428
|
+
yAxisTextStyle,
|
|
429
|
+
index === noOfSectionsBelowXAxis && {
|
|
430
|
+
marginBottom: negativeStepHeight / -2,
|
|
431
|
+
},
|
|
432
|
+
], children: label }) }, index));
|
|
433
|
+
})
|
|
434
|
+
/***********************************************************************************************/
|
|
435
|
+
/***********************************************************************************************/
|
|
436
|
+
, renderReferenceLines ? referenceLines() : null] })) }),
|
|
387
437
|
/***********************************************************************************************/
|
|
388
438
|
/************************* Render the secondary Y Axis *********************/
|
|
389
439
|
/***********************************************************************************************/
|
|
390
|
-
secondaryYAxis ? (_jsx(View, { style: {
|
|
440
|
+
!onlyLabels && secondaryYAxis ? (_jsx(View, { style: {
|
|
391
441
|
width: secondaryYAxisConfig.yAxisLabelWidth,
|
|
392
442
|
left: width ? yAxisLabelWidth : yAxisLabelWidth - spacing,
|
|
393
443
|
borderColor: secondaryYAxisConfig.yAxisColor,
|
|
@@ -400,7 +450,9 @@ export var renderHorizSections = function (props) {
|
|
|
400
450
|
/***********************************************************************************************/
|
|
401
451
|
/************************* Render the secondary Y Axis below origin *********************/
|
|
402
452
|
/***********************************************************************************************/
|
|
403
|
-
|
|
453
|
+
!onlyLabels &&
|
|
454
|
+
secondaryYAxis &&
|
|
455
|
+
secondaryYAxisConfig.noOfSectionsBelowXAxis ? (_jsx(View, { style: {
|
|
404
456
|
width: (_f = secondaryYAxisConfig.yAxisLabelWidth) !== null && _f !== void 0 ? _f : yAxisLabelWidth,
|
|
405
457
|
left: (width ? yAxisLabelWidth : yAxisLabelWidth - spacing) -
|
|
406
458
|
((_g = secondaryYAxisConfig.yAxisLabelWidth) !== null && _g !== void 0 ? _g : yAxisLabelWidth),
|
|
@@ -67,7 +67,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
67
67
|
position: 'absolute',
|
|
68
68
|
height: containerHeightIncludingBelowXAxis + labelsExtraHeight,
|
|
69
69
|
left: 6 - yAxisLabelWidth,
|
|
70
|
-
bottom:
|
|
70
|
+
bottom: -10 + xAxisLabelsVerticalShift, //stepHeight * -0.5 + xAxisThickness,
|
|
71
71
|
width: totalWidth,
|
|
72
72
|
zIndex: lineBehindBars ? -1 : 100000,
|
|
73
73
|
// backgroundColor: 'rgba(200,150,150,0.1)'
|
|
@@ -23,7 +23,7 @@ export var LineChartBicolor = function (props) {
|
|
|
23
23
|
// const heightValue = useMemo(() => new Animated.Value(0), []);
|
|
24
24
|
var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
25
25
|
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
26
|
-
var _c = useLineChartBiColor(__assign(__assign({}, props), { parentWidth: (_a = props.parentWidth) !== null && _a !== void 0 ? _a : screenWidth })), pointsArray = _c.pointsArray, fillPointsArray = _c.fillPointsArray, selectedIndex = _c.selectedIndex, setSelectedIndex = _c.setSelectedIndex, containerHeight = _c.containerHeight, data = _c.data, labelsExtraHeight = _c.labelsExtraHeight, animationDuration = _c.animationDuration, startIndex1 = _c.startIndex1, endIndex1 = _c.endIndex1, initialSpacing = _c.initialSpacing, thickness = _c.thickness, spacing = _c.spacing, xAxisThickness = _c.xAxisThickness, dataPointsHeight1 = _c.dataPointsHeight1, dataPointsWidth1 = _c.dataPointsWidth1, dataPointsRadius1 = _c.dataPointsRadius1, dataPointsColor1 = _c.dataPointsColor1, dataPointsShape1 = _c.dataPointsShape1, areaChart = _c.areaChart, textFontSize1 = _c.textFontSize1, textColor1 = _c.textColor1, totalWidth = _c.totalWidth, maxValue = _c.maxValue, extendedContainerHeight = _c.extendedContainerHeight, getX = _c.getX, getY = _c.getY, stepHeight = _c.stepHeight, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, thickness1 = _c.thickness1, zIndex = _c.zIndex, strokeDashArray1 = _c.strokeDashArray1, rotateLabel = _c.rotateLabel, isAnimated = _c.isAnimated, hideDataPoints1 = _c.hideDataPoints1, color = _c.color, colorNegative = _c.colorNegative, startFillColor = _c.startFillColor, endFillColor = _c.endFillColor, startOpacity = _c.startOpacity, endOpacity = _c.endOpacity, startFillColorNegative = _c.startFillColorNegative, endFillColorNegative = _c.endFillColorNegative, startOpacityNegative = _c.startOpacityNegative, endOpacityNegative = _c.endOpacityNegative, gradientDirection = _c.gradientDirection, xAxisTextNumberOfLines = _c.xAxisTextNumberOfLines, focusEnabled = _c.focusEnabled, showDataPointOnFocus = _c.showDataPointOnFocus, showStripOnFocus = _c.showStripOnFocus, showTextOnFocus = _c.showTextOnFocus, stripHeight = _c.stripHeight, stripWidth = _c.stripWidth, stripColor = _c.stripColor, stripOpacity = _c.stripOpacity, unFocusOnPressOut = _c.unFocusOnPressOut, delayBeforeUnFocus = _c.delayBeforeUnFocus, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps;
|
|
26
|
+
var _c = useLineChartBiColor(__assign(__assign({}, props), { parentWidth: (_a = props.parentWidth) !== null && _a !== void 0 ? _a : screenWidth })), pointsArray = _c.pointsArray, fillPointsArray = _c.fillPointsArray, selectedIndex = _c.selectedIndex, setSelectedIndex = _c.setSelectedIndex, containerHeight = _c.containerHeight, data = _c.data, labelsExtraHeight = _c.labelsExtraHeight, animationDuration = _c.animationDuration, startIndex1 = _c.startIndex1, endIndex1 = _c.endIndex1, initialSpacing = _c.initialSpacing, thickness = _c.thickness, spacing = _c.spacing, xAxisThickness = _c.xAxisThickness, dataPointsHeight1 = _c.dataPointsHeight1, dataPointsWidth1 = _c.dataPointsWidth1, dataPointsRadius1 = _c.dataPointsRadius1, dataPointsColor1 = _c.dataPointsColor1, dataPointsShape1 = _c.dataPointsShape1, areaChart = _c.areaChart, textFontSize1 = _c.textFontSize1, textColor1 = _c.textColor1, totalWidth = _c.totalWidth, maxValue = _c.maxValue, extendedContainerHeight = _c.extendedContainerHeight, getX = _c.getX, getY = _c.getY, stepHeight = _c.stepHeight, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, thickness1 = _c.thickness1, zIndex = _c.zIndex, strokeDashArray1 = _c.strokeDashArray1, rotateLabel = _c.rotateLabel, isAnimated = _c.isAnimated, hideDataPoints1 = _c.hideDataPoints1, color = _c.color, colorNegative = _c.colorNegative, startFillColor = _c.startFillColor, endFillColor = _c.endFillColor, startOpacity = _c.startOpacity, endOpacity = _c.endOpacity, startFillColorNegative = _c.startFillColorNegative, endFillColorNegative = _c.endFillColorNegative, startOpacityNegative = _c.startOpacityNegative, endOpacityNegative = _c.endOpacityNegative, gradientDirection = _c.gradientDirection, xAxisTextNumberOfLines = _c.xAxisTextNumberOfLines, focusEnabled = _c.focusEnabled, showDataPointOnFocus = _c.showDataPointOnFocus, showStripOnFocus = _c.showStripOnFocus, showTextOnFocus = _c.showTextOnFocus, stripHeight = _c.stripHeight, stripWidth = _c.stripWidth, stripColor = _c.stripColor, stripOpacity = _c.stripOpacity, unFocusOnPressOut = _c.unFocusOnPressOut, delayBeforeUnFocus = _c.delayBeforeUnFocus, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, allowFontScaling = _c.allowFontScaling;
|
|
27
27
|
var labelsAppear = useCallback(function () {
|
|
28
28
|
opacityValue.setValue(0);
|
|
29
29
|
Animated.timing(opacityValue, {
|
|
@@ -63,7 +63,7 @@ export var LineChartBicolor = function (props) {
|
|
|
63
63
|
justifyContent: 'center',
|
|
64
64
|
},
|
|
65
65
|
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
66
|
-
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: labelTextStyle || { textAlign: 'center' }, numberOfLines: xAxisTextNumberOfLines, children: label || '' })) }));
|
|
66
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: labelTextStyle || { textAlign: 'center' }, allowFontScaling: allowFontScaling, numberOfLines: xAxisTextNumberOfLines, children: label || '' })) }));
|
|
67
67
|
};
|
|
68
68
|
var renderAnimatedLabel = function (index, label, labelTextStyle, labelComponent) {
|
|
69
69
|
return (_jsx(Animated.View, { style: [
|
|
@@ -80,7 +80,7 @@ export var LineChartBicolor = function (props) {
|
|
|
80
80
|
opacity: appearingOpacity,
|
|
81
81
|
},
|
|
82
82
|
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
83
|
-
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: labelTextStyle || { textAlign: 'center' }, numberOfLines: xAxisTextNumberOfLines, children: label || '' })) }));
|
|
83
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { allowFontScaling: allowFontScaling, style: labelTextStyle || { textAlign: 'center' }, numberOfLines: xAxisTextNumberOfLines, children: label || '' })) }));
|
|
84
84
|
};
|
|
85
85
|
var animatedWidth = widthValue.interpolate({
|
|
86
86
|
inputRange: [0, 1],
|
package/dist/LineChart/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export var LineChart = function (props) {
|
|
|
54
54
|
var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
55
55
|
var widthValue4 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
56
56
|
var widthValue5 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
57
|
-
var _e = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), curveType = _e.curveType, scrollX = _e.scrollX, setScrollX = _e.setScrollX, arrow1Points = _e.arrow1Points, arrow2Points = _e.arrow2Points, arrow3Points = _e.arrow3Points, arrow4Points = _e.arrow4Points, arrow5Points = _e.arrow5Points, secondaryArrowPoints = _e.secondaryArrowPoints, pointerIndex = _e.pointerIndex, setPointerIndex = _e.setPointerIndex, pointerX = _e.pointerX, setPointerX = _e.setPointerX, pointerY = _e.pointerY, setPointerY = _e.setPointerY, pointerItem = _e.pointerItem, setPointerItem = _e.setPointerItem, pointerY2 = _e.pointerY2, setPointerY2 = _e.setPointerY2, pointerItem2 = _e.pointerItem2, setPointerItem2 = _e.setPointerItem2, pointerY3 = _e.pointerY3, setPointerY3 = _e.setPointerY3, pointerItem3 = _e.pointerItem3, setPointerItem3 = _e.setPointerItem3, pointerY4 = _e.pointerY4, setPointerY4 = _e.setPointerY4, pointerItem4 = _e.pointerItem4, setPointerItem4 = _e.setPointerItem4, pointerY5 = _e.pointerY5, setPointerY5 = _e.setPointerY5, pointerYsForDataSet = _e.pointerYsForDataSet, setPointerYsForDataSet = _e.setPointerYsForDataSet, pointerItem5 = _e.pointerItem5, setPointerItem5 = _e.setPointerItem5, secondaryPointerY = _e.secondaryPointerY, setSecondaryPointerY = _e.setSecondaryPointerY, secondaryPointerItem = _e.secondaryPointerItem, setSecondaryPointerItem = _e.setSecondaryPointerItem, pointerItemsForSet = _e.pointerItemsForSet, setPointerItemsForSet = _e.setPointerItemsForSet, secondaryPointerItemsForSet = _e.secondaryPointerItemsForSet, setSecondaryPointerItemsForSet = _e.setSecondaryPointerItemsForSet, responderStartTime = _e.responderStartTime, setResponderStartTime = _e.setResponderStartTime, setResponderActive = _e.setResponderActive, points = _e.points, points2 = _e.points2, points3 = _e.points3, points4 = _e.points4, points5 = _e.points5, secondaryPoints = _e.secondaryPoints, fillPoints = _e.fillPoints, fillPoints2 = _e.fillPoints2, fillPoints3 = _e.fillPoints3, fillPoints4 = _e.fillPoints4, fillPoints5 = _e.fillPoints5, secondaryFillPoints = _e.secondaryFillPoints, pointsFromSet = _e.pointsFromSet, fillPointsFromSet = _e.fillPointsFromSet, arrowPointsFromSet = _e.arrowPointsFromSet, selectedIndex = _e.selectedIndex, setSelectedIndex = _e.setSelectedIndex, containerHeight = _e.containerHeight, data = _e.data, data2 = _e.data2, data3 = _e.data3, data4 = _e.data4, data5 = _e.data5, secondaryData = _e.secondaryData, dataSet = _e.dataSet, data0 = _e.data0, labelsExtraHeight = _e.labelsExtraHeight, animationDuration = _e.animationDuration, onDataChangeAnimationDuration = _e.onDataChangeAnimationDuration, animateTogether = _e.animateTogether, renderDataPointsAfterAnimationEnds = _e.renderDataPointsAfterAnimationEnds, animateOnDataChange = _e.animateOnDataChange, startIndex1 = _e.startIndex1, startIndex2 = _e.startIndex2, endIndex1 = _e.endIndex1, endIndex2 = _e.endIndex2, startIndex3 = _e.startIndex3, endIndex3 = _e.endIndex3, startIndex4 = _e.startIndex4, endIndex4 = _e.endIndex4, startIndex5 = _e.startIndex5, endIndex5 = _e.endIndex5, initialSpacing = _e.initialSpacing, thickness = _e.thickness, yAxisLabelWidth = _e.yAxisLabelWidth, spacing = _e.spacing, xAxisThickness = _e.xAxisThickness, dataPointsHeight1 = _e.dataPointsHeight1, dataPointsWidth1 = _e.dataPointsWidth1, dataPointsRadius1 = _e.dataPointsRadius1, dataPointsColor1 = _e.dataPointsColor1, dataPointsShape1 = _e.dataPointsShape1, dataPointsHeight2 = _e.dataPointsHeight2, dataPointsWidth2 = _e.dataPointsWidth2, dataPointsRadius2 = _e.dataPointsRadius2, dataPointsColor2 = _e.dataPointsColor2, dataPointsShape2 = _e.dataPointsShape2, dataPointsHeight3 = _e.dataPointsHeight3, dataPointsWidth3 = _e.dataPointsWidth3, dataPointsRadius3 = _e.dataPointsRadius3, dataPointsColor3 = _e.dataPointsColor3, dataPointsShape3 = _e.dataPointsShape3, dataPointsHeight4 = _e.dataPointsHeight4, dataPointsWidth4 = _e.dataPointsWidth4, dataPointsRadius4 = _e.dataPointsRadius4, dataPointsColor4 = _e.dataPointsColor4, dataPointsShape4 = _e.dataPointsShape4, dataPointsHeight5 = _e.dataPointsHeight5, dataPointsWidth5 = _e.dataPointsWidth5, dataPointsRadius5 = _e.dataPointsRadius5, dataPointsColor5 = _e.dataPointsColor5, dataPointsShape5 = _e.dataPointsShape5, getIsNthAreaChart = _e.getIsNthAreaChart, textFontSize1 = _e.textFontSize1, textFontSize2 = _e.textFontSize2, textFontSize3 = _e.textFontSize3, textFontSize4 = _e.textFontSize4, textFontSize5 = _e.textFontSize5, textColor1 = _e.textColor1, textColor2 = _e.textColor2, textColor3 = _e.textColor3, textColor4 = _e.textColor4, textColor5 = _e.textColor5, totalWidth = _e.totalWidth, maxValue = _e.maxValue, overflowTop = _e.overflowTop, extendedContainerHeight = _e.extendedContainerHeight, getX = _e.getX, getY = _e.getY, getSecondaryY = _e.getSecondaryY, secondaryMaxValue = _e.secondaryMaxValue, showValuesAsDataPointsText = _e.showValuesAsDataPointsText, thickness1 = _e.thickness1, thickness2 = _e.thickness2, thickness3 = _e.thickness3, thickness4 = _e.thickness4, thickness5 = _e.thickness5, zIndex1 = _e.zIndex1, zIndex2 = _e.zIndex2, zIndex3 = _e.zIndex3, zIndex4 = _e.zIndex4, zIndex5 = _e.zIndex5, strokeDashArray1 = _e.strokeDashArray1, strokeDashArray2 = _e.strokeDashArray2, strokeDashArray3 = _e.strokeDashArray3, strokeDashArray4 = _e.strokeDashArray4, strokeDashArray5 = _e.strokeDashArray5, strokeLinecap1 = _e.strokeLinecap1, strokeLinecap2 = _e.strokeLinecap2, strokeLinecap3 = _e.strokeLinecap3, strokeLinecap4 = _e.strokeLinecap4, strokeLinecap5 = _e.strokeLinecap5, rotateLabel = _e.rotateLabel, isAnimated = _e.isAnimated, hideDataPoints1 = _e.hideDataPoints1, hideDataPoints2 = _e.hideDataPoints2, hideDataPoints3 = _e.hideDataPoints3, hideDataPoints4 = _e.hideDataPoints4, hideDataPoints5 = _e.hideDataPoints5, color1 = _e.color1, color2 = _e.color2, color3 = _e.color3, color4 = _e.color4, color5 = _e.color5, startFillColor1 = _e.startFillColor1, endFillColor1 = _e.endFillColor1, startOpacity1 = _e.startOpacity1, endOpacity1 = _e.endOpacity1, startFillColor2 = _e.startFillColor2, endFillColor2 = _e.endFillColor2, startOpacity2 = _e.startOpacity2, endOpacity2 = _e.endOpacity2, startFillColor3 = _e.startFillColor3, endFillColor3 = _e.endFillColor3, startOpacity3 = _e.startOpacity3, endOpacity3 = _e.endOpacity3, startFillColor4 = _e.startFillColor4, endFillColor4 = _e.endFillColor4, startOpacity4 = _e.startOpacity4, endOpacity4 = _e.endOpacity4, startFillColor5 = _e.startFillColor5, endFillColor5 = _e.endFillColor5, startOpacity5 = _e.startOpacity5, endOpacity5 = _e.endOpacity5, arrowStrokeWidth1 = _e.arrowStrokeWidth1, arrowStrokeColor1 = _e.arrowStrokeColor1, arrowFillColor1 = _e.arrowFillColor1, arrowStrokeWidth2 = _e.arrowStrokeWidth2, arrowStrokeColor2 = _e.arrowStrokeColor2, arrowFillColor2 = _e.arrowFillColor2, arrowStrokeWidth3 = _e.arrowStrokeWidth3, arrowStrokeColor3 = _e.arrowStrokeColor3, arrowFillColor3 = _e.arrowFillColor3, arrowStrokeWidth4 = _e.arrowStrokeWidth4, arrowStrokeColor4 = _e.arrowStrokeColor4, arrowFillColor4 = _e.arrowFillColor4, arrowStrokeWidth5 = _e.arrowStrokeWidth5, arrowStrokeColor5 = _e.arrowStrokeColor5, arrowFillColor5 = _e.arrowFillColor5, arrowStrokeWidthsFromSet = _e.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _e.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _e.arrowFillColorsFromSet, secondaryLineConfig = _e.secondaryLineConfig, gradientDirection = _e.gradientDirection, stepHeight = _e.stepHeight, noOfSectionsBelowXAxis = _e.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _e.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _e.xAxisLabelsVerticalShift, pointerConfig = _e.pointerConfig, pointerHeight = _e.pointerHeight, pointerWidth = _e.pointerWidth, pointerRadius = _e.pointerRadius, pointerColor = _e.pointerColor, pointerComponent = _e.pointerComponent, showPointerStrip = _e.showPointerStrip, pointerStripHeight = _e.pointerStripHeight, pointerStripWidth = _e.pointerStripWidth, pointerStripColor = _e.pointerStripColor, pointerStripUptoDataPoint = _e.pointerStripUptoDataPoint, pointerLabelComponent = _e.pointerLabelComponent, stripOverPointer = _e.stripOverPointer, shiftPointerLabelX = _e.shiftPointerLabelX, shiftPointerLabelY = _e.shiftPointerLabelY, pointerLabelWidth = _e.pointerLabelWidth, pointerLabelHeight = _e.pointerLabelHeight, autoAdjustPointerLabelPosition = _e.autoAdjustPointerLabelPosition, pointerVanishDelay = _e.pointerVanishDelay, activatePointersOnLongPress = _e.activatePointersOnLongPress, activatePointersInstantlyOnTouch = _e.activatePointersInstantlyOnTouch, activatePointersDelay = _e.activatePointersDelay, persistPointer = _e.persistPointer, resetPointerIndexOnRelease = _e.resetPointerIndexOnRelease, hidePointers = _e.hidePointers, hidePointer1 = _e.hidePointer1, hidePointer2 = _e.hidePointer2, hidePointer3 = _e.hidePointer3, hidePointer4 = _e.hidePointer4, hidePointer5 = _e.hidePointer5, cumulativeSpacing1 = _e.cumulativeSpacing1, cumulativeSpacing2 = _e.cumulativeSpacing2, cumulativeSpacing3 = _e.cumulativeSpacing3, cumulativeSpacing4 = _e.cumulativeSpacing4, cumulativeSpacing5 = _e.cumulativeSpacing5, cumulativeSpacingSecondary = _e.cumulativeSpacingSecondary, cumulativeSpacingForSet = _e.cumulativeSpacingForSet, hideSecondaryPointer = _e.hideSecondaryPointer, hidePointerDataPointForMissingValues = _e.hidePointerDataPointForMissingValues, pointerEvents = _e.pointerEvents, focusEnabled = _e.focusEnabled, showDataPointOnFocus = _e.showDataPointOnFocus, showStripOnFocus = _e.showStripOnFocus, stripOverDataPoints = _e.stripOverDataPoints, showTextOnFocus = _e.showTextOnFocus, showDataPointLabelOnFocus = _e.showDataPointLabelOnFocus, stripHeight = _e.stripHeight, stripWidth = _e.stripWidth, stripColor = _e.stripColor, stripOpacity = _e.stripOpacity, stripStrokeDashArray = _e.stripStrokeDashArray, _f = _e.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _f === void 0 ? 0 : _f, lineGradient = _e.lineGradient, lineGradientDirection = _e.lineGradientDirection, lineGradientStartColor = _e.lineGradientStartColor, lineGradientEndColor = _e.lineGradientEndColor, barAndLineChartsWrapperProps = _e.barAndLineChartsWrapperProps, areaChart = _e.areaChart, mostNegativeValue = _e.mostNegativeValue, strips = _e.strips, lastLineNumber = _e.lastLineNumber, focusTogether = _e.focusTogether, selectedLineNumber = _e.selectedLineNumber, handleFocus = _e.handleFocus, handleUnFocus = _e.handleUnFocus, stepValue = _e.stepValue, pointerItemLocal = _e.pointerItemLocal;
|
|
57
|
+
var _e = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), curveType = _e.curveType, scrollX = _e.scrollX, setScrollX = _e.setScrollX, arrow1Points = _e.arrow1Points, arrow2Points = _e.arrow2Points, arrow3Points = _e.arrow3Points, arrow4Points = _e.arrow4Points, arrow5Points = _e.arrow5Points, secondaryArrowPoints = _e.secondaryArrowPoints, pointerIndex = _e.pointerIndex, setPointerIndex = _e.setPointerIndex, pointerX = _e.pointerX, setPointerX = _e.setPointerX, pointerY = _e.pointerY, setPointerY = _e.setPointerY, pointerItem = _e.pointerItem, setPointerItem = _e.setPointerItem, pointerY2 = _e.pointerY2, setPointerY2 = _e.setPointerY2, pointerItem2 = _e.pointerItem2, setPointerItem2 = _e.setPointerItem2, pointerY3 = _e.pointerY3, setPointerY3 = _e.setPointerY3, pointerItem3 = _e.pointerItem3, setPointerItem3 = _e.setPointerItem3, pointerY4 = _e.pointerY4, setPointerY4 = _e.setPointerY4, pointerItem4 = _e.pointerItem4, setPointerItem4 = _e.setPointerItem4, pointerY5 = _e.pointerY5, setPointerY5 = _e.setPointerY5, pointerYsForDataSet = _e.pointerYsForDataSet, setPointerYsForDataSet = _e.setPointerYsForDataSet, pointerItem5 = _e.pointerItem5, setPointerItem5 = _e.setPointerItem5, secondaryPointerY = _e.secondaryPointerY, setSecondaryPointerY = _e.setSecondaryPointerY, secondaryPointerItem = _e.secondaryPointerItem, setSecondaryPointerItem = _e.setSecondaryPointerItem, pointerItemsForSet = _e.pointerItemsForSet, setPointerItemsForSet = _e.setPointerItemsForSet, secondaryPointerItemsForSet = _e.secondaryPointerItemsForSet, setSecondaryPointerItemsForSet = _e.setSecondaryPointerItemsForSet, responderStartTime = _e.responderStartTime, setResponderStartTime = _e.setResponderStartTime, setResponderActive = _e.setResponderActive, points = _e.points, points2 = _e.points2, points3 = _e.points3, points4 = _e.points4, points5 = _e.points5, secondaryPoints = _e.secondaryPoints, fillPoints = _e.fillPoints, fillPoints2 = _e.fillPoints2, fillPoints3 = _e.fillPoints3, fillPoints4 = _e.fillPoints4, fillPoints5 = _e.fillPoints5, secondaryFillPoints = _e.secondaryFillPoints, pointsFromSet = _e.pointsFromSet, fillPointsFromSet = _e.fillPointsFromSet, arrowPointsFromSet = _e.arrowPointsFromSet, selectedIndex = _e.selectedIndex, setSelectedIndex = _e.setSelectedIndex, containerHeight = _e.containerHeight, data = _e.data, data2 = _e.data2, data3 = _e.data3, data4 = _e.data4, data5 = _e.data5, secondaryData = _e.secondaryData, dataSet = _e.dataSet, data0 = _e.data0, labelsExtraHeight = _e.labelsExtraHeight, animationDuration = _e.animationDuration, onDataChangeAnimationDuration = _e.onDataChangeAnimationDuration, animateTogether = _e.animateTogether, renderDataPointsAfterAnimationEnds = _e.renderDataPointsAfterAnimationEnds, animateOnDataChange = _e.animateOnDataChange, startIndex1 = _e.startIndex1, startIndex2 = _e.startIndex2, endIndex1 = _e.endIndex1, endIndex2 = _e.endIndex2, startIndex3 = _e.startIndex3, endIndex3 = _e.endIndex3, startIndex4 = _e.startIndex4, endIndex4 = _e.endIndex4, startIndex5 = _e.startIndex5, endIndex5 = _e.endIndex5, initialSpacing = _e.initialSpacing, thickness = _e.thickness, yAxisLabelWidth = _e.yAxisLabelWidth, spacing = _e.spacing, xAxisThickness = _e.xAxisThickness, dataPointsHeight1 = _e.dataPointsHeight1, dataPointsWidth1 = _e.dataPointsWidth1, dataPointsRadius1 = _e.dataPointsRadius1, dataPointsColor1 = _e.dataPointsColor1, dataPointsShape1 = _e.dataPointsShape1, dataPointsHeight2 = _e.dataPointsHeight2, dataPointsWidth2 = _e.dataPointsWidth2, dataPointsRadius2 = _e.dataPointsRadius2, dataPointsColor2 = _e.dataPointsColor2, dataPointsShape2 = _e.dataPointsShape2, dataPointsHeight3 = _e.dataPointsHeight3, dataPointsWidth3 = _e.dataPointsWidth3, dataPointsRadius3 = _e.dataPointsRadius3, dataPointsColor3 = _e.dataPointsColor3, dataPointsShape3 = _e.dataPointsShape3, dataPointsHeight4 = _e.dataPointsHeight4, dataPointsWidth4 = _e.dataPointsWidth4, dataPointsRadius4 = _e.dataPointsRadius4, dataPointsColor4 = _e.dataPointsColor4, dataPointsShape4 = _e.dataPointsShape4, dataPointsHeight5 = _e.dataPointsHeight5, dataPointsWidth5 = _e.dataPointsWidth5, dataPointsRadius5 = _e.dataPointsRadius5, dataPointsColor5 = _e.dataPointsColor5, dataPointsShape5 = _e.dataPointsShape5, getIsNthAreaChart = _e.getIsNthAreaChart, textFontSize1 = _e.textFontSize1, textFontSize2 = _e.textFontSize2, textFontSize3 = _e.textFontSize3, textFontSize4 = _e.textFontSize4, textFontSize5 = _e.textFontSize5, textColor1 = _e.textColor1, textColor2 = _e.textColor2, textColor3 = _e.textColor3, textColor4 = _e.textColor4, textColor5 = _e.textColor5, totalWidth = _e.totalWidth, maxValue = _e.maxValue, overflowTop = _e.overflowTop, extendedContainerHeight = _e.extendedContainerHeight, getX = _e.getX, getY = _e.getY, getSecondaryY = _e.getSecondaryY, secondaryMaxValue = _e.secondaryMaxValue, showValuesAsDataPointsText = _e.showValuesAsDataPointsText, thickness1 = _e.thickness1, thickness2 = _e.thickness2, thickness3 = _e.thickness3, thickness4 = _e.thickness4, thickness5 = _e.thickness5, zIndex1 = _e.zIndex1, zIndex2 = _e.zIndex2, zIndex3 = _e.zIndex3, zIndex4 = _e.zIndex4, zIndex5 = _e.zIndex5, strokeDashArray1 = _e.strokeDashArray1, strokeDashArray2 = _e.strokeDashArray2, strokeDashArray3 = _e.strokeDashArray3, strokeDashArray4 = _e.strokeDashArray4, strokeDashArray5 = _e.strokeDashArray5, strokeLinecap1 = _e.strokeLinecap1, strokeLinecap2 = _e.strokeLinecap2, strokeLinecap3 = _e.strokeLinecap3, strokeLinecap4 = _e.strokeLinecap4, strokeLinecap5 = _e.strokeLinecap5, rotateLabel = _e.rotateLabel, isAnimated = _e.isAnimated, hideDataPoints1 = _e.hideDataPoints1, hideDataPoints2 = _e.hideDataPoints2, hideDataPoints3 = _e.hideDataPoints3, hideDataPoints4 = _e.hideDataPoints4, hideDataPoints5 = _e.hideDataPoints5, color1 = _e.color1, color2 = _e.color2, color3 = _e.color3, color4 = _e.color4, color5 = _e.color5, startFillColor1 = _e.startFillColor1, endFillColor1 = _e.endFillColor1, startOpacity1 = _e.startOpacity1, endOpacity1 = _e.endOpacity1, startFillColor2 = _e.startFillColor2, endFillColor2 = _e.endFillColor2, startOpacity2 = _e.startOpacity2, endOpacity2 = _e.endOpacity2, startFillColor3 = _e.startFillColor3, endFillColor3 = _e.endFillColor3, startOpacity3 = _e.startOpacity3, endOpacity3 = _e.endOpacity3, startFillColor4 = _e.startFillColor4, endFillColor4 = _e.endFillColor4, startOpacity4 = _e.startOpacity4, endOpacity4 = _e.endOpacity4, startFillColor5 = _e.startFillColor5, endFillColor5 = _e.endFillColor5, startOpacity5 = _e.startOpacity5, endOpacity5 = _e.endOpacity5, arrowStrokeWidth1 = _e.arrowStrokeWidth1, arrowStrokeColor1 = _e.arrowStrokeColor1, arrowFillColor1 = _e.arrowFillColor1, arrowStrokeWidth2 = _e.arrowStrokeWidth2, arrowStrokeColor2 = _e.arrowStrokeColor2, arrowFillColor2 = _e.arrowFillColor2, arrowStrokeWidth3 = _e.arrowStrokeWidth3, arrowStrokeColor3 = _e.arrowStrokeColor3, arrowFillColor3 = _e.arrowFillColor3, arrowStrokeWidth4 = _e.arrowStrokeWidth4, arrowStrokeColor4 = _e.arrowStrokeColor4, arrowFillColor4 = _e.arrowFillColor4, arrowStrokeWidth5 = _e.arrowStrokeWidth5, arrowStrokeColor5 = _e.arrowStrokeColor5, arrowFillColor5 = _e.arrowFillColor5, arrowStrokeWidthsFromSet = _e.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _e.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _e.arrowFillColorsFromSet, secondaryLineConfig = _e.secondaryLineConfig, gradientDirection = _e.gradientDirection, stepHeight = _e.stepHeight, noOfSectionsBelowXAxis = _e.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _e.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _e.xAxisLabelsVerticalShift, pointerConfig = _e.pointerConfig, pointerHeight = _e.pointerHeight, pointerWidth = _e.pointerWidth, pointerRadius = _e.pointerRadius, pointerColor = _e.pointerColor, pointerComponent = _e.pointerComponent, showPointerStrip = _e.showPointerStrip, pointerStripHeight = _e.pointerStripHeight, pointerStripWidth = _e.pointerStripWidth, pointerStripColor = _e.pointerStripColor, pointerStripUptoDataPoint = _e.pointerStripUptoDataPoint, pointerLabelComponent = _e.pointerLabelComponent, stripOverPointer = _e.stripOverPointer, shiftPointerLabelX = _e.shiftPointerLabelX, shiftPointerLabelY = _e.shiftPointerLabelY, pointerLabelWidth = _e.pointerLabelWidth, pointerLabelHeight = _e.pointerLabelHeight, autoAdjustPointerLabelPosition = _e.autoAdjustPointerLabelPosition, pointerVanishDelay = _e.pointerVanishDelay, activatePointersOnLongPress = _e.activatePointersOnLongPress, activatePointersInstantlyOnTouch = _e.activatePointersInstantlyOnTouch, activatePointersDelay = _e.activatePointersDelay, persistPointer = _e.persistPointer, resetPointerIndexOnRelease = _e.resetPointerIndexOnRelease, hidePointers = _e.hidePointers, hidePointer1 = _e.hidePointer1, hidePointer2 = _e.hidePointer2, hidePointer3 = _e.hidePointer3, hidePointer4 = _e.hidePointer4, hidePointer5 = _e.hidePointer5, cumulativeSpacing1 = _e.cumulativeSpacing1, cumulativeSpacing2 = _e.cumulativeSpacing2, cumulativeSpacing3 = _e.cumulativeSpacing3, cumulativeSpacing4 = _e.cumulativeSpacing4, cumulativeSpacing5 = _e.cumulativeSpacing5, cumulativeSpacingSecondary = _e.cumulativeSpacingSecondary, cumulativeSpacingForSet = _e.cumulativeSpacingForSet, hideSecondaryPointer = _e.hideSecondaryPointer, hidePointerDataPointForMissingValues = _e.hidePointerDataPointForMissingValues, pointerEvents = _e.pointerEvents, focusEnabled = _e.focusEnabled, showDataPointOnFocus = _e.showDataPointOnFocus, showStripOnFocus = _e.showStripOnFocus, stripOverDataPoints = _e.stripOverDataPoints, showTextOnFocus = _e.showTextOnFocus, showDataPointLabelOnFocus = _e.showDataPointLabelOnFocus, stripHeight = _e.stripHeight, stripWidth = _e.stripWidth, stripColor = _e.stripColor, stripOpacity = _e.stripOpacity, stripStrokeDashArray = _e.stripStrokeDashArray, _f = _e.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _f === void 0 ? 0 : _f, lineGradient = _e.lineGradient, lineGradientDirection = _e.lineGradientDirection, lineGradientStartColor = _e.lineGradientStartColor, lineGradientEndColor = _e.lineGradientEndColor, barAndLineChartsWrapperProps = _e.barAndLineChartsWrapperProps, areaChart = _e.areaChart, mostNegativeValue = _e.mostNegativeValue, strips = _e.strips, lastLineNumber = _e.lastLineNumber, focusTogether = _e.focusTogether, selectedLineNumber = _e.selectedLineNumber, handleFocus = _e.handleFocus, handleUnFocus = _e.handleUnFocus, stepValue = _e.stepValue, pointerItemLocal = _e.pointerItemLocal, allowFontScaling = _e.allowFontScaling;
|
|
58
58
|
var svgHeight = containerHeightIncludingBelowXAxis +
|
|
59
59
|
((_c = props.overflowBottom) !== null && _c !== void 0 ? _c : dataPointsRadius1);
|
|
60
60
|
var secondaryXAxis = props.secondaryXAxis, intersectionAreaConfig = props.intersectionAreaConfig;
|
|
@@ -217,13 +217,11 @@ export var LineChart = function (props) {
|
|
|
217
217
|
: 54 - xAxisTextNumberOfLines * 18,
|
|
218
218
|
zIndex: 10,
|
|
219
219
|
width: spacing + labelsExtraHeight,
|
|
220
|
-
left:
|
|
221
|
-
? initialSpacing / 2 + spacing * index - spacing / 2 + 4
|
|
222
|
-
: initialSpacing / 2 + spacing * index - spacing / 2 - 10,
|
|
220
|
+
left: spacing * index - spacing / 2,
|
|
223
221
|
height: (_b = props.xAxisLabelsHeight) !== null && _b !== void 0 ? _b : xAxisTextNumberOfLines * 18,
|
|
224
222
|
},
|
|
225
223
|
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
226
|
-
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: [{ textAlign: 'center' }, labelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label })) }));
|
|
224
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: [{ textAlign: 'center' }, labelTextStyle], allowFontScaling: allowFontScaling, numberOfLines: xAxisTextNumberOfLines, children: label })) }));
|
|
227
225
|
};
|
|
228
226
|
var renderAnimatedLabel = function (top, index, label, labelTextStyle, labelComponent) {
|
|
229
227
|
var _a, _b;
|
|
@@ -242,13 +240,11 @@ export var LineChart = function (props) {
|
|
|
242
240
|
: 54 - xAxisTextNumberOfLines * 18,
|
|
243
241
|
zIndex: 10,
|
|
244
242
|
width: spacing,
|
|
245
|
-
left:
|
|
246
|
-
? initialSpacing / 2 + spacing * index - spacing / 2 + 4
|
|
247
|
-
: initialSpacing / 2 + spacing * index - spacing / 2 - 10,
|
|
243
|
+
left: spacing * index - spacing / 2,
|
|
248
244
|
opacity: appearingOpacity,
|
|
249
245
|
},
|
|
250
246
|
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
251
|
-
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: [{ textAlign: 'center' }, labelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label })) }));
|
|
247
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { allowFontScaling: allowFontScaling, style: [{ textAlign: 'center' }, labelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label })) }));
|
|
252
248
|
};
|
|
253
249
|
var onStripPress = function (item, index) {
|
|
254
250
|
if (props.focusedDataPointIndex === undefined || !props.onFocus) {
|
package/dist/PieChart/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PieChartPropsType } from 'gifted-charts-core';
|
|
2
|
-
export declare const PieChart: (props: PieChartPropsType) => import("react/jsx-runtime").JSX.Element
|
|
2
|
+
export declare const PieChart: (props: PieChartPropsType) => import("react/jsx-runtime").JSX.Element;
|
package/dist/PieChart/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
28
28
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
29
|
import { View, Text } from 'react-native';
|
|
30
30
|
import { PieChartMain } from './main';
|
|
31
|
-
import { usePieChart } from 'gifted-charts-core';
|
|
31
|
+
import { pieColors, usePieChart } from 'gifted-charts-core';
|
|
32
32
|
import { isWebApp } from '../utils';
|
|
33
33
|
import { useState } from 'react';
|
|
34
34
|
export var PieChart = function (props) {
|
|
@@ -36,6 +36,7 @@ export var PieChart = function (props) {
|
|
|
36
36
|
var _b = __read(useState(0), 2), touchX = _b[0], setTouchX = _b[1];
|
|
37
37
|
var _c = __read(useState(0), 2), touchY = _c[0], setTouchY = _c[1];
|
|
38
38
|
var renderInnerCircle = function (innerRadius, innerCircleBorderWidth) {
|
|
39
|
+
var _a, _b;
|
|
39
40
|
if (props.centerLabelComponent || (donut && !isDataShifted)) {
|
|
40
41
|
return (_jsx(View, { style: [
|
|
41
42
|
{
|
|
@@ -79,7 +80,7 @@ export var PieChart = function (props) {
|
|
|
79
80
|
borderRightWidth: 0.5,
|
|
80
81
|
borderRightColor: innerCircleColor,
|
|
81
82
|
},
|
|
82
|
-
], children: _jsx(View, { style: { marginTop: semiCircle ? -0.5 * innerRadius : 0 }, children: props.centerLabelComponent ?
|
|
83
|
+
], pointerEvents: "box-none", children: _jsx(View, { style: { marginTop: semiCircle ? -0.5 * innerRadius : 0 }, children: (_b = (_a = props.centerLabelComponent) === null || _a === void 0 ? void 0 : _a.call(props, selectedIndex)) !== null && _b !== void 0 ? _b : null }) }));
|
|
83
84
|
}
|
|
84
85
|
return null;
|
|
85
86
|
};
|
|
@@ -116,8 +117,7 @@ export var PieChart = function (props) {
|
|
|
116
117
|
fontStyle: fontStyle,
|
|
117
118
|
}, children: getTooltipText(tooltipSelectedIndex) }) })) }));
|
|
118
119
|
};
|
|
119
|
-
if (!total)
|
|
120
|
-
return null;
|
|
120
|
+
// if (!total) return null;
|
|
121
121
|
return (_jsxs(View, { style: {
|
|
122
122
|
height: (radius + extraRadius + paddingVertical / 2) *
|
|
123
123
|
(props.semiCircle ? 1 : 2),
|
|
@@ -132,7 +132,10 @@ export var PieChart = function (props) {
|
|
|
132
132
|
left: -extraRadius,
|
|
133
133
|
zIndex: isWebApp ? -1 : 0, // was not getting displayed in web (using Expo)
|
|
134
134
|
}, children: _jsx(PieChartMain, __assign({}, props, { setTouchX: setTouchX, setTouchY: setTouchY, tooltipSelectedIndex: tooltipSelectedIndex, setTooltipSelectedIndex: setTooltipSelectedIndex, data: [
|
|
135
|
-
__assign({}, props.data[selectedIndex]),
|
|
135
|
+
__assign(__assign({}, props.data[selectedIndex]), { color: props.showGradient
|
|
136
|
+
? "url(#grad".concat(selectedIndex, ")")
|
|
137
|
+
: props.data[selectedIndex].color ||
|
|
138
|
+
pieColors[selectedIndex % 9] }),
|
|
136
139
|
{
|
|
137
140
|
value: total - props.data[selectedIndex].value,
|
|
138
141
|
peripheral: true,
|
package/dist/PieChart/main.js
CHANGED
|
@@ -43,7 +43,7 @@ export var PieChartMain = function (props) {
|
|
|
43
43
|
setTouchX(x);
|
|
44
44
|
setTouchY(y);
|
|
45
45
|
var r = Math.sqrt(Math.pow((x - cx), 2) + Math.pow((y - cy), 2));
|
|
46
|
-
if (r > radius)
|
|
46
|
+
if (r > radius || (donut && r < innerRadius))
|
|
47
47
|
return;
|
|
48
48
|
var a = Math.atan2(y - cy, x - cx);
|
|
49
49
|
for (var index = 0; index < data.length; index++) {
|
|
@@ -88,7 +88,7 @@ export var PieChartMain = function (props) {
|
|
|
88
88
|
vertAdjustment +
|
|
89
89
|
(vertAdjustment ? strokeWidth : 0)), height: (radius + extraRadius) * 2 + strokeWidth + paddingVertical, width: (radius + extraRadius) * 2 + strokeWidth + paddingHorizontal, children: [_jsx(Defs, { children: data.map(function (item, index) {
|
|
90
90
|
return (_jsxs(RadialGradient, { id: 'grad' + index, cx: "50%", cy: "50%", rx: "50%", ry: "50%", fx: "50%", fy: "50%", gradientUnits: "userSpaceOnUse", children: [_jsx(Stop, { offset: "0%", stopColor: item.gradientCenterColor || gradientCenterColor, stopOpacity: "1" }), _jsx(Stop, { offset: "100%", stopColor: item.color || pieColors[index % 9], stopOpacity: "1" })] }, index + ''));
|
|
91
|
-
}) }), data.length === 1 ? (_jsx(_Fragment, { children: _jsx(Circle, { cx: cx, cy: cy, r: radius, fill: showGradient
|
|
91
|
+
}) }), (data.length === 1 || !total) ? (_jsx(_Fragment, { children: _jsx(Circle, { cx: cx, cy: cy, r: radius, fill: showGradient
|
|
92
92
|
? "url(#grad".concat(0, ")")
|
|
93
93
|
: data[0].color || pieColors[0 % 9] }) })) : (data.map(function (item, index) {
|
|
94
94
|
var _a = coordinates[index], sx = _a.sx, sy = _a.sy, ax = _a.ax, ay = _a.ay;
|
package/dist/RadarChart/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useEffect } from 'react';
|
|
3
3
|
import { Animated, View } from 'react-native';
|
|
4
|
-
import Svg, { Line, Polygon, Circle, Text as SvgText, Defs, RadialGradient, Stop, } from 'react-native-svg';
|
|
4
|
+
import Svg, { Line, Polygon, Circle, Text as SvgText, Defs, RadialGradient, Stop, TSpan, } from 'react-native-svg';
|
|
5
5
|
import { useRadarChart } from 'gifted-charts-core';
|
|
6
6
|
export var RadarChart = function (props) {
|
|
7
7
|
var _a = useRadarChart(props), data = _a.data, dataSet = _a.dataSet, center = _a.center, radius = _a.radius, chartSize = _a.chartSize, polarToCartesian = _a.polarToCartesian, labels = _a.labels, labelConfigArray = _a.labelConfigArray, labelsPositionOffset = _a.labelsPositionOffset, dataLabelsConfigArray = _a.dataLabelsConfigArray, maxValue = _a.maxValue, dataLabels = _a.dataLabels, dataLabelsArray = _a.dataLabelsArray, gridSections = _a.gridSections, gridFill = _a.gridFill, fontSize = _a.fontSize, stroke = _a.stroke, textAnchor = _a.textAnchor, alignmentBaseline = _a.alignmentBaseline, fontWeight = _a.fontWeight, fontFamily = _a.fontFamily, dataLabelsPositionOffset = _a.dataLabelsPositionOffset, polygonStroke = _a.polygonStroke, polygonStrokeWidth = _a.polygonStrokeWidth, polygonStrokeDashArray = _a.polygonStrokeDashArray, polygonFill = _a.polygonFill, polygonGradientColor = _a.polygonGradientColor, polygonShowGradient = _a.polygonShowGradient, polygonOpacity = _a.polygonOpacity, polygonGradientOpacity = _a.polygonGradientOpacity, polygonIsAnimated = _a.polygonIsAnimated, polygonAnimationDuration = _a.polygonAnimationDuration, asterLinesStroke = _a.asterLinesStroke, asterLinesStrokeWidth = _a.asterLinesStrokeWidth, asterLinesStrokeDashArray = _a.asterLinesStrokeDashArray, polygonPoints = _a.polygonPoints, initialPolygonPoints = _a.initialPolygonPoints, polygonPointsArray = _a.polygonPointsArray, initialPolygonPointsArray = _a.initialPolygonPointsArray, polygonConfigArray = _a.polygonConfigArray, angleStep = _a.angleStep, circular = _a.circular, hideGrid = _a.hideGrid, hideLabels = _a.hideLabels, hideAsterLines = _a.hideAsterLines, getGridLevelProps = _a.getGridLevelProps, animateTogether = _a.animateTogether;
|
|
@@ -108,6 +108,6 @@ export var RadarChart = function (props) {
|
|
|
108
108
|
var colorLocal = (_h = (_g = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _g === void 0 ? void 0 : _g.stroke) !== null && _h !== void 0 ? _h : stroke;
|
|
109
109
|
var textAnchorLocal = (_k = (_j = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _j === void 0 ? void 0 : _j.textAnchor) !== null && _k !== void 0 ? _k : textAnchor;
|
|
110
110
|
var alignmentBaselineLocal = (_m = (_l = labelConfigArray === null || labelConfigArray === void 0 ? void 0 : labelConfigArray[index]) === null || _l === void 0 ? void 0 : _l.alignmentBaseline) !== null && _m !== void 0 ? _m : alignmentBaseline;
|
|
111
|
-
return (_jsx(SvgText, { x: x, y: y, fontSize: fontSizeLocal, fontWeight: fontWeightLocal, fontFamily: fontFamilyLocal, fill: colorLocal, textAnchor: (_o = textAnchorLocal) !== null && _o !== void 0 ? _o : 'middle', alignmentBaseline: (_p = alignmentBaselineLocal) !== null && _p !== void 0 ? _p : 'middle', children: category }, "label-".concat(index)));
|
|
111
|
+
return (_jsx(SvgText, { x: x, y: y, fontSize: fontSizeLocal, fontWeight: fontWeightLocal, fontFamily: fontFamilyLocal, fill: colorLocal, textAnchor: (_o = textAnchorLocal) !== null && _o !== void 0 ? _o : 'middle', alignmentBaseline: (_p = alignmentBaselineLocal) !== null && _p !== void 0 ? _p : 'middle', children: category.split('\n').map(function (line, idx) { return (_jsx(TSpan, { x: x, dy: idx === 0 ? 0 : fontSizeLocal, children: line }, idx)); }) }, "label-".concat(index)));
|
|
112
112
|
})] }) }));
|
|
113
113
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.65",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid and Radar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"gifted-charts-core": "0.1.
|
|
29
|
+
"gifted-charts-core": "0.1.67"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/cli": "^7.24.8",
|