@harveylx/react-native-gifted-charts 1.4.70
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/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/BarChart/Animated2DWithGradient.d.ts +3 -0
- package/dist/BarChart/Animated2DWithGradient.js +78 -0
- package/dist/BarChart/RenderBars.d.ts +3 -0
- package/dist/BarChart/RenderBars.js +222 -0
- package/dist/BarChart/RenderStackBars.d.ts +3 -0
- package/dist/BarChart/RenderStackBars.js +214 -0
- package/dist/BarChart/index.d.ts +2 -0
- package/dist/BarChart/index.js +256 -0
- package/dist/BarChart/styles.d.ts +45 -0
- package/dist/BarChart/styles.js +46 -0
- package/dist/Components/AnimatedThreeDBar/index.d.ts +3 -0
- package/dist/Components/AnimatedThreeDBar/index.js +103 -0
- package/dist/Components/AnimatedThreeDBar/styles.d.ts +11 -0
- package/dist/Components/AnimatedThreeDBar/styles.js +12 -0
- package/dist/Components/BarAndLineChartsWrapper/index.d.ts +3 -0
- package/dist/Components/BarAndLineChartsWrapper/index.js +161 -0
- package/dist/Components/BarAndLineChartsWrapper/renderBackgroundSlices.d.ts +7 -0
- package/dist/Components/BarAndLineChartsWrapper/renderBackgroundSlices.js +30 -0
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.d.ts +2 -0
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +468 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.d.ts +3 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +87 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.d.ts +2 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +102 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.d.ts +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +25 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.d.ts +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +20 -0
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.d.ts +2 -0
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +133 -0
- package/dist/Components/BarSpecificComponents/barBackgroundPattern.d.ts +2 -0
- package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +9 -0
- package/dist/Components/BarSpecificComponents/cap.d.ts +2 -0
- package/dist/Components/BarSpecificComponents/cap.js +16 -0
- package/dist/Components/BarSpecificComponents/tooltip.d.ts +3 -0
- package/dist/Components/BarSpecificComponents/tooltip.js +38 -0
- package/dist/Components/common/LinearGradient.d.ts +16 -0
- package/dist/Components/common/LinearGradient.js +15 -0
- package/dist/Components/common/Pointer.d.ts +1 -0
- package/dist/Components/common/Pointer.js +18 -0
- package/dist/Components/common/StripAndLabel.d.ts +2 -0
- package/dist/Components/common/StripAndLabel.js +60 -0
- package/dist/Components/lineSvg.d.ts +14 -0
- package/dist/Components/lineSvg.js +22 -0
- package/dist/LineChart/LineChartBicolor.d.ts +2 -0
- package/dist/LineChart/LineChartBicolor.js +298 -0
- package/dist/LineChart/index.d.ts +2 -0
- package/dist/LineChart/index.js +1137 -0
- package/dist/LineChart/styles.d.ts +43 -0
- package/dist/LineChart/styles.js +46 -0
- package/dist/PieChart/index.d.ts +2 -0
- package/dist/PieChart/index.js +146 -0
- package/dist/PieChart/main.d.ts +2 -0
- package/dist/PieChart/main.js +178 -0
- package/dist/PieChartPro/index.d.ts +2 -0
- package/dist/PieChartPro/index.js +124 -0
- package/dist/PopulationPyramid/index.d.ts +2 -0
- package/dist/PopulationPyramid/index.js +132 -0
- package/dist/RadarChart/index.d.ts +2 -0
- package/dist/RadarChart/index.js +113 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +22 -0
- package/package.json +89 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
14
|
+
import { View, Animated, Easing, Text } from 'react-native';
|
|
15
|
+
import { styles } from './styles';
|
|
16
|
+
import Svg, { Path, LinearGradient, Stop, Circle, Rect, Text as CanvasText, } from 'react-native-svg';
|
|
17
|
+
import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
|
|
18
|
+
import { useLineChartBiColor, } from '@harveylx/gifted-charts-core';
|
|
19
|
+
import { screenWidth } from '../utils';
|
|
20
|
+
export var LineChartBicolor = function (props) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
var scrollRef = useRef();
|
|
23
|
+
// const heightValue = useMemo(() => new Animated.Value(0), []);
|
|
24
|
+
var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
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, allowFontScaling = _c.allowFontScaling;
|
|
27
|
+
var labelsAppear = useCallback(function () {
|
|
28
|
+
opacityValue.setValue(0);
|
|
29
|
+
Animated.timing(opacityValue, {
|
|
30
|
+
toValue: 1,
|
|
31
|
+
duration: 500,
|
|
32
|
+
easing: Easing.ease,
|
|
33
|
+
useNativeDriver: false,
|
|
34
|
+
}).start();
|
|
35
|
+
}, [opacityValue]);
|
|
36
|
+
var appearingOpacity = opacityValue.interpolate({
|
|
37
|
+
inputRange: [0, 1],
|
|
38
|
+
outputRange: [0, 1],
|
|
39
|
+
});
|
|
40
|
+
var decreaseWidth = useCallback(function () {
|
|
41
|
+
widthValue.setValue(0);
|
|
42
|
+
Animated.timing(widthValue, {
|
|
43
|
+
toValue: 1,
|
|
44
|
+
duration: animationDuration,
|
|
45
|
+
easing: Easing.linear,
|
|
46
|
+
useNativeDriver: false,
|
|
47
|
+
}).start();
|
|
48
|
+
}, [animationDuration, widthValue]);
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
decreaseWidth();
|
|
51
|
+
labelsAppear();
|
|
52
|
+
}, [animationDuration, decreaseWidth, labelsAppear]);
|
|
53
|
+
var renderLabel = function (index, label, labelTextStyle, labelComponent) {
|
|
54
|
+
return (_jsx(View, { style: [
|
|
55
|
+
{
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
bottom: 30,
|
|
58
|
+
zIndex: 10,
|
|
59
|
+
width: spacing + labelsExtraHeight,
|
|
60
|
+
left: index === 0 && initialSpacing < 10
|
|
61
|
+
? getX(index) - spacing / 2 + 8
|
|
62
|
+
: getX(index) - spacing / 2,
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
},
|
|
65
|
+
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
66
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: labelTextStyle || { textAlign: 'center' }, allowFontScaling: allowFontScaling, numberOfLines: xAxisTextNumberOfLines, children: label || '' })) }));
|
|
67
|
+
};
|
|
68
|
+
var renderAnimatedLabel = function (index, label, labelTextStyle, labelComponent) {
|
|
69
|
+
return (_jsx(Animated.View, { style: [
|
|
70
|
+
{
|
|
71
|
+
height: rotateLabel ? 40 : 20,
|
|
72
|
+
// backgroundColor: 'yellow',
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
bottom: rotateLabel ? 10 : 30,
|
|
75
|
+
zIndex: 10,
|
|
76
|
+
width: spacing,
|
|
77
|
+
left: index === 0 && initialSpacing < 10
|
|
78
|
+
? getX(index) - spacing / 2 + 8
|
|
79
|
+
: getX(index) - spacing / 2,
|
|
80
|
+
opacity: appearingOpacity,
|
|
81
|
+
},
|
|
82
|
+
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
83
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { allowFontScaling: allowFontScaling, style: labelTextStyle || { textAlign: 'center' }, numberOfLines: xAxisTextNumberOfLines, children: label || '' })) }));
|
|
84
|
+
};
|
|
85
|
+
var animatedWidth = widthValue.interpolate({
|
|
86
|
+
inputRange: [0, 1],
|
|
87
|
+
outputRange: [0, totalWidth],
|
|
88
|
+
});
|
|
89
|
+
var onStripPress = function (item, index) {
|
|
90
|
+
setSelectedIndex(index);
|
|
91
|
+
if (props.onFocus) {
|
|
92
|
+
props.onFocus(item, index);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var renderDataPoints = function (dataForRender, dataPtsShape, dataPtsWidth, dataPtsHeight, dataPtsColor, dataPtsRadius, textColor, textFontSize, startIndex, endIndex) {
|
|
96
|
+
return dataForRender.map(function (item, index) {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
if (index < startIndex || index > endIndex)
|
|
99
|
+
return null;
|
|
100
|
+
if (item.hideDataPoint) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
var dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, text, customDataPoint, dataPointLabelComponent;
|
|
104
|
+
if (index === selectedIndex) {
|
|
105
|
+
dataPointsShape =
|
|
106
|
+
item.focusedDataPointShape ||
|
|
107
|
+
props.focusedDataPointShape ||
|
|
108
|
+
item.dataPointShape ||
|
|
109
|
+
dataPtsShape;
|
|
110
|
+
dataPointsWidth =
|
|
111
|
+
item.focusedDataPointWidth ||
|
|
112
|
+
props.focusedDataPointWidth ||
|
|
113
|
+
item.dataPointWidth ||
|
|
114
|
+
dataPtsWidth;
|
|
115
|
+
dataPointsHeight =
|
|
116
|
+
item.focusedDataPointHeight ||
|
|
117
|
+
props.focusedDataPointHeight ||
|
|
118
|
+
item.dataPointHeight ||
|
|
119
|
+
dataPtsHeight;
|
|
120
|
+
dataPointsColor =
|
|
121
|
+
item.focusedDataPointColor || props.focusedDataPointColor || 'orange';
|
|
122
|
+
dataPointsRadius =
|
|
123
|
+
item.focusedDataPointRadius ||
|
|
124
|
+
props.focusedDataPointRadius ||
|
|
125
|
+
item.dataPointRadius ||
|
|
126
|
+
dataPtsRadius;
|
|
127
|
+
if (showTextOnFocus) {
|
|
128
|
+
text = item.dataPointText;
|
|
129
|
+
}
|
|
130
|
+
customDataPoint =
|
|
131
|
+
item.focusedCustomDataPoint ||
|
|
132
|
+
props.focusedCustomDataPoint ||
|
|
133
|
+
item.customDataPoint ||
|
|
134
|
+
props.customDataPoint;
|
|
135
|
+
dataPointLabelComponent =
|
|
136
|
+
item.focusedDataPointLabelComponent || item.dataPointLabelComponent;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
dataPointsShape = item.dataPointShape || dataPtsShape;
|
|
140
|
+
dataPointsWidth = item.dataPointWidth || dataPtsWidth;
|
|
141
|
+
dataPointsHeight = item.dataPointHeight || dataPtsHeight;
|
|
142
|
+
dataPointsColor = item.dataPointColor || dataPtsColor;
|
|
143
|
+
dataPointsRadius = item.dataPointRadius || dataPtsRadius;
|
|
144
|
+
if (showTextOnFocus) {
|
|
145
|
+
text = '';
|
|
146
|
+
}
|
|
147
|
+
customDataPoint = item.customDataPoint || props.customDataPoint;
|
|
148
|
+
dataPointLabelComponent = item.dataPointLabelComponent;
|
|
149
|
+
}
|
|
150
|
+
var currentStripHeight = (_a = item.stripHeight) !== null && _a !== void 0 ? _a : stripHeight;
|
|
151
|
+
var currentStripWidth = (_b = item.stripWidth) !== null && _b !== void 0 ? _b : stripWidth;
|
|
152
|
+
var currentStripOpacity = (_c = item.stripOpacity) !== null && _c !== void 0 ? _c : stripOpacity;
|
|
153
|
+
var currentStripColor = item.stripColor || stripColor;
|
|
154
|
+
return (_jsxs(Fragment, { children: [focusEnabled ? (_jsx(_Fragment, { children: unFocusOnPressOut ? (_jsx(Rect, { onPressIn: function () { return onStripPress(item, index); }, onPressOut: function () {
|
|
155
|
+
return setTimeout(function () { return setSelectedIndex(-1); }, delayBeforeUnFocus);
|
|
156
|
+
}, x: initialSpacing + (spacing * index - spacing / 2), y: 8, width: spacing, height: containerHeight, fill: 'none' })) : (_jsx(Rect, { onPress: function () { return onStripPress(item, index); }, x: initialSpacing + (spacing * index - spacing / 2), y: 8, width: spacing, height: containerHeight, fill: 'none' })) })) : null, item.showStrip ||
|
|
157
|
+
(focusEnabled && index === selectedIndex && showStripOnFocus) ? (_jsx(Rect, { x: initialSpacing + (spacing * index - dataPointsWidth / 2), y: currentStripHeight
|
|
158
|
+
? containerHeight - currentStripHeight + 8
|
|
159
|
+
: containerHeight -
|
|
160
|
+
dataPointsHeight / 2 +
|
|
161
|
+
20 -
|
|
162
|
+
(item.value * containerHeight) / maxValue, width: currentStripWidth, height: currentStripHeight ||
|
|
163
|
+
containerHeight - dataPointsHeight / 2 + 20, opacity: currentStripOpacity, fill: currentStripColor })) : null, customDataPoint ? (_jsx(View, { style: [
|
|
164
|
+
styles.customDataPointContainer,
|
|
165
|
+
{
|
|
166
|
+
height: dataPointsHeight,
|
|
167
|
+
width: dataPointsWidth,
|
|
168
|
+
top: containerHeight - (item.value * containerHeight) / maxValue,
|
|
169
|
+
left: getX(index) - dataPointsWidth,
|
|
170
|
+
},
|
|
171
|
+
], children: customDataPoint() })) : null, dataPointsShape === 'rectangular' ? (_jsx(Fragment, { children: customDataPoint ? null : (_jsx(Rect, { x: getX(index) - dataPointsWidth, y: extendedContainerHeight +
|
|
172
|
+
dataPointsHeight / 2 -
|
|
173
|
+
(item.value * containerHeight) / maxValue, width: dataPointsWidth, height: dataPointsHeight, fill: showDataPointOnFocus
|
|
174
|
+
? index === selectedIndex
|
|
175
|
+
? dataPointsColor
|
|
176
|
+
: 'none'
|
|
177
|
+
: dataPointsColor, onPress: function () {
|
|
178
|
+
item.onPress
|
|
179
|
+
? item.onPress(item, index)
|
|
180
|
+
: props.onPress
|
|
181
|
+
? props.onPress(item, index)
|
|
182
|
+
: null;
|
|
183
|
+
} })) }, index)) : (_jsx(Fragment, { children: customDataPoint ? null : (_jsx(Circle, { cx: getX(index), cy: getY(index), r: dataPointsRadius, fill: showDataPointOnFocus
|
|
184
|
+
? index === selectedIndex
|
|
185
|
+
? dataPointsColor
|
|
186
|
+
: 'none'
|
|
187
|
+
: dataPointsColor, onPress: function () {
|
|
188
|
+
item.onPress
|
|
189
|
+
? item.onPress(item, index)
|
|
190
|
+
: props.onPress
|
|
191
|
+
? props.onPress(item, index)
|
|
192
|
+
: null;
|
|
193
|
+
} })) }, index)), dataPointLabelComponent ? (!showTextOnFocus || index === selectedIndex ? (_jsx(View, { style: [
|
|
194
|
+
styles.customDataPointContainer,
|
|
195
|
+
{
|
|
196
|
+
top: containerHeight +
|
|
197
|
+
(item.dataPointLabelShiftY ||
|
|
198
|
+
props.dataPointLabelShiftY ||
|
|
199
|
+
0) -
|
|
200
|
+
(item.value * containerHeight) / maxValue,
|
|
201
|
+
left: initialSpacing +
|
|
202
|
+
(item.dataPointLabelShiftX ||
|
|
203
|
+
props.dataPointLabelShiftX ||
|
|
204
|
+
0) -
|
|
205
|
+
(item.dataPointLabelWidth
|
|
206
|
+
? item.dataPointLabelWidth + 20
|
|
207
|
+
: props.dataPointLabelWidth
|
|
208
|
+
? props.dataPointLabelWidth + 20
|
|
209
|
+
: 50) /
|
|
210
|
+
2 +
|
|
211
|
+
spacing * index,
|
|
212
|
+
},
|
|
213
|
+
], children: dataPointLabelComponent() })) : null) : text || item.dataPointText ? (!showTextOnFocus || index === selectedIndex ? (_jsx(CanvasText, { fill: item.textColor || textColor, fontSize: item.textFontSize || textFontSize, x: initialSpacing -
|
|
214
|
+
dataPointsWidth +
|
|
215
|
+
spacing * index +
|
|
216
|
+
(item.textShiftX || props.textShiftX || 0), y: extendedContainerHeight -
|
|
217
|
+
dataPointsHeight / 2 -
|
|
218
|
+
(item.value * containerHeight) / maxValue +
|
|
219
|
+
(item.textShiftY || props.textShiftY || 0), children: !showTextOnFocus ? item.dataPointText : text })) : null) : null] }, index));
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
var renderSpecificVerticalLines = function (dataForRender) {
|
|
223
|
+
return dataForRender.map(function (item, index) {
|
|
224
|
+
if (item.showVerticalLine) {
|
|
225
|
+
return (_jsx(Rect, { x: initialSpacing -
|
|
226
|
+
(item.verticalLineThickness || 1) / 2 -
|
|
227
|
+
1 +
|
|
228
|
+
spacing * index, y: item.verticalLineUptoDataPoint
|
|
229
|
+
? containerHeight -
|
|
230
|
+
(item.value * containerHeight) / maxValue +
|
|
231
|
+
10
|
|
232
|
+
: -xAxisThickness, width: item.verticalLineThickness || 1, height: item.verticalLineUptoDataPoint
|
|
233
|
+
? (item.value * containerHeight) / maxValue - xAxisThickness
|
|
234
|
+
: containerHeight + 10 - xAxisThickness, fill: item.verticalLineColor || 'lightgray' }, index));
|
|
235
|
+
}
|
|
236
|
+
return null;
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
var lineSvgComponent = function (pointsArray, currentLineThickness, color, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray) {
|
|
240
|
+
return (_jsxs(Svg, { children: [strokeDashArray &&
|
|
241
|
+
strokeDashArray.length === 2 &&
|
|
242
|
+
typeof strokeDashArray[0] === 'number' &&
|
|
243
|
+
typeof strokeDashArray[1] === 'number'
|
|
244
|
+
? pointsArray.map(function (points, index) { return (_jsx(Path, { d: points.points, fill: "none", stroke: points.color === 'green' ? color : colorNegative, strokeWidth: currentLineThickness || thickness, strokeDasharray: strokeDashArray }, index)); })
|
|
245
|
+
: pointsArray.map(function (points, index) {
|
|
246
|
+
return (_jsx(Path, { d: points.points, fill: "none", stroke: points.color === 'green' ? color : colorNegative, strokeWidth: currentLineThickness || thickness }, index));
|
|
247
|
+
}), areaChart && (_jsxs(_Fragment, { children: [_jsxs(LinearGradient, { id: "Gradient", x1: "0", y1: "0", x2: gradientDirection === 'horizontal' ? '1' : '0', y2: gradientDirection === 'vertical' ? '1' : '0', children: [_jsx(Stop, { offset: "0", stopColor: startFillColor, stopOpacity: startOpacity.toString() }), _jsx(Stop, { offset: "1", stopColor: endFillColor, stopOpacity: endOpacity.toString() })] }), _jsxs(LinearGradient, { id: "GradientNegative", x1: "0", y1: "0", x2: gradientDirection === 'horizontal' ? '1' : '0', y2: gradientDirection === 'vertical' ? '1' : '0', children: [_jsx(Stop, { offset: "1", stopColor: startFillColorNegative, stopOpacity: startOpacityNegative.toString() }), _jsx(Stop, { offset: "0", stopColor: endFillColorNegative, stopOpacity: endOpacityNegative.toString() })] })] })), areaChart
|
|
248
|
+
? fillPointsArray.map(function (item, index) {
|
|
249
|
+
return (_jsx(Path, { d: item.points, fill: item.color === 'green'
|
|
250
|
+
? 'url(#Gradient)'
|
|
251
|
+
: 'url(#GradientNegative)', stroke: 'none', strokeWidth: currentLineThickness || thickness }, index));
|
|
252
|
+
})
|
|
253
|
+
: null, renderSpecificVerticalLines(data), !hideDataPoints1
|
|
254
|
+
? renderDataPoints(data, dataPointsShape1, dataPointsWidth1, dataPointsHeight1, dataPointsColor1, dataPointsRadius1, textColor1, textFontSize1, startIndex1, endIndex1)
|
|
255
|
+
: null] }));
|
|
256
|
+
};
|
|
257
|
+
var renderLine = function (zIndex, pointsArray, currentLineThickness, color, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray) {
|
|
258
|
+
return (_jsx(View, { style: {
|
|
259
|
+
position: 'absolute',
|
|
260
|
+
height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
261
|
+
bottom: 60 + labelsExtraHeight,
|
|
262
|
+
width: totalWidth,
|
|
263
|
+
zIndex: zIndex,
|
|
264
|
+
}, children: pointsArray.length
|
|
265
|
+
? lineSvgComponent(pointsArray, currentLineThickness, color, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray)
|
|
266
|
+
: null }));
|
|
267
|
+
};
|
|
268
|
+
var renderAnimatedLine = function (zIndex, points, animatedWidth, currentLineThickness, color, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray) {
|
|
269
|
+
return (_jsx(Animated.View, { style: {
|
|
270
|
+
position: 'absolute',
|
|
271
|
+
height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
272
|
+
bottom: 60, //stepHeight * -0.5 + xAxisThickness,
|
|
273
|
+
width: animatedWidth,
|
|
274
|
+
zIndex: zIndex,
|
|
275
|
+
// backgroundColor: 'wheat',
|
|
276
|
+
}, children: lineSvgComponent(points, currentLineThickness, color, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray) }));
|
|
277
|
+
};
|
|
278
|
+
var renderChartContent = function () {
|
|
279
|
+
return (_jsxs(_Fragment, { children: [isAnimated
|
|
280
|
+
? renderAnimatedLine(zIndex, pointsArray, animatedWidth, thickness1, color, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray1)
|
|
281
|
+
: renderLine(zIndex, pointsArray, thickness1, color, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray1), data.map(function (item, index) {
|
|
282
|
+
return (_jsx(View, { children: isAnimated
|
|
283
|
+
? renderAnimatedLabel(index, item.label ||
|
|
284
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
285
|
+
? props.xAxisLabelTexts[index]
|
|
286
|
+
: ''), item.labelTextStyle || props.xAxisLabelTextStyle, item.labelComponent)
|
|
287
|
+
: renderLabel(index, item.label ||
|
|
288
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
289
|
+
? props.xAxisLabelTexts[index]
|
|
290
|
+
: ''), item.labelTextStyle || props.xAxisLabelTextStyle, item.labelComponent) }, index));
|
|
291
|
+
})] }));
|
|
292
|
+
};
|
|
293
|
+
return (_jsx(BarAndLineChartsWrapper, __assign({}, barAndLineChartsWrapperProps, { scrollRef: scrollRef, animatedWidth: animatedWidth, renderChartContent: renderChartContent, remainingScrollViewProps: {
|
|
294
|
+
onScroll: function (ev) { var _a; return (_a = props.onScroll) === null || _a === void 0 ? void 0 : _a.call(props, ev); },
|
|
295
|
+
bounces: props.bounces,
|
|
296
|
+
overScrollMode: (_b = props.overScrollMode) !== null && _b !== void 0 ? _b : 'auto',
|
|
297
|
+
} })));
|
|
298
|
+
};
|