react-native-gifted-charts 1.4.22 → 1.4.24
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/dist/BarChart/Animated2DWithGradient.js +1 -1
- package/dist/BarChart/RenderBars.js +6 -6
- package/dist/BarChart/RenderStackBars.js +12 -5
- package/dist/BarChart/index.js +9 -6
- package/dist/Components/common/StripAndLabel.d.ts +2 -1
- package/dist/Components/common/StripAndLabel.js +3 -3
- package/dist/LineChart/LineChartBicolor.js +5 -5
- package/dist/LineChart/index.js +78 -59
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +8 -0
- package/package.json +2 -2
|
@@ -28,7 +28,7 @@ var Animated2DWithGradient = function (props) {
|
|
|
28
28
|
var _a;
|
|
29
29
|
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, barWidth = props.barWidth, barStyle = props.barStyle, item = props.item, index = props.index, opacity = props.opacity, animationDuration = props.animationDuration, noGradient = props.noGradient, noAnimation = props.noAnimation, barMarginBottom = props.barMarginBottom, 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
30
|
var _b = __read(useState(noAnimation ? props.height : 0.2), 2), height = _b[0], setHeight = _b[1];
|
|
31
|
-
var _c = __read(useState(noAnimation
|
|
31
|
+
var _c = __read(useState(!noAnimation), 2), initialRender = _c[0], setInitialRender = _c[1];
|
|
32
32
|
useEffect(function () {
|
|
33
33
|
if (!noAnimation) {
|
|
34
34
|
if (initialRender) {
|
|
@@ -25,10 +25,10 @@ var RenderBars = function (props) {
|
|
|
25
25
|
? negativeStepHeight / negativeStepValue
|
|
26
26
|
: stepHeight / stepValue;
|
|
27
27
|
var barHeight = Math.max(minHeight, Math.abs(item.value) * heightFactor - xAxisThickness);
|
|
28
|
-
var _h = getPropsForAnimated2DWithGradient(__assign(__assign({}, props), { barHeight: barHeight })), commonStyleForBar = _h.commonStyleForBar, barStyleWithBackground = _h.barStyleWithBackground,
|
|
28
|
+
var _h = getPropsForAnimated2DWithGradient(__assign(__assign({}, props), { barHeight: barHeight })), commonStyleForBar = _h.commonStyleForBar, barStyleWithBackground = _h.barStyleWithBackground, commonPropsFor2dAnd3dBars = _h.commonPropsFor2dAnd3dBars, isFocused = _h.isFocused, focusedBarConfig = _h.focusedBarConfig, localFrontColor = _h.localFrontColor;
|
|
29
29
|
var itemOrPropsBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
|
|
30
30
|
var localBarInnerComponent = isFocused
|
|
31
|
-
? (_b = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _b !== void 0 ? _b : itemOrPropsBarInnerComponent
|
|
31
|
+
? ((_b = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _b !== void 0 ? _b : itemOrPropsBarInnerComponent)
|
|
32
32
|
: itemOrPropsBarInnerComponent;
|
|
33
33
|
var barMarginBottom = item.barMarginBottom === 0
|
|
34
34
|
? 0
|
|
@@ -149,7 +149,7 @@ var RenderBars = function (props) {
|
|
|
149
149
|
var localGradientColor = item.gradientColor || props.gradientColor || 'white';
|
|
150
150
|
return (_jsxs(_Fragment, { children: [_jsx(LinearGradient, { style: commonStyleForBar, start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, colors: [
|
|
151
151
|
isFocused
|
|
152
|
-
? (_a = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.gradientColor) !== null && _a !== void 0 ? _a : localGradientColor
|
|
152
|
+
? ((_a = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.gradientColor) !== null && _a !== void 0 ? _a : localGradientColor)
|
|
153
153
|
: localGradientColor,
|
|
154
154
|
localFrontColor,
|
|
155
155
|
], 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 }), (item.barBackgroundPattern || props.barBackgroundPattern) && (_jsx(BarBackgroundPattern, { barBackgroundPatternFromItem: item.barBackgroundPattern, barBackgroundPatternFromProps: props.barBackgroundPattern, patternIdFromItem: item.patternId, patternIdFromProps: props.patternId })), (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
|
|
@@ -173,7 +173,7 @@ var RenderBars = function (props) {
|
|
|
173
173
|
{
|
|
174
174
|
// overflow: 'visible',
|
|
175
175
|
marginBottom: 60 + barMarginBottom + xAxisLabelsVerticalShift - 0.5,
|
|
176
|
-
width:
|
|
176
|
+
width: commonPropsFor2dAnd3dBars.barWidth,
|
|
177
177
|
height: barHeight,
|
|
178
178
|
marginRight: spacing,
|
|
179
179
|
},
|
|
@@ -204,7 +204,7 @@ var RenderBars = function (props) {
|
|
|
204
204
|
(pointerConfig && pointerConfig.barTouchable !== true);
|
|
205
205
|
var barContent = function () {
|
|
206
206
|
var isBarBelowXaxisAndInvisible = item.value < 0 && !noOfSectionsBelowXAxis;
|
|
207
|
-
var animated2DWithGradient = function (noGradient, noAnimation) { return (_jsx(Animated2DWithGradient, __assign({},
|
|
207
|
+
var animated2DWithGradient = function (noGradient, noAnimation) { return (_jsx(Animated2DWithGradient, __assign({}, commonPropsFor2dAnd3dBars, { animationDuration: animationDuration || 800, roundedBottom: props.roundedBottom || false, roundedTop: props.roundedTop || false, noGradient: noGradient, noAnimation: noAnimation, containerHeight: containerHeight, maxValue: maxValue, minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : 0, barMarginBottom: barMarginBottom, cappedBars: props.cappedBars, capThickness: props.capThickness, capColor: props.capColor, capRadius: props.capRadius, horizontal: horizontal, barBorderWidth: barBorderWidth, barBorderColor: barBorderColor, commonStyleForBar: commonStyleForBar, barStyleWithBackground: barStyleWithBackground }))); };
|
|
208
208
|
return (_jsxs(_Fragment, { children: [(props.showXAxisIndices || item.showXAxisIndex) && (_jsx(View, { style: {
|
|
209
209
|
zIndex: 2,
|
|
210
210
|
position: 'absolute',
|
|
@@ -213,7 +213,7 @@ var RenderBars = function (props) {
|
|
|
213
213
|
bottom: props.xAxisIndicesHeight / -2,
|
|
214
214
|
left: ((item.barWidth || barWidth) - props.xAxisIndicesWidth) / 2,
|
|
215
215
|
backgroundColor: props.xAxisIndicesColor,
|
|
216
|
-
} })), isBarBelowXaxisAndInvisible ? null : isThreeD ? (_jsx(AnimatedThreeDBar, __assign({},
|
|
216
|
+
} })), isBarBelowXaxisAndInvisible ? null : isThreeD ? (_jsx(AnimatedThreeDBar, __assign({}, commonPropsFor2dAnd3dBars, { sideWidth: item.sideWidth ||
|
|
217
217
|
props.sideWidth ||
|
|
218
218
|
(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)) : (static2DWithGradient(item))) : isAnimated ? (animated2DWithGradient(true, false)) : (animated2DWithGradient(true, true)), isAnimated
|
|
219
219
|
? renderAnimatedLabel(false, label, labelTextStyle, item.value)
|
|
@@ -23,11 +23,16 @@ if (Platform.OS === 'android') {
|
|
|
23
23
|
var RenderStackBars = function (props) {
|
|
24
24
|
var _a;
|
|
25
25
|
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, 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;
|
|
26
|
-
var _e = useRenderStackBars(props),
|
|
26
|
+
var _e = useRenderStackBars(props), containsNegativeValue = _e.containsNegativeValue, noAnimation = _e.noAnimation, localBarInnerComponent = _e.localBarInnerComponent, borderRadius = _e.borderRadius, borderTopLeftRadius = _e.borderTopLeftRadius, borderTopRightRadius = _e.borderTopRightRadius, borderBottomLeftRadius = _e.borderBottomLeftRadius, borderBottomRightRadius = _e.borderBottomRightRadius, disablePress = _e.disablePress, totalHeight = _e.totalHeight, height = _e.height, setHeight = _e.setHeight, getBarHeight = _e.getBarHeight, getPosition = _e.getPosition, lowestBarPosition = _e.lowestBarPosition, getStackBorderRadii = _e.getStackBorderRadii, tooltipProps = _e.tooltipProps;
|
|
27
27
|
var renderLabel = function (label, labelTextStyle) {
|
|
28
28
|
return (_jsx(View, { style: [
|
|
29
29
|
{
|
|
30
|
-
width: (item.
|
|
30
|
+
width: (item.labelWidth ||
|
|
31
|
+
props.labelWidth ||
|
|
32
|
+
item.stacks[0].barWidth ||
|
|
33
|
+
props.barWidth ||
|
|
34
|
+
30) +
|
|
35
|
+
spacing / 2,
|
|
31
36
|
position: 'absolute',
|
|
32
37
|
bottom: autoShiftLabelsForNegativeStacks
|
|
33
38
|
? -6 - xAxisTextNumberOfLines * 18 + lowestBarPosition
|
|
@@ -114,7 +119,7 @@ var RenderStackBars = function (props) {
|
|
|
114
119
|
: barBackgroundPattern === null || barBackgroundPattern === void 0 ? void 0 : barBackgroundPattern() }), _jsx(Rect, { stroke: "transparent", x: "1", y: "1", width: "100%", height: "100%", fill: "url(#".concat(item.patternId || patternId, ")") })] }))] }), localBarInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: localBarInnerComponent(item, index) })) : null, (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
|
|
115
120
|
{
|
|
116
121
|
position: 'absolute',
|
|
117
|
-
top:
|
|
122
|
+
top: containsNegativeValue
|
|
118
123
|
? 0
|
|
119
124
|
: (item.barWidth || props.barWidth || 30) * -1,
|
|
120
125
|
height: item.barWidth || props.barWidth || 30,
|
|
@@ -122,7 +127,9 @@ var RenderStackBars = function (props) {
|
|
|
122
127
|
justifyContent: 'center',
|
|
123
128
|
alignItems: 'center',
|
|
124
129
|
},
|
|
125
|
-
|
|
130
|
+
containsNegativeValue && {
|
|
131
|
+
transform: [{ translateY: totalHeight * 2 }],
|
|
132
|
+
},
|
|
126
133
|
horizontal &&
|
|
127
134
|
!props.intactTopLabel && { transform: [{ rotate: '270deg' }] },
|
|
128
135
|
item.topLabelContainerStyle,
|
|
@@ -138,7 +145,7 @@ var RenderStackBars = function (props) {
|
|
|
138
145
|
}, children: static2DSimple() }));
|
|
139
146
|
};
|
|
140
147
|
return (_jsxs(_Fragment, { children: [_jsxs(View, { pointerEvents: props.pointerConfig
|
|
141
|
-
? (_a = props.pointerConfig.pointerEvents) !== null && _a !== void 0 ? _a : 'none'
|
|
148
|
+
? ((_a = props.pointerConfig.pointerEvents) !== null && _a !== void 0 ? _a : 'none')
|
|
142
149
|
: 'auto', style: [
|
|
143
150
|
{
|
|
144
151
|
// overflow: 'visible',
|
package/dist/BarChart/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { screenWidth } from '../utils';
|
|
|
22
22
|
export var BarChart = function (props) {
|
|
23
23
|
var _a, _b;
|
|
24
24
|
var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
25
|
-
var
|
|
25
|
+
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
26
26
|
var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
27
27
|
var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
|
|
28
28
|
var remainingScrollViewProps = {
|
|
@@ -33,16 +33,16 @@ export var BarChart = function (props) {
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
|
-
var _c = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue,
|
|
36
|
+
var _c = useBarChart(__assign(__assign({}, props), { heightValue: heightValue, widthValue: widthValue, opacityValue: opacityValue, parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), lineConfig = _c.lineConfig, hidePointer1 = _c.hidePointer1, pointerItem = _c.pointerItem, pointerY = _c.pointerY, pointerConfig = _c.pointerConfig, pointerColor = _c.pointerColor, pointerX = _c.pointerX, pointerComponent = _c.pointerComponent, pointerHeight = _c.pointerHeight, pointerRadius = _c.pointerRadius, pointerWidth = _c.pointerWidth, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerLabelWidth = _c.pointerLabelWidth, activatePointersOnLongPress = _c.activatePointersOnLongPress, yAxisLabelWidth = _c.yAxisLabelWidth, shiftPointerLabelX = _c.shiftPointerLabelX, pointerLabelHeight = _c.pointerLabelHeight, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerStripHeight = _c.pointerStripHeight, shiftPointerLabelY = _c.shiftPointerLabelY, showPointerStrip = _c.showPointerStrip, pointerStripWidth = _c.pointerStripWidth, containerHeight = _c.containerHeight, xAxisThickness = _c.xAxisThickness, pointerStripColor = _c.pointerStripColor, pointerEvents = _c.pointerEvents, setResponderStartTime = _c.setResponderStartTime, setPointerY = _c.setPointerY, setPointerItem = _c.setPointerItem, initialSpacing = _c.initialSpacing, spacing = _c.spacing, data = _c.data, barWidth = _c.barWidth, setPointerX = _c.setPointerX, pointerIndex = _c.pointerIndex, setPointerIndex = _c.setPointerIndex, maxValue = _c.maxValue, responderStartTime = _c.responderStartTime, setResponderActive = _c.setResponderActive, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, pointerVanishDelay = _c.pointerVanishDelay, containerHeightIncludingBelowXAxis = _c.containerHeightIncludingBelowXAxis, extendedContainerHeight = _c.extendedContainerHeight, totalWidth = _c.totalWidth, stripBehindBars = _c.stripBehindBars, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, stepHeight = _c.stepHeight, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, labelsExtraHeight = _c.labelsExtraHeight, stripOverPointer = _c.stripOverPointer, pointerLabelComponent = _c.pointerLabelComponent, setSelectedIndex = _c.setSelectedIndex, isAnimated = _c.isAnimated, animationDuration = _c.animationDuration, side = _c.side, labelWidth = _c.labelWidth, isThreeD = _c.isThreeD, animatedHeight = _c.animatedHeight, appearingOpacity = _c.appearingOpacity, autoShiftLabels = _c.autoShiftLabels, getPropsCommonForBarAndStack = _c.getPropsCommonForBarAndStack, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, autoShiftLabelsForNegativeStacks = _c.autoShiftLabelsForNegativeStacks;
|
|
37
37
|
var labelsAppear = useCallback(function () {
|
|
38
|
-
|
|
39
|
-
Animated.timing(
|
|
38
|
+
opacityValue.setValue(0);
|
|
39
|
+
Animated.timing(opacityValue, {
|
|
40
40
|
toValue: 1,
|
|
41
41
|
duration: 500,
|
|
42
42
|
easing: Easing.ease,
|
|
43
43
|
useNativeDriver: false,
|
|
44
44
|
}).start();
|
|
45
|
-
}, [
|
|
45
|
+
}, [opacityValue]);
|
|
46
46
|
var decreaseWidth = useCallback(function () {
|
|
47
47
|
widthValue.setValue(0);
|
|
48
48
|
Animated.timing(widthValue, {
|
|
@@ -103,11 +103,14 @@ export var BarChart = function (props) {
|
|
|
103
103
|
scrollX: 0,
|
|
104
104
|
pointerEvents: pointerEvents,
|
|
105
105
|
isBarChart: true,
|
|
106
|
+
pointerIndex: pointerIndex,
|
|
107
|
+
width: totalWidth,
|
|
108
|
+
screenWidth: screenWidth,
|
|
106
109
|
});
|
|
107
110
|
};
|
|
108
111
|
var renderChartContent = function () {
|
|
109
112
|
if (pointerConfig) {
|
|
110
|
-
return (_jsxs(View, { onStartShouldSetResponder: function (
|
|
113
|
+
return (_jsxs(View, { onStartShouldSetResponder: function () { return !!pointerConfig; }, onMoveShouldSetResponder: function () { return !!pointerConfig; }, onResponderGrant: function (evt) {
|
|
111
114
|
var _a;
|
|
112
115
|
if (!pointerConfig)
|
|
113
116
|
return;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { StripAndLabelProps } from 'gifted-charts-core';
|
|
2
|
+
export declare const StripAndLabel: (props: StripAndLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import Svg, { Line } from 'react-native-svg';
|
|
4
|
-
import { getTopAndLeftForStripAndLabel } from 'gifted-charts-core';
|
|
4
|
+
import { getTopAndLeftForStripAndLabel, } from 'gifted-charts-core';
|
|
5
5
|
export var StripAndLabel = function (props) {
|
|
6
6
|
var _a;
|
|
7
|
-
var pointerX = props.pointerX, pointerLabelWidth = props.pointerLabelWidth, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerYLocal = props.pointerYLocal, pointerStripUptoDataPoint = props.pointerStripUptoDataPoint, pointerStripHeight = props.pointerStripHeight, pointerItemLocal = props.pointerItemLocal, showPointerStrip = props.showPointerStrip, pointerStripWidth = props.pointerStripWidth, containerHeight = props.containerHeight, xAxisThickness = props.xAxisThickness, pointerStripColor = props.pointerStripColor, pointerConfig = props.pointerConfig, pointerLabelComponent = props.pointerLabelComponent, secondaryPointerItem = props.secondaryPointerItem, pointerEvents = props.pointerEvents, isBarChart = props.isBarChart;
|
|
7
|
+
var pointerX = props.pointerX, pointerLabelWidth = props.pointerLabelWidth, pointerRadius = props.pointerRadius, pointerWidth = props.pointerWidth, pointerYLocal = props.pointerYLocal, pointerStripUptoDataPoint = props.pointerStripUptoDataPoint, pointerStripHeight = props.pointerStripHeight, pointerItemLocal = props.pointerItemLocal, showPointerStrip = props.showPointerStrip, pointerStripWidth = props.pointerStripWidth, containerHeight = props.containerHeight, xAxisThickness = props.xAxisThickness, pointerStripColor = props.pointerStripColor, pointerConfig = props.pointerConfig, pointerLabelComponent = props.pointerLabelComponent, secondaryPointerItem = props.secondaryPointerItem, pointerEvents = props.pointerEvents, isBarChart = props.isBarChart, pointerIndex = props.pointerIndex;
|
|
8
8
|
var _b = getTopAndLeftForStripAndLabel(props), top = _b.top, left = _b.left;
|
|
9
9
|
return (_jsxs(View, { style: {
|
|
10
10
|
position: 'absolute',
|
|
@@ -39,5 +39,5 @@ export var StripAndLabel = function (props) {
|
|
|
39
39
|
: containerHeight - pointerStripHeight,
|
|
40
40
|
width: pointerLabelWidth,
|
|
41
41
|
},
|
|
42
|
-
], children: pointerLabelComponent === null || pointerLabelComponent === void 0 ? void 0 : pointerLabelComponent(pointerItemLocal, secondaryPointerItem) })) : null] }));
|
|
42
|
+
], children: pointerLabelComponent === null || pointerLabelComponent === void 0 ? void 0 : pointerLabelComponent(pointerItemLocal, secondaryPointerItem, pointerIndex) })) : null] }));
|
|
43
43
|
};
|
|
@@ -22,18 +22,18 @@ export var LineChartBicolor = function (props) {
|
|
|
22
22
|
var scrollRef = useRef();
|
|
23
23
|
// const heightValue = useMemo(() => new Animated.Value(0), []);
|
|
24
24
|
var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
25
|
-
var
|
|
25
|
+
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
26
26
|
var _b = useLineChartBiColor(__assign(__assign({}, props), { parentWidth: (_a = props.parentWidth) !== null && _a !== void 0 ? _a : screenWidth })), pointsArray = _b.pointsArray, fillPointsArray = _b.fillPointsArray, selectedIndex = _b.selectedIndex, setSelectedIndex = _b.setSelectedIndex, containerHeight = _b.containerHeight, data = _b.data, labelsExtraHeight = _b.labelsExtraHeight, animationDuration = _b.animationDuration, startIndex1 = _b.startIndex1, endIndex1 = _b.endIndex1, initialSpacing = _b.initialSpacing, thickness = _b.thickness, spacing = _b.spacing, xAxisThickness = _b.xAxisThickness, dataPointsHeight1 = _b.dataPointsHeight1, dataPointsWidth1 = _b.dataPointsWidth1, dataPointsRadius1 = _b.dataPointsRadius1, dataPointsColor1 = _b.dataPointsColor1, dataPointsShape1 = _b.dataPointsShape1, areaChart = _b.areaChart, textFontSize1 = _b.textFontSize1, textColor1 = _b.textColor1, totalWidth = _b.totalWidth, maxValue = _b.maxValue, extendedContainerHeight = _b.extendedContainerHeight, getX = _b.getX, getY = _b.getY, stepHeight = _b.stepHeight, noOfSectionsBelowXAxis = _b.noOfSectionsBelowXAxis, thickness1 = _b.thickness1, zIndex = _b.zIndex, strokeDashArray1 = _b.strokeDashArray1, rotateLabel = _b.rotateLabel, isAnimated = _b.isAnimated, hideDataPoints1 = _b.hideDataPoints1, color = _b.color, colorNegative = _b.colorNegative, startFillColor = _b.startFillColor, endFillColor = _b.endFillColor, startOpacity = _b.startOpacity, endOpacity = _b.endOpacity, startFillColorNegative = _b.startFillColorNegative, endFillColorNegative = _b.endFillColorNegative, startOpacityNegative = _b.startOpacityNegative, endOpacityNegative = _b.endOpacityNegative, gradientDirection = _b.gradientDirection, xAxisTextNumberOfLines = _b.xAxisTextNumberOfLines, focusEnabled = _b.focusEnabled, showDataPointOnFocus = _b.showDataPointOnFocus, showStripOnFocus = _b.showStripOnFocus, showTextOnFocus = _b.showTextOnFocus, stripHeight = _b.stripHeight, stripWidth = _b.stripWidth, stripColor = _b.stripColor, stripOpacity = _b.stripOpacity, unFocusOnPressOut = _b.unFocusOnPressOut, delayBeforeUnFocus = _b.delayBeforeUnFocus, barAndLineChartsWrapperProps = _b.barAndLineChartsWrapperProps;
|
|
27
27
|
var labelsAppear = useCallback(function () {
|
|
28
|
-
|
|
29
|
-
Animated.timing(
|
|
28
|
+
opacityValue.setValue(0);
|
|
29
|
+
Animated.timing(opacityValue, {
|
|
30
30
|
toValue: 1,
|
|
31
31
|
duration: 500,
|
|
32
32
|
easing: Easing.ease,
|
|
33
33
|
useNativeDriver: false,
|
|
34
34
|
}).start();
|
|
35
|
-
}, [
|
|
36
|
-
var appearingOpacity =
|
|
35
|
+
}, [opacityValue]);
|
|
36
|
+
var appearingOpacity = opacityValue.interpolate({
|
|
37
37
|
inputRange: [0, 1],
|
|
38
38
|
outputRange: [0, 1],
|
|
39
39
|
});
|
package/dist/LineChart/index.js
CHANGED
|
@@ -36,57 +36,72 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
};
|
|
37
37
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
38
|
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
39
|
-
import { View, Animated, Easing, Text, Dimensions,
|
|
39
|
+
import { View, Animated, Easing, Text, Dimensions, I18nManager, } from 'react-native';
|
|
40
40
|
import { styles } from './styles';
|
|
41
|
-
import { screenWidth } from '../utils';
|
|
41
|
+
import { screenWidth, usePrevious } from '../utils';
|
|
42
42
|
import Svg, { Path, LinearGradient, Stop, Circle, Rect, Text as CanvasText, Line, } from 'react-native-svg';
|
|
43
43
|
import { getSegmentedPathObjects, getRegionPathObjects, RANGE_ENTER, RANGE_EXIT, SEGMENT_END, SEGMENT_START, STOP, useLineChart, adjustToOffset, LineDefaults, } from 'gifted-charts-core';
|
|
44
44
|
import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
|
|
45
45
|
import { StripAndLabel } from '../Components/common/StripAndLabel';
|
|
46
46
|
import { Pointer } from '../Components/common/Pointer';
|
|
47
|
-
var
|
|
48
|
-
var animations = [];
|
|
47
|
+
var AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
49
48
|
export var LineChart = function (props) {
|
|
50
|
-
var _a, _b
|
|
49
|
+
var _a, _b;
|
|
51
50
|
var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
|
|
52
|
-
var
|
|
51
|
+
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
53
52
|
var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
54
53
|
var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
55
54
|
var widthValue2 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
56
55
|
var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
57
56
|
var widthValue4 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
58
57
|
var widthValue5 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
59
|
-
|
|
60
|
-
initialData = (_e = (_d = (_c = (_b = props.dataSet) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.data) !== null && _d !== void 0 ? _d : props.data) !== null && _e !== void 0 ? _e : [];
|
|
61
|
-
animations = initialData
|
|
62
|
-
.filter(function (item) { return item.value; })
|
|
63
|
-
.map(function (item) { return new Animated.Value(item.value); });
|
|
64
|
-
}
|
|
65
|
-
var _g = useLineChart(__assign(__assign({}, props), { animations: animations, parentWidth: (_f = props.parentWidth) !== null && _f !== void 0 ? _f : screenWidth })), scrollX = _g.scrollX, setScrollX = _g.setScrollX, arrow1Points = _g.arrow1Points, arrow2Points = _g.arrow2Points, arrow3Points = _g.arrow3Points, arrow4Points = _g.arrow4Points, arrow5Points = _g.arrow5Points, secondaryArrowPoints = _g.secondaryArrowPoints, pointerIndex = _g.pointerIndex, setPointerIndex = _g.setPointerIndex, pointerX = _g.pointerX, setPointerX = _g.setPointerX, pointerY = _g.pointerY, setPointerY = _g.setPointerY, pointerItem = _g.pointerItem, setPointerItem = _g.setPointerItem, pointerY2 = _g.pointerY2, setPointerY2 = _g.setPointerY2, pointerItem2 = _g.pointerItem2, setPointerItem2 = _g.setPointerItem2, pointerY3 = _g.pointerY3, setPointerY3 = _g.setPointerY3, pointerItem3 = _g.pointerItem3, setPointerItem3 = _g.setPointerItem3, pointerY4 = _g.pointerY4, setPointerY4 = _g.setPointerY4, pointerItem4 = _g.pointerItem4, setPointerItem4 = _g.setPointerItem4, pointerY5 = _g.pointerY5, setPointerY5 = _g.setPointerY5, pointerYsForDataSet = _g.pointerYsForDataSet, setPointerYsForDataSet = _g.setPointerYsForDataSet, pointerItem5 = _g.pointerItem5, setPointerItem5 = _g.setPointerItem5, secondaryPointerY = _g.secondaryPointerY, setSecondaryPointerY = _g.setSecondaryPointerY, secondaryPointerItem = _g.secondaryPointerItem, setSecondaryPointerItem = _g.setSecondaryPointerItem, responderStartTime = _g.responderStartTime, setResponderStartTime = _g.setResponderStartTime, setResponderActive = _g.setResponderActive, points = _g.points, points2 = _g.points2, points3 = _g.points3, points4 = _g.points4, points5 = _g.points5, secondaryPoints = _g.secondaryPoints, fillPoints = _g.fillPoints, fillPoints2 = _g.fillPoints2, fillPoints3 = _g.fillPoints3, fillPoints4 = _g.fillPoints4, fillPoints5 = _g.fillPoints5, secondaryFillPoints = _g.secondaryFillPoints, pointsFromSet = _g.pointsFromSet, fillPointsFromSet = _g.fillPointsFromSet, arrowPointsFromSet = _g.arrowPointsFromSet, selectedIndex = _g.selectedIndex, setSelectedIndex = _g.setSelectedIndex, containerHeight = _g.containerHeight, data = _g.data, data2 = _g.data2, data3 = _g.data3, data4 = _g.data4, data5 = _g.data5, secondaryData = _g.secondaryData, dataSet = _g.dataSet, data0 = _g.data0, labelsExtraHeight = _g.labelsExtraHeight, animationDuration = _g.animationDuration, onDataChangeAnimationDuration = _g.onDataChangeAnimationDuration, animateTogether = _g.animateTogether, animateOnDataChange = _g.animateOnDataChange, startIndex1 = _g.startIndex1, startIndex2 = _g.startIndex2, endIndex1 = _g.endIndex1, endIndex2 = _g.endIndex2, startIndex3 = _g.startIndex3, endIndex3 = _g.endIndex3, startIndex4 = _g.startIndex4, endIndex4 = _g.endIndex4, startIndex5 = _g.startIndex5, endIndex5 = _g.endIndex5, initialSpacing = _g.initialSpacing, thickness = _g.thickness, yAxisLabelWidth = _g.yAxisLabelWidth, spacing = _g.spacing, xAxisThickness = _g.xAxisThickness, dataPointsHeight1 = _g.dataPointsHeight1, dataPointsWidth1 = _g.dataPointsWidth1, dataPointsRadius1 = _g.dataPointsRadius1, dataPointsColor1 = _g.dataPointsColor1, dataPointsShape1 = _g.dataPointsShape1, dataPointsHeight2 = _g.dataPointsHeight2, dataPointsWidth2 = _g.dataPointsWidth2, dataPointsRadius2 = _g.dataPointsRadius2, dataPointsColor2 = _g.dataPointsColor2, dataPointsShape2 = _g.dataPointsShape2, dataPointsHeight3 = _g.dataPointsHeight3, dataPointsWidth3 = _g.dataPointsWidth3, dataPointsRadius3 = _g.dataPointsRadius3, dataPointsColor3 = _g.dataPointsColor3, dataPointsShape3 = _g.dataPointsShape3, dataPointsHeight4 = _g.dataPointsHeight4, dataPointsWidth4 = _g.dataPointsWidth4, dataPointsRadius4 = _g.dataPointsRadius4, dataPointsColor4 = _g.dataPointsColor4, dataPointsShape4 = _g.dataPointsShape4, dataPointsHeight5 = _g.dataPointsHeight5, dataPointsWidth5 = _g.dataPointsWidth5, dataPointsRadius5 = _g.dataPointsRadius5, dataPointsColor5 = _g.dataPointsColor5, dataPointsShape5 = _g.dataPointsShape5, getIsNthAreaChart = _g.getIsNthAreaChart, textFontSize1 = _g.textFontSize1, textFontSize2 = _g.textFontSize2, textFontSize3 = _g.textFontSize3, textFontSize4 = _g.textFontSize4, textFontSize5 = _g.textFontSize5, textColor1 = _g.textColor1, textColor2 = _g.textColor2, textColor3 = _g.textColor3, textColor4 = _g.textColor4, textColor5 = _g.textColor5, totalWidth = _g.totalWidth, maxValue = _g.maxValue, overflowTop = _g.overflowTop, extendedContainerHeight = _g.extendedContainerHeight, getX = _g.getX, getY = _g.getY, getSecondaryY = _g.getSecondaryY, secondaryMaxValue = _g.secondaryMaxValue, showValuesAsDataPointsText = _g.showValuesAsDataPointsText, thickness1 = _g.thickness1, thickness2 = _g.thickness2, thickness3 = _g.thickness3, thickness4 = _g.thickness4, thickness5 = _g.thickness5, zIndex1 = _g.zIndex1, zIndex2 = _g.zIndex2, zIndex3 = _g.zIndex3, zIndex4 = _g.zIndex4, zIndex5 = _g.zIndex5, strokeDashArray1 = _g.strokeDashArray1, strokeDashArray2 = _g.strokeDashArray2, strokeDashArray3 = _g.strokeDashArray3, strokeDashArray4 = _g.strokeDashArray4, strokeDashArray5 = _g.strokeDashArray5, rotateLabel = _g.rotateLabel, isAnimated = _g.isAnimated, hideDataPoints1 = _g.hideDataPoints1, hideDataPoints2 = _g.hideDataPoints2, hideDataPoints3 = _g.hideDataPoints3, hideDataPoints4 = _g.hideDataPoints4, hideDataPoints5 = _g.hideDataPoints5, color1 = _g.color1, color2 = _g.color2, color3 = _g.color3, color4 = _g.color4, color5 = _g.color5, startFillColor1 = _g.startFillColor1, endFillColor1 = _g.endFillColor1, startOpacity1 = _g.startOpacity1, endOpacity1 = _g.endOpacity1, startFillColor2 = _g.startFillColor2, endFillColor2 = _g.endFillColor2, startOpacity2 = _g.startOpacity2, endOpacity2 = _g.endOpacity2, startFillColor3 = _g.startFillColor3, endFillColor3 = _g.endFillColor3, startOpacity3 = _g.startOpacity3, endOpacity3 = _g.endOpacity3, startFillColor4 = _g.startFillColor4, endFillColor4 = _g.endFillColor4, startOpacity4 = _g.startOpacity4, endOpacity4 = _g.endOpacity4, startFillColor5 = _g.startFillColor5, endFillColor5 = _g.endFillColor5, startOpacity5 = _g.startOpacity5, endOpacity5 = _g.endOpacity5, arrowStrokeWidth1 = _g.arrowStrokeWidth1, arrowStrokeColor1 = _g.arrowStrokeColor1, arrowFillColor1 = _g.arrowFillColor1, arrowStrokeWidth2 = _g.arrowStrokeWidth2, arrowStrokeColor2 = _g.arrowStrokeColor2, arrowFillColor2 = _g.arrowFillColor2, arrowStrokeWidth3 = _g.arrowStrokeWidth3, arrowStrokeColor3 = _g.arrowStrokeColor3, arrowFillColor3 = _g.arrowFillColor3, arrowStrokeWidth4 = _g.arrowStrokeWidth4, arrowStrokeColor4 = _g.arrowStrokeColor4, arrowFillColor4 = _g.arrowFillColor4, arrowStrokeWidth5 = _g.arrowStrokeWidth5, arrowStrokeColor5 = _g.arrowStrokeColor5, arrowFillColor5 = _g.arrowFillColor5, arrowStrokeWidthsFromSet = _g.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _g.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _g.arrowFillColorsFromSet, secondaryLineConfig = _g.secondaryLineConfig, gradientDirection = _g.gradientDirection, stepHeight = _g.stepHeight, noOfSectionsBelowXAxis = _g.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _g.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _g.xAxisLabelsVerticalShift, pointerConfig = _g.pointerConfig, pointerHeight = _g.pointerHeight, pointerWidth = _g.pointerWidth, pointerRadius = _g.pointerRadius, pointerColor = _g.pointerColor, pointerComponent = _g.pointerComponent, showPointerStrip = _g.showPointerStrip, pointerStripHeight = _g.pointerStripHeight, pointerStripWidth = _g.pointerStripWidth, pointerStripColor = _g.pointerStripColor, pointerStripUptoDataPoint = _g.pointerStripUptoDataPoint, pointerLabelComponent = _g.pointerLabelComponent, stripOverPointer = _g.stripOverPointer, shiftPointerLabelX = _g.shiftPointerLabelX, shiftPointerLabelY = _g.shiftPointerLabelY, pointerLabelWidth = _g.pointerLabelWidth, pointerLabelHeight = _g.pointerLabelHeight, autoAdjustPointerLabelPosition = _g.autoAdjustPointerLabelPosition, pointerVanishDelay = _g.pointerVanishDelay, activatePointersOnLongPress = _g.activatePointersOnLongPress, activatePointersDelay = _g.activatePointersDelay, persistPointer = _g.persistPointer, hidePointer1 = _g.hidePointer1, hidePointer2 = _g.hidePointer2, hidePointer3 = _g.hidePointer3, hidePointer4 = _g.hidePointer4, hidePointer5 = _g.hidePointer5, hideSecondaryPointer = _g.hideSecondaryPointer, pointerEvents = _g.pointerEvents, focusEnabled = _g.focusEnabled, showDataPointOnFocus = _g.showDataPointOnFocus, showStripOnFocus = _g.showStripOnFocus, showTextOnFocus = _g.showTextOnFocus, showDataPointLabelOnFocus = _g.showDataPointLabelOnFocus, stripHeight = _g.stripHeight, stripWidth = _g.stripWidth, stripColor = _g.stripColor, stripOpacity = _g.stripOpacity, stripStrokeDashArray = _g.stripStrokeDashArray, unFocusOnPressOut = _g.unFocusOnPressOut, delayBeforeUnFocus = _g.delayBeforeUnFocus, containerHeightIncludingBelowXAxis = _g.containerHeightIncludingBelowXAxis, lineGradient = _g.lineGradient, lineGradientDirection = _g.lineGradientDirection, lineGradientStartColor = _g.lineGradientStartColor, lineGradientEndColor = _g.lineGradientEndColor, barAndLineChartsWrapperProps = _g.barAndLineChartsWrapperProps;
|
|
58
|
+
var _c = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), scrollX = _c.scrollX, setScrollX = _c.setScrollX, arrow1Points = _c.arrow1Points, arrow2Points = _c.arrow2Points, arrow3Points = _c.arrow3Points, arrow4Points = _c.arrow4Points, arrow5Points = _c.arrow5Points, secondaryArrowPoints = _c.secondaryArrowPoints, pointerIndex = _c.pointerIndex, setPointerIndex = _c.setPointerIndex, pointerX = _c.pointerX, setPointerX = _c.setPointerX, pointerY = _c.pointerY, setPointerY = _c.setPointerY, pointerItem = _c.pointerItem, setPointerItem = _c.setPointerItem, pointerY2 = _c.pointerY2, setPointerY2 = _c.setPointerY2, pointerItem2 = _c.pointerItem2, setPointerItem2 = _c.setPointerItem2, pointerY3 = _c.pointerY3, setPointerY3 = _c.setPointerY3, pointerItem3 = _c.pointerItem3, setPointerItem3 = _c.setPointerItem3, pointerY4 = _c.pointerY4, setPointerY4 = _c.setPointerY4, pointerItem4 = _c.pointerItem4, setPointerItem4 = _c.setPointerItem4, pointerY5 = _c.pointerY5, setPointerY5 = _c.setPointerY5, pointerYsForDataSet = _c.pointerYsForDataSet, setPointerYsForDataSet = _c.setPointerYsForDataSet, pointerItem5 = _c.pointerItem5, setPointerItem5 = _c.setPointerItem5, secondaryPointerY = _c.secondaryPointerY, setSecondaryPointerY = _c.setSecondaryPointerY, secondaryPointerItem = _c.secondaryPointerItem, setSecondaryPointerItem = _c.setSecondaryPointerItem, responderStartTime = _c.responderStartTime, setResponderStartTime = _c.setResponderStartTime, setResponderActive = _c.setResponderActive, points = _c.points, points2 = _c.points2, points3 = _c.points3, points4 = _c.points4, points5 = _c.points5, secondaryPoints = _c.secondaryPoints, fillPoints = _c.fillPoints, fillPoints2 = _c.fillPoints2, fillPoints3 = _c.fillPoints3, fillPoints4 = _c.fillPoints4, fillPoints5 = _c.fillPoints5, secondaryFillPoints = _c.secondaryFillPoints, pointsFromSet = _c.pointsFromSet, fillPointsFromSet = _c.fillPointsFromSet, arrowPointsFromSet = _c.arrowPointsFromSet, selectedIndex = _c.selectedIndex, setSelectedIndex = _c.setSelectedIndex, containerHeight = _c.containerHeight, data = _c.data, data2 = _c.data2, data3 = _c.data3, data4 = _c.data4, data5 = _c.data5, secondaryData = _c.secondaryData, dataSet = _c.dataSet, data0 = _c.data0, labelsExtraHeight = _c.labelsExtraHeight, animationDuration = _c.animationDuration, onDataChangeAnimationDuration = _c.onDataChangeAnimationDuration, animateTogether = _c.animateTogether, animateOnDataChange = _c.animateOnDataChange, startIndex1 = _c.startIndex1, startIndex2 = _c.startIndex2, endIndex1 = _c.endIndex1, endIndex2 = _c.endIndex2, startIndex3 = _c.startIndex3, endIndex3 = _c.endIndex3, startIndex4 = _c.startIndex4, endIndex4 = _c.endIndex4, startIndex5 = _c.startIndex5, endIndex5 = _c.endIndex5, initialSpacing = _c.initialSpacing, thickness = _c.thickness, yAxisLabelWidth = _c.yAxisLabelWidth, spacing = _c.spacing, xAxisThickness = _c.xAxisThickness, dataPointsHeight1 = _c.dataPointsHeight1, dataPointsWidth1 = _c.dataPointsWidth1, dataPointsRadius1 = _c.dataPointsRadius1, dataPointsColor1 = _c.dataPointsColor1, dataPointsShape1 = _c.dataPointsShape1, dataPointsHeight2 = _c.dataPointsHeight2, dataPointsWidth2 = _c.dataPointsWidth2, dataPointsRadius2 = _c.dataPointsRadius2, dataPointsColor2 = _c.dataPointsColor2, dataPointsShape2 = _c.dataPointsShape2, dataPointsHeight3 = _c.dataPointsHeight3, dataPointsWidth3 = _c.dataPointsWidth3, dataPointsRadius3 = _c.dataPointsRadius3, dataPointsColor3 = _c.dataPointsColor3, dataPointsShape3 = _c.dataPointsShape3, dataPointsHeight4 = _c.dataPointsHeight4, dataPointsWidth4 = _c.dataPointsWidth4, dataPointsRadius4 = _c.dataPointsRadius4, dataPointsColor4 = _c.dataPointsColor4, dataPointsShape4 = _c.dataPointsShape4, dataPointsHeight5 = _c.dataPointsHeight5, dataPointsWidth5 = _c.dataPointsWidth5, dataPointsRadius5 = _c.dataPointsRadius5, dataPointsColor5 = _c.dataPointsColor5, dataPointsShape5 = _c.dataPointsShape5, getIsNthAreaChart = _c.getIsNthAreaChart, textFontSize1 = _c.textFontSize1, textFontSize2 = _c.textFontSize2, textFontSize3 = _c.textFontSize3, textFontSize4 = _c.textFontSize4, textFontSize5 = _c.textFontSize5, textColor1 = _c.textColor1, textColor2 = _c.textColor2, textColor3 = _c.textColor3, textColor4 = _c.textColor4, textColor5 = _c.textColor5, totalWidth = _c.totalWidth, maxValue = _c.maxValue, overflowTop = _c.overflowTop, extendedContainerHeight = _c.extendedContainerHeight, getX = _c.getX, getY = _c.getY, getSecondaryY = _c.getSecondaryY, secondaryMaxValue = _c.secondaryMaxValue, showValuesAsDataPointsText = _c.showValuesAsDataPointsText, thickness1 = _c.thickness1, thickness2 = _c.thickness2, thickness3 = _c.thickness3, thickness4 = _c.thickness4, thickness5 = _c.thickness5, zIndex1 = _c.zIndex1, zIndex2 = _c.zIndex2, zIndex3 = _c.zIndex3, zIndex4 = _c.zIndex4, zIndex5 = _c.zIndex5, strokeDashArray1 = _c.strokeDashArray1, strokeDashArray2 = _c.strokeDashArray2, strokeDashArray3 = _c.strokeDashArray3, strokeDashArray4 = _c.strokeDashArray4, strokeDashArray5 = _c.strokeDashArray5, rotateLabel = _c.rotateLabel, isAnimated = _c.isAnimated, hideDataPoints1 = _c.hideDataPoints1, hideDataPoints2 = _c.hideDataPoints2, hideDataPoints3 = _c.hideDataPoints3, hideDataPoints4 = _c.hideDataPoints4, hideDataPoints5 = _c.hideDataPoints5, color1 = _c.color1, color2 = _c.color2, color3 = _c.color3, color4 = _c.color4, color5 = _c.color5, startFillColor1 = _c.startFillColor1, endFillColor1 = _c.endFillColor1, startOpacity1 = _c.startOpacity1, endOpacity1 = _c.endOpacity1, startFillColor2 = _c.startFillColor2, endFillColor2 = _c.endFillColor2, startOpacity2 = _c.startOpacity2, endOpacity2 = _c.endOpacity2, startFillColor3 = _c.startFillColor3, endFillColor3 = _c.endFillColor3, startOpacity3 = _c.startOpacity3, endOpacity3 = _c.endOpacity3, startFillColor4 = _c.startFillColor4, endFillColor4 = _c.endFillColor4, startOpacity4 = _c.startOpacity4, endOpacity4 = _c.endOpacity4, startFillColor5 = _c.startFillColor5, endFillColor5 = _c.endFillColor5, startOpacity5 = _c.startOpacity5, endOpacity5 = _c.endOpacity5, arrowStrokeWidth1 = _c.arrowStrokeWidth1, arrowStrokeColor1 = _c.arrowStrokeColor1, arrowFillColor1 = _c.arrowFillColor1, arrowStrokeWidth2 = _c.arrowStrokeWidth2, arrowStrokeColor2 = _c.arrowStrokeColor2, arrowFillColor2 = _c.arrowFillColor2, arrowStrokeWidth3 = _c.arrowStrokeWidth3, arrowStrokeColor3 = _c.arrowStrokeColor3, arrowFillColor3 = _c.arrowFillColor3, arrowStrokeWidth4 = _c.arrowStrokeWidth4, arrowStrokeColor4 = _c.arrowStrokeColor4, arrowFillColor4 = _c.arrowFillColor4, arrowStrokeWidth5 = _c.arrowStrokeWidth5, arrowStrokeColor5 = _c.arrowStrokeColor5, arrowFillColor5 = _c.arrowFillColor5, arrowStrokeWidthsFromSet = _c.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _c.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _c.arrowFillColorsFromSet, secondaryLineConfig = _c.secondaryLineConfig, gradientDirection = _c.gradientDirection, stepHeight = _c.stepHeight, noOfSectionsBelowXAxis = _c.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _c.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _c.xAxisLabelsVerticalShift, pointerConfig = _c.pointerConfig, pointerHeight = _c.pointerHeight, pointerWidth = _c.pointerWidth, pointerRadius = _c.pointerRadius, pointerColor = _c.pointerColor, pointerComponent = _c.pointerComponent, showPointerStrip = _c.showPointerStrip, pointerStripHeight = _c.pointerStripHeight, pointerStripWidth = _c.pointerStripWidth, pointerStripColor = _c.pointerStripColor, pointerStripUptoDataPoint = _c.pointerStripUptoDataPoint, pointerLabelComponent = _c.pointerLabelComponent, stripOverPointer = _c.stripOverPointer, shiftPointerLabelX = _c.shiftPointerLabelX, shiftPointerLabelY = _c.shiftPointerLabelY, pointerLabelWidth = _c.pointerLabelWidth, pointerLabelHeight = _c.pointerLabelHeight, autoAdjustPointerLabelPosition = _c.autoAdjustPointerLabelPosition, pointerVanishDelay = _c.pointerVanishDelay, activatePointersOnLongPress = _c.activatePointersOnLongPress, activatePointersDelay = _c.activatePointersDelay, persistPointer = _c.persistPointer, hidePointer1 = _c.hidePointer1, hidePointer2 = _c.hidePointer2, hidePointer3 = _c.hidePointer3, hidePointer4 = _c.hidePointer4, hidePointer5 = _c.hidePointer5, hideSecondaryPointer = _c.hideSecondaryPointer, pointerEvents = _c.pointerEvents, focusEnabled = _c.focusEnabled, showDataPointOnFocus = _c.showDataPointOnFocus, showStripOnFocus = _c.showStripOnFocus, showTextOnFocus = _c.showTextOnFocus, showDataPointLabelOnFocus = _c.showDataPointLabelOnFocus, stripHeight = _c.stripHeight, stripWidth = _c.stripWidth, stripColor = _c.stripColor, stripOpacity = _c.stripOpacity, stripStrokeDashArray = _c.stripStrokeDashArray, unFocusOnPressOut = _c.unFocusOnPressOut, delayBeforeUnFocus = _c.delayBeforeUnFocus, containerHeightIncludingBelowXAxis = _c.containerHeightIncludingBelowXAxis, lineGradient = _c.lineGradient, lineGradientDirection = _c.lineGradientDirection, lineGradientStartColor = _c.lineGradientStartColor, lineGradientEndColor = _c.lineGradientEndColor, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps;
|
|
66
59
|
var secondaryXAxis = props.secondaryXAxis;
|
|
67
60
|
var widthValuesFromSet = useMemo(function () { return dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return new Animated.Value(0); }); }, []);
|
|
61
|
+
var animatedPoints = new Animated.Value(0);
|
|
62
|
+
var animatedFillPoints = new Animated.Value(0);
|
|
63
|
+
var oldPoints = usePrevious(points);
|
|
64
|
+
var oldFillPoints = usePrevious(fillPoints);
|
|
65
|
+
var animatedPath = animateOnDataChange && points && oldPoints
|
|
66
|
+
? animatedPoints.interpolate({
|
|
67
|
+
inputRange: [0, 1],
|
|
68
|
+
outputRange: [oldPoints, points],
|
|
69
|
+
})
|
|
70
|
+
: '';
|
|
71
|
+
var animatedFillPath = animateOnDataChange && fillPoints && oldFillPoints
|
|
72
|
+
? animatedFillPoints.interpolate({
|
|
73
|
+
inputRange: [0, 1],
|
|
74
|
+
outputRange: [oldFillPoints, fillPoints],
|
|
75
|
+
})
|
|
76
|
+
: '';
|
|
68
77
|
useEffect(function () {
|
|
69
78
|
if (animateOnDataChange) {
|
|
70
|
-
Animated.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
Animated.timing(animatedPoints, {
|
|
80
|
+
toValue: 1,
|
|
81
|
+
duration: onDataChangeAnimationDuration,
|
|
82
|
+
useNativeDriver: true,
|
|
83
|
+
easing: Easing.ease,
|
|
84
|
+
}).start();
|
|
85
|
+
if (props.areaChart || props.areaChart1) {
|
|
86
|
+
Animated.timing(animatedFillPoints, {
|
|
87
|
+
toValue: 1,
|
|
75
88
|
duration: onDataChangeAnimationDuration,
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
useNativeDriver: true,
|
|
90
|
+
easing: Easing.ease,
|
|
91
|
+
}).start();
|
|
92
|
+
}
|
|
78
93
|
}
|
|
79
|
-
}, [
|
|
94
|
+
}, [animatedPoints]);
|
|
80
95
|
var labelsAppear = useCallback(function () {
|
|
81
|
-
|
|
82
|
-
Animated.timing(
|
|
96
|
+
opacityValue.setValue(0);
|
|
97
|
+
Animated.timing(opacityValue, {
|
|
83
98
|
toValue: 1,
|
|
84
99
|
duration: 500,
|
|
85
100
|
easing: Easing.ease,
|
|
86
101
|
useNativeDriver: false,
|
|
87
102
|
}).start();
|
|
88
|
-
}, [
|
|
89
|
-
var appearingOpacity =
|
|
103
|
+
}, [opacityValue]);
|
|
104
|
+
var appearingOpacity = opacityValue.interpolate({
|
|
90
105
|
inputRange: [0, 1],
|
|
91
106
|
outputRange: [0, 1],
|
|
92
107
|
});
|
|
@@ -205,7 +220,7 @@ export var LineChart = function (props) {
|
|
|
205
220
|
{
|
|
206
221
|
height: rotateLabel
|
|
207
222
|
? 40
|
|
208
|
-
: (_a = props.xAxisLabelsHeight) !== null && _a !== void 0 ? _a : xAxisTextNumberOfLines * 18,
|
|
223
|
+
: ((_a = props.xAxisLabelsHeight) !== null && _a !== void 0 ? _a : xAxisTextNumberOfLines * 18),
|
|
209
224
|
position: 'absolute',
|
|
210
225
|
bottom: top
|
|
211
226
|
? containerHeight +
|
|
@@ -542,6 +557,10 @@ export var LineChart = function (props) {
|
|
|
542
557
|
secondaryPointerItem: secondaryPointerItem,
|
|
543
558
|
scrollX: scrollX,
|
|
544
559
|
pointerEvents: pointerEvents,
|
|
560
|
+
isBarChart: false,
|
|
561
|
+
pointerIndex: pointerIndex,
|
|
562
|
+
width: totalWidth,
|
|
563
|
+
screenWidth: screenWidth,
|
|
545
564
|
});
|
|
546
565
|
};
|
|
547
566
|
var getLineGradientComponent = function () {
|
|
@@ -550,8 +569,8 @@ export var LineChart = function (props) {
|
|
|
550
569
|
var getAreaGradientComponent = function (startFillColor, endFillColor, startOpacity, endOpacity) {
|
|
551
570
|
return props.areaGradientComponent ? (props.areaGradientComponent()) : (_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() })] }));
|
|
552
571
|
};
|
|
553
|
-
var lineSvgComponent = function (points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) {
|
|
554
|
-
var _a
|
|
572
|
+
var lineSvgComponent = function (points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key, hideDataPoints, data, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText) {
|
|
573
|
+
var _a;
|
|
555
574
|
if (!points)
|
|
556
575
|
return null;
|
|
557
576
|
var isCurved = points.includes('C');
|
|
@@ -564,7 +583,7 @@ export var LineChart = function (props) {
|
|
|
564
583
|
ar = getSegmentedPathObjects(points, color, currentLineThickness !== null && currentLineThickness !== void 0 ? currentLineThickness : 0, thickness, strokeDashArray !== null && strokeDashArray !== void 0 ? strokeDashArray : [], isCurved, SEGMENT_START, SEGMENT_END);
|
|
565
584
|
}
|
|
566
585
|
var lineSvgPropsOuter = {
|
|
567
|
-
d: points,
|
|
586
|
+
d: animateOnDataChange && animatedPath ? animatedPath : points,
|
|
568
587
|
fill: 'none',
|
|
569
588
|
stroke: lineGradient
|
|
570
589
|
? props.lineGradientId
|
|
@@ -597,16 +616,12 @@ export var LineChart = function (props) {
|
|
|
597
616
|
lineSvgProps.strokeDasharray = item.strokeDashArray;
|
|
598
617
|
}
|
|
599
618
|
return _jsx(Path, __assign({}, lineSvgProps), index);
|
|
600
|
-
})) : (_jsx(Path, __assign({}, lineSvgPropsOuter))), isNthAreaChart &&
|
|
601
|
-
getAreaGradientComponent(startFillColor, endFillColor, startOpacity, endOpacity), isNthAreaChart && (_jsx(
|
|
619
|
+
})) : animateOnDataChange && animatedPath ? (_jsx(AnimatedPath, __assign({}, lineSvgPropsOuter))) : (_jsx(Path, __assign({}, lineSvgPropsOuter))), isNthAreaChart &&
|
|
620
|
+
getAreaGradientComponent(startFillColor, endFillColor, startOpacity, endOpacity), isNthAreaChart ? (animateOnDataChange && animatedFillPath ? (_jsx(AnimatedPath, { onPress: props.onChartAreaPress, d: animatedFillPath, fill: props.areaGradientId
|
|
602
621
|
? "url(#".concat(props.areaGradientId, ")")
|
|
603
|
-
: "url(#Gradient)", stroke: 'transparent', strokeWidth: currentLineThickness || thickness }))
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
(_c = set.dataPointsShape) !== null && _c !== void 0 ? _c : dataPointsShape1, (_d = set.dataPointsWidth) !== null && _d !== void 0 ? _d : dataPointsWidth1, (_e = set.dataPointsHeight) !== null && _e !== void 0 ? _e : dataPointsHeight1, (_f = set.dataPointsColor) !== null && _f !== void 0 ? _f : dataPointsColor1, (_g = set.dataPointsRadius) !== null && _g !== void 0 ? _g : dataPointsRadius1, (_h = set.textColor) !== null && _h !== void 0 ? _h : textColor1, (_j = set.textFontSize) !== null && _j !== void 0 ? _j : textFontSize1, (_k = set.startIndex) !== null && _k !== void 0 ? _k : 0, (_l = set.endIndex) !== null && _l !== void 0 ? _l : set.data.length - 1, set.isSecondary, showValuesAsDataPointsText);
|
|
607
|
-
})) !== null && _b !== void 0 ? _b : null, renderDataPoints(hideDataPoints1, data, props.data, dataPointsShape1, dataPointsWidth1, dataPointsHeight1, dataPointsColor1, dataPointsRadius1, textColor1, textFontSize1, startIndex1, endIndex1, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints2, data2, props.data2, dataPointsShape2, dataPointsWidth2, dataPointsHeight2, dataPointsColor2, dataPointsRadius2, textColor2, textFontSize2, startIndex2, endIndex2, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints3, data3, props.data3, dataPointsShape3, dataPointsWidth3, dataPointsHeight3, dataPointsColor3, dataPointsRadius3, textColor3, textFontSize3, startIndex3, endIndex3, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints4, data4, props.data4, dataPointsShape4, dataPointsWidth4, dataPointsHeight4, dataPointsColor4, dataPointsRadius4, textColor4, textFontSize4, startIndex4, endIndex4, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints5, data5, props.data5, dataPointsShape5, dataPointsWidth5, dataPointsHeight5, dataPointsColor5, dataPointsRadius5, textColor5, textFontSize5, startIndex5, endIndex5, false, showValuesAsDataPointsText), (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length)
|
|
608
|
-
? renderDataPoints(secondaryLineConfig.hideDataPoints, secondaryData, props.secondaryData, secondaryLineConfig.dataPointsShape, secondaryLineConfig.dataPointsWidth, secondaryLineConfig.dataPointsHeight, secondaryLineConfig.dataPointsColor, secondaryLineConfig.dataPointsRadius, secondaryLineConfig.textColor, secondaryLineConfig.textFontSize, secondaryLineConfig.startIndex, secondaryLineConfig.endIndex, true, secondaryLineConfig.showValuesAsDataPointsText)
|
|
609
|
-
: null, showArrow && (_jsx(Path, { d: arrowPoints, fill: arrowFillColor, stroke: arrowStrokeColor, strokeWidth: arrowStrokeWidth }))] }));
|
|
622
|
+
: "url(#Gradient)", stroke: 'transparent', strokeWidth: currentLineThickness || thickness })) : (_jsx(Path, { onPress: props.onChartAreaPress, d: fillPoints, fill: props.areaGradientId
|
|
623
|
+
? "url(#".concat(props.areaGradientId, ")")
|
|
624
|
+
: "url(#Gradient)", stroke: 'transparent', strokeWidth: currentLineThickness || thickness }))) : null, renderSpecificVerticalLines(data), renderSpecificVerticalLines(data2), renderSpecificVerticalLines(data3), renderSpecificVerticalLines(data4), renderSpecificVerticalLines(data5), (_a = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return renderSpecificVerticalLines(set === null || set === void 0 ? void 0 : set.data); })) !== null && _a !== void 0 ? _a : null, renderDataPoints(hideDataPoints, data, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText), showArrow && (_jsx(Path, { d: arrowPoints, fill: arrowFillColor, stroke: arrowStrokeColor, strokeWidth: arrowStrokeWidth }))] }));
|
|
610
625
|
};
|
|
611
626
|
var activatePointers = function (x) {
|
|
612
627
|
var factor = (x - initialSpacing) / spacing;
|
|
@@ -705,7 +720,7 @@ export var LineChart = function (props) {
|
|
|
705
720
|
}
|
|
706
721
|
}
|
|
707
722
|
};
|
|
708
|
-
var renderLine = function (zIndex, points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) {
|
|
723
|
+
var renderLine = function (zIndex, points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, hideDataPoints, paramData, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, key) {
|
|
709
724
|
var _a, _b;
|
|
710
725
|
return (_jsx(View, { onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onResponderGrant: function (evt) {
|
|
711
726
|
if (!pointerConfig)
|
|
@@ -815,7 +830,8 @@ export var LineChart = function (props) {
|
|
|
815
830
|
var item = set.data[factor];
|
|
816
831
|
var y = item
|
|
817
832
|
? containerHeight -
|
|
818
|
-
(item.value * containerHeight) /
|
|
833
|
+
(item.value * containerHeight) /
|
|
834
|
+
(set.isSecondary ? secondaryMaxValue : maxValue) -
|
|
819
835
|
(pointerRadius || pointerHeight / 2) +
|
|
820
836
|
10
|
|
821
837
|
: 0;
|
|
@@ -855,9 +871,9 @@ export var LineChart = function (props) {
|
|
|
855
871
|
zIndex: zIndex,
|
|
856
872
|
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
857
873
|
width: totalWidth,
|
|
858
|
-
}, children: lineSvgComponent(points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) }, key !== null && key !== void 0 ? key : 0));
|
|
874
|
+
}, children: lineSvgComponent(points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key, hideDataPoints, paramData, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText) }, key !== null && key !== void 0 ? key : 0));
|
|
859
875
|
};
|
|
860
|
-
var renderAnimatedLine = function (zIndex, points, animatedWidth, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) {
|
|
876
|
+
var renderAnimatedLine = function (zIndex, points, animatedWidth, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, hideDataPoints, paramsData, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, key) {
|
|
861
877
|
var _a, _b;
|
|
862
878
|
return (_jsx(Animated.View, { onStartShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onResponderGrant: function (evt) {
|
|
863
879
|
if (!pointerConfig)
|
|
@@ -968,7 +984,8 @@ export var LineChart = function (props) {
|
|
|
968
984
|
var item = set.data[factor];
|
|
969
985
|
var y = item
|
|
970
986
|
? containerHeight -
|
|
971
|
-
(item.value * containerHeight) /
|
|
987
|
+
(item.value * containerHeight) /
|
|
988
|
+
(set.isSecondary ? secondaryMaxValue : maxValue) -
|
|
972
989
|
(pointerRadius || pointerHeight / 2) +
|
|
973
990
|
10
|
|
974
991
|
: 0;
|
|
@@ -1009,7 +1026,7 @@ export var LineChart = function (props) {
|
|
|
1009
1026
|
zIndex: zIndex,
|
|
1010
1027
|
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
1011
1028
|
width: animatedWidth,
|
|
1012
|
-
}, children: lineSvgComponent(points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) }, key !== null && key !== void 0 ? key : 0));
|
|
1029
|
+
}, children: lineSvgComponent(points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key, hideDataPoints, paramsData, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText) }, key !== null && key !== void 0 ? key : 0));
|
|
1013
1030
|
};
|
|
1014
1031
|
var remainingScrollViewProps = {
|
|
1015
1032
|
onScroll: function (ev) {
|
|
@@ -1027,37 +1044,39 @@ export var LineChart = function (props) {
|
|
|
1027
1044
|
return (_jsxs(_Fragment, { children: [dataSet
|
|
1028
1045
|
? pointsFromSet.length
|
|
1029
1046
|
? dataSet.map(function (set, index) {
|
|
1030
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1047
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
|
1031
1048
|
if (isAnimated) {
|
|
1032
|
-
return renderAnimatedLine((_a = set.zIndex) !== null && _a !== void 0 ? _a : zIndex1, pointsFromSet[index], animatedWidth, (_b = set.thickness) !== null && _b !== void 0 ? _b : thickness1, (_c = set.color) !== null && _c !== void 0 ? _c : color1, fillPointsFromSet[index], (_d = set.startFillColor) !== null && _d !== void 0 ? _d : startFillColor1, (_e = set.endFillColor) !== null && _e !== void 0 ? _e : endFillColor1, (_f = set.startOpacity) !== null && _f !== void 0 ? _f : startOpacity1, (_g = set.endOpacity) !== null && _g !== void 0 ? _g : endOpacity1, (_h = set.strokeDashArray) !== null && _h !== void 0 ? _h : strokeDashArray1, set.showArrow || props.showArrows, arrowPointsFromSet[index], arrowStrokeWidthsFromSet === null || arrowStrokeWidthsFromSet === void 0 ? void 0 : arrowStrokeWidthsFromSet[index], arrowStrokeColorsFromSet === null || arrowStrokeColorsFromSet === void 0 ? void 0 : arrowStrokeColorsFromSet[index], arrowFillColorsFromSet === null || arrowFillColorsFromSet === void 0 ? void 0 : arrowFillColorsFromSet[index],
|
|
1049
|
+
return renderAnimatedLine((_a = set.zIndex) !== null && _a !== void 0 ? _a : zIndex1, pointsFromSet[index], animatedWidth, (_b = set.thickness) !== null && _b !== void 0 ? _b : thickness1, (_c = set.color) !== null && _c !== void 0 ? _c : color1, fillPointsFromSet[index], (_d = set.startFillColor) !== null && _d !== void 0 ? _d : startFillColor1, (_e = set.endFillColor) !== null && _e !== void 0 ? _e : endFillColor1, (_f = set.startOpacity) !== null && _f !== void 0 ? _f : startOpacity1, (_g = set.endOpacity) !== null && _g !== void 0 ? _g : endOpacity1, (_h = set.strokeDashArray) !== null && _h !== void 0 ? _h : strokeDashArray1, set.showArrow || props.showArrows, arrowPointsFromSet[index], arrowStrokeWidthsFromSet === null || arrowStrokeWidthsFromSet === void 0 ? void 0 : arrowStrokeWidthsFromSet[index], arrowStrokeColorsFromSet === null || arrowStrokeColorsFromSet === void 0 ? void 0 : arrowStrokeColorsFromSet[index], arrowFillColorsFromSet === null || arrowFillColorsFromSet === void 0 ? void 0 : arrowFillColorsFromSet[index], (_j = set.hideDataPoints) !== null && _j !== void 0 ? _j : hideDataPoints1, set.data, adjustToOffset(set.data, -((_k = props.yAxisOffset) !== null && _k !== void 0 ? _k : 0)), // need the actual values passed by user
|
|
1050
|
+
(_l = set.dataPointsShape) !== null && _l !== void 0 ? _l : dataPointsShape1, (_m = set.dataPointsWidth) !== null && _m !== void 0 ? _m : dataPointsWidth1, (_o = set.dataPointsHeight) !== null && _o !== void 0 ? _o : dataPointsHeight1, (_p = set.dataPointsColor) !== null && _p !== void 0 ? _p : dataPointsColor1, (_q = set.dataPointsRadius) !== null && _q !== void 0 ? _q : dataPointsRadius1, (_r = set.textColor) !== null && _r !== void 0 ? _r : textColor1, (_s = set.textFontSize) !== null && _s !== void 0 ? _s : textFontSize1, (_t = set.startIndex) !== null && _t !== void 0 ? _t : 0, (_u = set.endIndex) !== null && _u !== void 0 ? _u : set.data.length - 1, set.isSecondary, showValuesAsDataPointsText, index);
|
|
1033
1051
|
}
|
|
1034
1052
|
else {
|
|
1035
|
-
return renderLine((
|
|
1053
|
+
return renderLine((_v = set.zIndex) !== null && _v !== void 0 ? _v : zIndex1, pointsFromSet[index], (_w = set.thickness) !== null && _w !== void 0 ? _w : thickness1, (_x = set.color) !== null && _x !== void 0 ? _x : color1, fillPointsFromSet[index], (_y = set.startFillColor) !== null && _y !== void 0 ? _y : startFillColor1, (_z = set.endFillColor) !== null && _z !== void 0 ? _z : endFillColor1, (_0 = set.startOpacity) !== null && _0 !== void 0 ? _0 : startOpacity1, (_1 = set.endOpacity) !== null && _1 !== void 0 ? _1 : endOpacity1, (_2 = set.strokeDashArray) !== null && _2 !== void 0 ? _2 : strokeDashArray1, set.showArrow || props.showArrows, arrowPointsFromSet[index], arrowStrokeWidthsFromSet === null || arrowStrokeWidthsFromSet === void 0 ? void 0 : arrowStrokeWidthsFromSet[index], arrowStrokeColorsFromSet === null || arrowStrokeColorsFromSet === void 0 ? void 0 : arrowStrokeColorsFromSet[index], arrowFillColorsFromSet === null || arrowFillColorsFromSet === void 0 ? void 0 : arrowFillColorsFromSet[index], (_3 = set.hideDataPoints) !== null && _3 !== void 0 ? _3 : hideDataPoints1, set.data, adjustToOffset(set.data, -((_4 = props.yAxisOffset) !== null && _4 !== void 0 ? _4 : 0)), // need the actual values passed by user
|
|
1054
|
+
(_5 = set.dataPointsShape) !== null && _5 !== void 0 ? _5 : dataPointsShape1, (_6 = set.dataPointsWidth) !== null && _6 !== void 0 ? _6 : dataPointsWidth1, (_7 = set.dataPointsHeight) !== null && _7 !== void 0 ? _7 : dataPointsHeight1, (_8 = set.dataPointsColor) !== null && _8 !== void 0 ? _8 : dataPointsColor1, (_9 = set.dataPointsRadius) !== null && _9 !== void 0 ? _9 : dataPointsRadius1, (_10 = set.textColor) !== null && _10 !== void 0 ? _10 : textColor1, (_11 = set.textFontSize) !== null && _11 !== void 0 ? _11 : textFontSize1, (_12 = set.startIndex) !== null && _12 !== void 0 ? _12 : 0, (_13 = set.endIndex) !== null && _13 !== void 0 ? _13 : set.data.length - 1, set.isSecondary, showValuesAsDataPointsText, index);
|
|
1036
1055
|
}
|
|
1037
1056
|
})
|
|
1038
1057
|
: null
|
|
1039
1058
|
: isAnimated
|
|
1040
|
-
? renderAnimatedLine(zIndex1, points, animatedWidth, thickness1, color1, fillPoints, startFillColor1, endFillColor1, startOpacity1, endOpacity1, strokeDashArray1, props.showArrow1 || props.showArrows, arrow1Points, arrowStrokeWidth1, arrowStrokeColor1, arrowFillColor1, 0)
|
|
1041
|
-
: renderLine(zIndex1, points, thickness1, color1, fillPoints, startFillColor1, endFillColor1, startOpacity1, endOpacity1, strokeDashArray1, props.showArrow1 || props.showArrows, arrow1Points, arrowStrokeWidth1, arrowStrokeColor1, arrowFillColor1, 0), secondaryPoints
|
|
1059
|
+
? renderAnimatedLine(zIndex1, points, animatedWidth, thickness1, color1, fillPoints, startFillColor1, endFillColor1, startOpacity1, endOpacity1, strokeDashArray1, props.showArrow1 || props.showArrows, arrow1Points, arrowStrokeWidth1, arrowStrokeColor1, arrowFillColor1, hideDataPoints1, data, props.data, dataPointsShape1, dataPointsWidth1, dataPointsHeight1, dataPointsColor1, dataPointsRadius1, textColor1, textFontSize1, startIndex1, endIndex1, false, showValuesAsDataPointsText, 0)
|
|
1060
|
+
: renderLine(zIndex1, points, thickness1, color1, fillPoints, startFillColor1, endFillColor1, startOpacity1, endOpacity1, strokeDashArray1, props.showArrow1 || props.showArrows, arrow1Points, arrowStrokeWidth1, arrowStrokeColor1, arrowFillColor1, hideDataPoints1, data, props.data, dataPointsShape1, dataPointsWidth1, dataPointsHeight1, dataPointsColor1, dataPointsRadius1, textColor1, textFontSize1, startIndex1, endIndex1, false, showValuesAsDataPointsText, 0), secondaryPoints
|
|
1042
1061
|
? isAnimated
|
|
1043
|
-
? renderAnimatedLine(secondaryLineConfig.zIndex, secondaryPoints, animatedWidth, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_a = secondaryLineConfig.arrowConfig) === null || _a === void 0 ? void 0 : _a.strokeWidth, (_b = secondaryLineConfig.arrowConfig) === null || _b === void 0 ? void 0 : _b.strokeColor, (_c = secondaryLineConfig.arrowConfig) === null || _c === void 0 ? void 0 : _c.fillColor, 6)
|
|
1044
|
-
: renderLine(secondaryLineConfig.zIndex, secondaryPoints, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_d = secondaryLineConfig.arrowConfig) === null || _d === void 0 ? void 0 : _d.strokeWidth, (_e = secondaryLineConfig.arrowConfig) === null || _e === void 0 ? void 0 : _e.strokeColor, (_f = secondaryLineConfig.arrowConfig) === null || _f === void 0 ? void 0 : _f.fillColor, 6)
|
|
1062
|
+
? renderAnimatedLine(secondaryLineConfig.zIndex, secondaryPoints, animatedWidth, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_a = secondaryLineConfig.arrowConfig) === null || _a === void 0 ? void 0 : _a.strokeWidth, (_b = secondaryLineConfig.arrowConfig) === null || _b === void 0 ? void 0 : _b.strokeColor, (_c = secondaryLineConfig.arrowConfig) === null || _c === void 0 ? void 0 : _c.fillColor, secondaryLineConfig.hideDataPoints, secondaryData, props.secondaryData, secondaryLineConfig.dataPointsShape, secondaryLineConfig.dataPointsWidth, secondaryLineConfig.dataPointsHeight, secondaryLineConfig.dataPointsColor, secondaryLineConfig.dataPointsRadius, secondaryLineConfig.textColor, secondaryLineConfig.textFontSize, secondaryLineConfig.startIndex, secondaryLineConfig.endIndex, true, secondaryLineConfig.showValuesAsDataPointsText, 6)
|
|
1063
|
+
: renderLine(secondaryLineConfig.zIndex, secondaryPoints, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_d = secondaryLineConfig.arrowConfig) === null || _d === void 0 ? void 0 : _d.strokeWidth, (_e = secondaryLineConfig.arrowConfig) === null || _e === void 0 ? void 0 : _e.strokeColor, (_f = secondaryLineConfig.arrowConfig) === null || _f === void 0 ? void 0 : _f.fillColor, secondaryLineConfig.hideDataPoints, secondaryData, props.secondaryData, secondaryLineConfig.dataPointsShape, secondaryLineConfig.dataPointsWidth, secondaryLineConfig.dataPointsHeight, secondaryLineConfig.dataPointsColor, secondaryLineConfig.dataPointsRadius, secondaryLineConfig.textColor, secondaryLineConfig.textFontSize, secondaryLineConfig.startIndex, secondaryLineConfig.endIndex, true, secondaryLineConfig.showValuesAsDataPointsText, 6)
|
|
1045
1064
|
: null, points2
|
|
1046
1065
|
? isAnimated
|
|
1047
|
-
? renderAnimatedLine(zIndex2, points2, animatedWidth2, thickness2, color2, fillPoints2, startFillColor2, endFillColor2, startOpacity2, endOpacity2, strokeDashArray2, props.showArrow2 || props.showArrows, arrow2Points, arrowStrokeWidth2, arrowStrokeColor2, arrowFillColor2, 1)
|
|
1048
|
-
: renderLine(zIndex2, points2, thickness2, color2, fillPoints2, startFillColor2, endFillColor2, startOpacity2, endOpacity2, strokeDashArray2, props.showArrow2 || props.showArrows, arrow2Points, arrowStrokeWidth2, arrowStrokeColor2, arrowFillColor2, 1)
|
|
1066
|
+
? renderAnimatedLine(zIndex2, points2, animatedWidth2, thickness2, color2, fillPoints2, startFillColor2, endFillColor2, startOpacity2, endOpacity2, strokeDashArray2, props.showArrow2 || props.showArrows, arrow2Points, arrowStrokeWidth2, arrowStrokeColor2, arrowFillColor2, hideDataPoints2, data2, props.data2, dataPointsShape2, dataPointsWidth2, dataPointsHeight2, dataPointsColor2, dataPointsRadius2, textColor2, textFontSize2, startIndex2, endIndex2, false, showValuesAsDataPointsText, 1)
|
|
1067
|
+
: renderLine(zIndex2, points2, thickness2, color2, fillPoints2, startFillColor2, endFillColor2, startOpacity2, endOpacity2, strokeDashArray2, props.showArrow2 || props.showArrows, arrow2Points, arrowStrokeWidth2, arrowStrokeColor2, arrowFillColor2, hideDataPoints2, data2, props.data2, dataPointsShape2, dataPointsWidth2, dataPointsHeight2, dataPointsColor2, dataPointsRadius2, textColor2, textFontSize2, startIndex2, endIndex2, false, showValuesAsDataPointsText, 1)
|
|
1049
1068
|
: null, points3
|
|
1050
1069
|
? isAnimated
|
|
1051
|
-
? renderAnimatedLine(zIndex3, points3, animatedWidth3, thickness3, color3, fillPoints3, startFillColor3, endFillColor3, startOpacity3, endOpacity3, strokeDashArray3, props.showArrow3 || props.showArrows, arrow3Points, arrowStrokeWidth3, arrowStrokeColor3, arrowFillColor3, 2)
|
|
1052
|
-
: renderLine(zIndex3, points3, thickness3, color3, fillPoints3, startFillColor3, endFillColor3, startOpacity3, endOpacity3, strokeDashArray3, props.showArrow3 || props.showArrows, arrow3Points, arrowStrokeWidth3, arrowStrokeColor3, arrowFillColor3, 2)
|
|
1070
|
+
? renderAnimatedLine(zIndex3, points3, animatedWidth3, thickness3, color3, fillPoints3, startFillColor3, endFillColor3, startOpacity3, endOpacity3, strokeDashArray3, props.showArrow3 || props.showArrows, arrow3Points, arrowStrokeWidth3, arrowStrokeColor3, arrowFillColor3, hideDataPoints3, data3, props.data3, dataPointsShape3, dataPointsWidth3, dataPointsHeight3, dataPointsColor3, dataPointsRadius3, textColor3, textFontSize3, startIndex3, endIndex3, false, showValuesAsDataPointsText, 2)
|
|
1071
|
+
: renderLine(zIndex3, points3, thickness3, color3, fillPoints3, startFillColor3, endFillColor3, startOpacity3, endOpacity3, strokeDashArray3, props.showArrow3 || props.showArrows, arrow3Points, arrowStrokeWidth3, arrowStrokeColor3, arrowFillColor3, hideDataPoints3, data3, props.data3, dataPointsShape3, dataPointsWidth3, dataPointsHeight3, dataPointsColor3, dataPointsRadius3, textColor3, textFontSize3, startIndex3, endIndex3, false, showValuesAsDataPointsText, 2)
|
|
1053
1072
|
: null, points4
|
|
1054
1073
|
? isAnimated
|
|
1055
|
-
? renderAnimatedLine(zIndex4, points4, animatedWidth4, thickness4, color4, fillPoints4, startFillColor4, endFillColor4, startOpacity4, endOpacity4, strokeDashArray4, props.showArrow4 || props.showArrows, arrow4Points, arrowStrokeWidth4, arrowStrokeColor4, arrowFillColor4, 3)
|
|
1056
|
-
: renderLine(zIndex4, points4, thickness4, color4, fillPoints4, startFillColor4, endFillColor4, startOpacity4, endOpacity4, strokeDashArray4, props.showArrow4 || props.showArrows, arrow4Points, arrowStrokeWidth4, arrowStrokeColor4, arrowFillColor4, 3)
|
|
1074
|
+
? renderAnimatedLine(zIndex4, points4, animatedWidth4, thickness4, color4, fillPoints4, startFillColor4, endFillColor4, startOpacity4, endOpacity4, strokeDashArray4, props.showArrow4 || props.showArrows, arrow4Points, arrowStrokeWidth4, arrowStrokeColor4, arrowFillColor4, hideDataPoints4, data4, props.data4, dataPointsShape4, dataPointsWidth4, dataPointsHeight4, dataPointsColor4, dataPointsRadius4, textColor4, textFontSize4, startIndex4, endIndex4, false, showValuesAsDataPointsText, 3)
|
|
1075
|
+
: renderLine(zIndex4, points4, thickness4, color4, fillPoints4, startFillColor4, endFillColor4, startOpacity4, endOpacity4, strokeDashArray4, props.showArrow4 || props.showArrows, arrow4Points, arrowStrokeWidth4, arrowStrokeColor4, arrowFillColor4, hideDataPoints4, data4, props.data4, dataPointsShape4, dataPointsWidth4, dataPointsHeight4, dataPointsColor4, dataPointsRadius4, textColor4, textFontSize4, startIndex4, endIndex4, false, showValuesAsDataPointsText, 3)
|
|
1057
1076
|
: null, points5
|
|
1058
1077
|
? isAnimated
|
|
1059
|
-
? renderAnimatedLine(zIndex5, points5, animatedWidth5, thickness5, color5, fillPoints5, startFillColor5, endFillColor5, startOpacity5, endOpacity5, strokeDashArray5, props.showArrow5 || props.showArrows, arrow5Points, arrowStrokeWidth5, arrowStrokeColor5, arrowFillColor5, 4)
|
|
1060
|
-
: renderLine(zIndex5, points5, thickness5, color5, fillPoints5, startFillColor5, endFillColor5, startOpacity5, endOpacity5, strokeDashArray5, props.showArrow5 || props.showArrows, arrow5Points, arrowStrokeWidth5, arrowStrokeColor5, arrowFillColor5, 4)
|
|
1078
|
+
? renderAnimatedLine(zIndex5, points5, animatedWidth5, thickness5, color5, fillPoints5, startFillColor5, endFillColor5, startOpacity5, endOpacity5, strokeDashArray5, props.showArrow5 || props.showArrows, arrow5Points, arrowStrokeWidth5, arrowStrokeColor5, arrowFillColor5, hideDataPoints5, data5, props.data5, dataPointsShape5, dataPointsWidth5, dataPointsHeight5, dataPointsColor5, dataPointsRadius5, textColor5, textFontSize5, startIndex5, endIndex5, false, showValuesAsDataPointsText, 4)
|
|
1079
|
+
: renderLine(zIndex5, points5, thickness5, color5, fillPoints5, startFillColor5, endFillColor5, startOpacity5, endOpacity5, strokeDashArray5, props.showArrow5 || props.showArrows, arrow5Points, arrowStrokeWidth5, arrowStrokeColor5, arrowFillColor5, hideDataPoints5, data5, props.data5, dataPointsShape5, dataPointsWidth5, dataPointsHeight5, dataPointsColor5, dataPointsRadius5, textColor5, textFontSize5, startIndex5, endIndex5, false, showValuesAsDataPointsText, 4)
|
|
1061
1080
|
: null, pointerX > 0 ? (_jsxs(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: {
|
|
1062
1081
|
position: 'absolute',
|
|
1063
1082
|
height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var _a, _b;
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
2
3
|
import { Dimensions } from 'react-native';
|
|
3
4
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
4
5
|
var versionString = require('react-native/package.json').version;
|
|
@@ -10,3 +11,10 @@ export var rnVersion = (!isNaN(msb) ? msb : 0) * 1000000 +
|
|
|
10
11
|
(!isNaN(mid) ? mid : 0) * 10000 +
|
|
11
12
|
(!isNaN(lsb) ? lsb : 0);
|
|
12
13
|
export var screenWidth = Dimensions.get('window').width;
|
|
14
|
+
export function usePrevious(value) {
|
|
15
|
+
var ref = useRef('');
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
ref.current = value; //assign the value of ref to the argument
|
|
18
|
+
}, [value]); //this code will run when the value of 'value' changes
|
|
19
|
+
return ref.current; //in the end, return the current ref value.
|
|
20
|
+
}
|
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.24",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"registry": "https://registry.npmjs.org/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"gifted-charts-core": "^0.1.
|
|
28
|
+
"gifted-charts-core": "^0.1.26"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/cli": "^7.24.8",
|