react-native-gifted-charts 1.4.47 → 1.4.48
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 +5 -5
- package/dist/BarChart/RenderBars.js +71 -34
- package/dist/BarChart/RenderStackBars.js +15 -5
- package/dist/BarChart/index.js +1 -1
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +27 -14
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +2 -2
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +2 -2
- package/dist/Components/BarSpecificComponents/tooltip.js +1 -3
- package/dist/LineChart/index.js +161 -63
- package/dist/PieChart/index.js +2 -12
- package/package.json +3 -2
|
@@ -26,7 +26,7 @@ if (Platform.OS === 'android') {
|
|
|
26
26
|
}
|
|
27
27
|
var Animated2DWithGradient = function (props) {
|
|
28
28
|
var _a, _b;
|
|
29
|
-
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, bWidth = props.barWidth, barStyle = props.barStyle, item = props.item, index = props.index, opacity = props.opacity, animationDuration = props.animationDuration, noGradient = props.noGradient, noAnimation = props.noAnimation,
|
|
29
|
+
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, bWidth = props.barWidth, barStyle = props.barStyle, item = props.item, index = props.index, opacity = props.opacity, animationDuration = props.animationDuration, noGradient = props.noGradient, noAnimation = props.noAnimation, barInnerComponent = props.barInnerComponent, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, commonStyleForBar = props.commonStyleForBar, barStyleWithBackground = props.barStyleWithBackground, yAxisOffset = props.yAxisOffset;
|
|
30
30
|
var _c = __read(useState(noAnimation ? props.height : 0.4), 2), height = _c[0], setHeight = _c[1]; // if animation fails, increase this constant value of 0.4
|
|
31
31
|
var _d = __read(useState(!noAnimation), 2), initialRender = _d[0], setInitialRender = _d[1];
|
|
32
32
|
var _e = __read(useState((_a = item.barWidth) !== null && _a !== void 0 ? _a : bWidth), 2), barWidth = _e[0], setBarWidth = _e[1]; // setting width in state for animation purpose
|
|
@@ -68,15 +68,15 @@ var Animated2DWithGradient = function (props) {
|
|
|
68
68
|
bottom: 0,
|
|
69
69
|
width: barWidth,
|
|
70
70
|
overflow: 'hidden',
|
|
71
|
-
height:
|
|
71
|
+
height: noAnimation
|
|
72
72
|
? Math.max(props.minHeight, Math.abs(height))
|
|
73
|
-
: height
|
|
73
|
+
: height,
|
|
74
74
|
}, children: _jsxs(View, { style: [
|
|
75
75
|
{
|
|
76
76
|
width: '100%',
|
|
77
|
-
height:
|
|
77
|
+
height: noAnimation
|
|
78
78
|
? Math.max(props.minHeight, Math.abs(height))
|
|
79
|
-
: height
|
|
79
|
+
: height,
|
|
80
80
|
},
|
|
81
81
|
item.barStyle || barStyle,
|
|
82
82
|
], children: [noGradient ? (_jsx(View, { style: barStyleWithBackground, children: props.cappedBars && item.value ? (_jsx(Cap, { capThicknessFromItem: item.capThickness, capThicknessFromProps: props.capThickness, capColorFromItem: item.capColor, capColorFromProps: props.capColor, capRadiusFromItem: item.capRadius, capRadiusFromProps: props.capRadius })) : null })) : (_jsx(LinearGradient, { style: commonStyleForBar, start: { x: 0, y: 0 }, end: { x: 1, y: 1 }, colors: [
|
|
@@ -13,14 +13,11 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
13
13
|
import { View, TouchableOpacity, Animated, Text } from 'react-native';
|
|
14
14
|
import AnimatedThreeDBar from '../Components/AnimatedThreeDBar';
|
|
15
15
|
import Animated2DWithGradient from './Animated2DWithGradient';
|
|
16
|
-
import Cap from '../Components/BarSpecificComponents/cap';
|
|
17
|
-
import BarBackgroundPattern from '../Components/BarSpecificComponents/barBackgroundPattern';
|
|
18
|
-
import LinearGradient from '../Components/common/LinearGradient';
|
|
19
16
|
import { getPropsForAnimated2DWithGradient, AxesAndRulesDefaults, } from 'gifted-charts-core';
|
|
20
17
|
import Tooltip from '../Components/BarSpecificComponents/tooltip';
|
|
21
18
|
var RenderBars = function (props) {
|
|
22
19
|
var _a, _b, _c, _d, _e;
|
|
23
|
-
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, minHeight = props.minHeight, spacing = props.spacing, propSpacing = props.propSpacing, side = props.side, data = props.data, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, isThreeD = props.isThreeD, isAnimated = props.isAnimated, rotateLabel = props.rotateLabel, appearingOpacity = props.appearingOpacity, animationDuration = props.animationDuration, autoShiftLabels = props.autoShiftLabels, label = props.label, secondaryLabel = props.secondaryLabel, labelTextStyle = props.labelTextStyle, secondaryLabelTextStyle = props.secondaryLabelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, leftShiftForTooltip = props.leftShiftForTooltip, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, initialSpacing = props.initialSpacing, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, _f = props.xAxisThickness, xAxisThickness = _f === void 0 ? AxesAndRulesDefaults.xAxisThickness : _f, horizontal = props.horizontal, rtl = props.rtl, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, pointerConfig = props.pointerConfig, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, yAxisOffset = props.yAxisOffset, barWidth = props.barWidth, _g = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _g === void 0 ? 0 : _g, stepHeight = props.stepHeight, stepValue = props.stepValue, negativeStepHeight = props.negativeStepHeight, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip, secondaryXAxis = props.secondaryXAxis, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue, secondaryNoOfSectionsBelowXAxis = props.secondaryNoOfSectionsBelowXAxis;
|
|
20
|
+
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, minHeight = props.minHeight, spacing = props.spacing, propSpacing = props.propSpacing, side = props.side, data = props.data, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, isThreeD = props.isThreeD, isAnimated = props.isAnimated, rotateLabel = props.rotateLabel, appearingOpacity = props.appearingOpacity, animationDuration = props.animationDuration, autoShiftLabels = props.autoShiftLabels, label = props.label, secondaryLabel = props.secondaryLabel, labelTextStyle = props.labelTextStyle, secondaryLabelTextStyle = props.secondaryLabelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, leftShiftForTooltip = props.leftShiftForTooltip, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, initialSpacing = props.initialSpacing, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, _f = props.xAxisThickness, xAxisThickness = _f === void 0 ? AxesAndRulesDefaults.xAxisThickness : _f, horizontal = props.horizontal, rtl = props.rtl, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, pointerConfig = props.pointerConfig, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, yAxisOffset = props.yAxisOffset, barWidth = props.barWidth, _g = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _g === void 0 ? 0 : _g, stepHeight = props.stepHeight, stepValue = props.stepValue, negativeStepHeight = props.negativeStepHeight, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip, secondaryXAxis = props.secondaryXAxis, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue, secondaryNoOfSectionsBelowXAxis = props.secondaryNoOfSectionsBelowXAxis, _h = props.barMarginBottom, barMarginBottom = _h === void 0 ? 0 : _h;
|
|
24
21
|
var heightFactor = item.isSecondary
|
|
25
22
|
? item.value < 0
|
|
26
23
|
? (secondaryNegativeStepHeight !== null && secondaryNegativeStepHeight !== void 0 ? secondaryNegativeStepHeight : secondaryStepHeight) /
|
|
@@ -30,14 +27,11 @@ var RenderBars = function (props) {
|
|
|
30
27
|
? negativeStepHeight / negativeStepValue
|
|
31
28
|
: stepHeight / stepValue;
|
|
32
29
|
var barHeight = Math.max(minHeight, Math.abs(item.value) * heightFactor - xAxisThickness);
|
|
33
|
-
var
|
|
30
|
+
var _j = getPropsForAnimated2DWithGradient(__assign(__assign({}, props), { barHeight: barHeight })), commonStyleForBar = _j.commonStyleForBar, barStyleWithBackground = _j.barStyleWithBackground, commonPropsFor2dAnd3dBars = _j.commonPropsFor2dAnd3dBars, isFocused = _j.isFocused, focusedBarConfig = _j.focusedBarConfig, localFrontColor = _j.localFrontColor;
|
|
34
31
|
var itemOrPropsBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
|
|
35
32
|
var localBarInnerComponent = isFocused
|
|
36
33
|
? ((_b = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _b !== void 0 ? _b : itemOrPropsBarInnerComponent)
|
|
37
34
|
: itemOrPropsBarInnerComponent;
|
|
38
|
-
var barMarginBottom = item.barMarginBottom === 0
|
|
39
|
-
? 0
|
|
40
|
-
: item.barMarginBottom || props.barMarginBottom || 0;
|
|
41
35
|
var renderLabel = function (top, label, labelTextStyle, value) {
|
|
42
36
|
var _a, _b;
|
|
43
37
|
return (_jsx(View, { style: [
|
|
@@ -156,31 +150,74 @@ var RenderBars = function (props) {
|
|
|
156
150
|
leftSpacing +=
|
|
157
151
|
((_c = data[i].spacing) !== null && _c !== void 0 ? _c : propSpacing) + (data[i].barWidth || barWidth);
|
|
158
152
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
153
|
+
// const static2DWithGradient = (item: barDataItem) => {
|
|
154
|
+
// const localGradientColor =
|
|
155
|
+
// item.gradientColor || props.gradientColor || 'white';
|
|
156
|
+
// return (
|
|
157
|
+
// <>
|
|
158
|
+
// <LinearGradient
|
|
159
|
+
// style={commonStyleForBar}
|
|
160
|
+
// start={{x: 0, y: 0}}
|
|
161
|
+
// end={{x: 0, y: 1}}
|
|
162
|
+
// colors={[
|
|
163
|
+
// isFocused
|
|
164
|
+
// ? (focusedBarConfig?.gradientColor ?? localGradientColor)
|
|
165
|
+
// : localGradientColor,
|
|
166
|
+
// localFrontColor,
|
|
167
|
+
// ]}>
|
|
168
|
+
// {props.cappedBars && item.value ? (
|
|
169
|
+
// <Cap
|
|
170
|
+
// capThicknessFromItem={item.capThickness}
|
|
171
|
+
// capThicknessFromProps={props.capThickness}
|
|
172
|
+
// capColorFromItem={item.capColor}
|
|
173
|
+
// capColorFromProps={props.capColor}
|
|
174
|
+
// capRadiusFromItem={item.capRadius}
|
|
175
|
+
// capRadiusFromProps={props.capRadius}
|
|
176
|
+
// />
|
|
177
|
+
// ) : null}
|
|
178
|
+
// </LinearGradient>
|
|
179
|
+
// {(item.barBackgroundPattern || props.barBackgroundPattern) && (
|
|
180
|
+
// <BarBackgroundPattern
|
|
181
|
+
// barBackgroundPatternFromItem={item.barBackgroundPattern}
|
|
182
|
+
// barBackgroundPatternFromProps={props.barBackgroundPattern}
|
|
183
|
+
// patternIdFromItem={item.patternId}
|
|
184
|
+
// patternIdFromProps={props.patternId}
|
|
185
|
+
// />
|
|
186
|
+
// )}
|
|
187
|
+
// {(item.topLabelComponent || showValuesAsTopLabel) && (
|
|
188
|
+
// <View
|
|
189
|
+
// style={[
|
|
190
|
+
// {
|
|
191
|
+
// position: 'absolute',
|
|
192
|
+
// top: (item.barWidth || barWidth) * -1,
|
|
193
|
+
// height: item.barWidth || barWidth,
|
|
194
|
+
// width: item.barWidth || barWidth,
|
|
195
|
+
// justifyContent:
|
|
196
|
+
// (horizontal && !intactTopLabel) || item.value < 0
|
|
197
|
+
// ? 'center'
|
|
198
|
+
// : 'flex-end',
|
|
199
|
+
// alignItems: 'center',
|
|
200
|
+
// },
|
|
201
|
+
// item.value < 0 && {transform: [{rotate: '180deg'}]},
|
|
202
|
+
// horizontal &&
|
|
203
|
+
// !intactTopLabel && {transform: [{rotate: '270deg'}]},
|
|
204
|
+
// topLabelContainerStyle ?? item.topLabelContainerStyle,
|
|
205
|
+
// ]}>
|
|
206
|
+
// {showValuesAsTopLabel ? (
|
|
207
|
+
// <Text style={topLabelTextStyle}>{item.value + yAxisOffset}</Text>
|
|
208
|
+
// ) : (
|
|
209
|
+
// item.topLabelComponent?.()
|
|
210
|
+
// )}
|
|
211
|
+
// </View>
|
|
212
|
+
// )}
|
|
213
|
+
// {localBarInnerComponent ? (
|
|
214
|
+
// <View style={{height: '100%', width: '100%'}}>
|
|
215
|
+
// {localBarInnerComponent(item, index)}
|
|
216
|
+
// </View>
|
|
217
|
+
// ) : null}
|
|
218
|
+
// </>
|
|
219
|
+
// );
|
|
220
|
+
// };
|
|
184
221
|
var barWrapperStyle = [
|
|
185
222
|
{
|
|
186
223
|
// overflow: 'visible',
|
|
@@ -216,7 +253,7 @@ var RenderBars = function (props) {
|
|
|
216
253
|
backgroundColor: props.xAxisIndicesColor,
|
|
217
254
|
} })), isBarBelowXaxisAndInvisible ? null : isThreeD ? (_jsx(AnimatedThreeDBar, __assign({}, commonPropsFor2dAnd3dBars, { sideWidth: item.sideWidth ||
|
|
218
255
|
props.sideWidth ||
|
|
219
|
-
(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)) : (
|
|
256
|
+
(item.barWidth || barWidth) / 2, side: side || 'left', sideColor: item.sideColor || props.sideColor || '', topColor: item.topColor || props.topColor || '', horizontal: horizontal, isAnimated: isAnimated, animationDuration: animationDuration || 800, selectedIndex: selectedIndex }))) : item.showGradient || props.showGradient ? (isAnimated ? (animated2DWithGradient(false, false)) : (animated2DWithGradient(false, true))) : isAnimated ? (animated2DWithGradient(true, false)) : (animated2DWithGradient(true, true)), isAnimated
|
|
220
257
|
? renderAnimatedLabel(false, label, labelTextStyle, item.value)
|
|
221
258
|
: renderLabel(false, label, labelTextStyle, item.value), secondaryXAxis
|
|
222
259
|
? isAnimated
|
|
@@ -22,7 +22,7 @@ if (Platform.OS === 'android') {
|
|
|
22
22
|
}
|
|
23
23
|
var RenderStackBars = function (props) {
|
|
24
24
|
var _a;
|
|
25
|
-
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, stackData = props.stackData, item = props.item, index = props.index, containerHeight = props.containerHeight, spacing = props.spacing, rotateLabel = props.rotateLabel, label = props.label, labelTextStyle = props.labelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, activeOpacity = props.activeOpacity, _b = props.animationDuration, animationDuration = _b === void 0 ? BarDefaults.animationDuration : _b, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, stackBorderRadius = props.stackBorderRadius, stackBorderTopLeftRadius = props.stackBorderTopLeftRadius, stackBorderTopRightRadius = props.stackBorderTopRightRadius, stackBorderBottomLeftRadius = props.stackBorderBottomLeftRadius, stackBorderBottomRightRadius = props.stackBorderBottomRightRadius, showValuesAsTopLabel = props.showValuesAsTopLabel, _c = props.autoShiftLabelsForNegativeStacks, autoShiftLabelsForNegativeStacks = _c === void 0 ? true : _c, _d = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _d === void 0 ? 0 : _d, horizontal = props.horizontal, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue;
|
|
25
|
+
var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, stackData = props.stackData, item = props.item, index = props.index, containerHeight = props.containerHeight, spacing = props.spacing, rotateLabel = props.rotateLabel, label = props.label, labelTextStyle = props.labelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, activeOpacity = props.activeOpacity, _b = props.animationDuration, animationDuration = _b === void 0 ? BarDefaults.animationDuration : _b, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, stackBorderRadius = props.stackBorderRadius, stackBorderTopLeftRadius = props.stackBorderTopLeftRadius, stackBorderTopRightRadius = props.stackBorderTopRightRadius, stackBorderBottomLeftRadius = props.stackBorderBottomLeftRadius, stackBorderBottomRightRadius = props.stackBorderBottomRightRadius, showValuesAsTopLabel = props.showValuesAsTopLabel, _c = props.autoShiftLabelsForNegativeStacks, autoShiftLabelsForNegativeStacks = _c === void 0 ? true : _c, _d = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _d === void 0 ? 0 : _d, horizontal = props.horizontal, secondaryStepHeight = props.secondaryStepHeight, secondaryStepValue = props.secondaryStepValue, secondaryNegativeStepHeight = props.secondaryNegativeStepHeight, secondaryNegativeStepValue = props.secondaryNegativeStepValue, barMarginBottom = props.barMarginBottom;
|
|
26
26
|
var _e = useRenderStackBars(__assign(__assign({}, props), { secondaryStepHeight: secondaryStepHeight, secondaryStepValue: secondaryStepValue, secondaryNegativeStepHeight: secondaryNegativeStepHeight, secondaryNegativeStepValue: secondaryNegativeStepValue })), 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: [
|
|
@@ -35,8 +35,10 @@ var RenderStackBars = function (props) {
|
|
|
35
35
|
spacing / 2,
|
|
36
36
|
position: 'absolute',
|
|
37
37
|
bottom: autoShiftLabelsForNegativeStacks
|
|
38
|
-
?
|
|
39
|
-
|
|
38
|
+
? containsNegativeValue
|
|
39
|
+
? -0
|
|
40
|
+
: -6 - xAxisTextNumberOfLines * 18
|
|
41
|
+
: -labelsDistanceFromXaxis - 6 - xAxisTextNumberOfLines * 18,
|
|
40
42
|
},
|
|
41
43
|
rotateLabel
|
|
42
44
|
? horizontal
|
|
@@ -69,6 +71,7 @@ var RenderStackBars = function (props) {
|
|
|
69
71
|
};
|
|
70
72
|
var static2DSimple = function () {
|
|
71
73
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
74
|
+
var remainingBarMarginBottom = barMarginBottom;
|
|
72
75
|
return (_jsxs(_Fragment, { children: [_jsxs(TouchableOpacity, { disabled: disablePress, activeOpacity: activeOpacity, onPress: function () {
|
|
73
76
|
setSelectedIndex(index);
|
|
74
77
|
if (item.onPress) {
|
|
@@ -101,11 +104,18 @@ var RenderStackBars = function (props) {
|
|
|
101
104
|
borderBottomLeftRadius: (_f = (_e = borderBottomLeftRadius !== null && borderBottomLeftRadius !== void 0 ? borderBottomLeftRadius : borderRadius) !== null && _e !== void 0 ? _e : stackBorderBottomLeftRadius) !== null && _f !== void 0 ? _f : stackBorderRadius,
|
|
102
105
|
borderBottomRightRadius: (_h = (_g = borderBottomRightRadius !== null && borderBottomRightRadius !== void 0 ? borderBottomRightRadius : borderRadius) !== null && _g !== void 0 ? _g : stackBorderBottomRightRadius) !== null && _h !== void 0 ? _h : stackBorderRadius,
|
|
103
106
|
overflow: lowestBarPosition ? 'visible' : 'hidden',
|
|
107
|
+
// bottom: barMarginBottom
|
|
104
108
|
},
|
|
105
109
|
], children: [item.stacks.map(function (stackItem, index) {
|
|
110
|
+
var _a;
|
|
106
111
|
var borderRadii = getStackBorderRadii(item, index);
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
// compute marginBottom here
|
|
113
|
+
var barHeight = getBarHeight(stackItem.value, 0);
|
|
114
|
+
var marginBottom = Math.max((_a = stackItem.marginBottom) !== null && _a !== void 0 ? _a : 0, remainingBarMarginBottom);
|
|
115
|
+
var deductedMargin = Math.min(barHeight, marginBottom);
|
|
116
|
+
remainingBarMarginBottom = Math.max(0, remainingBarMarginBottom - deductedMargin);
|
|
117
|
+
barHeight -= deductedMargin;
|
|
118
|
+
return (_jsxs(TouchableOpacity, { onPress: stackItem.onPress, activeOpacity: activeOpacity, disabled: disablePress || !stackItem.onPress, style: __assign({ position: 'absolute', bottom: getPosition(index, barHeight) + deductedMargin, width: '100%', height: barHeight, backgroundColor: stackItem.color || item.color || props.color || 'black', borderWidth: barBorderWidth !== null && barBorderWidth !== void 0 ? barBorderWidth : 0, borderColor: barBorderColor }, borderRadii), children: [stackItem.showGradient ||
|
|
109
119
|
item.showGradient ||
|
|
110
120
|
props.showGradient ? (_jsx(LinearGradient, { style: __assign({ position: 'absolute', width: '100%', height: '100%' }, borderRadii), start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, colors: [
|
|
111
121
|
stackItem.gradientColor ||
|
package/dist/BarChart/index.js
CHANGED
|
@@ -230,7 +230,7 @@ export var BarChart = function (props) {
|
|
|
230
230
|
else {
|
|
231
231
|
return data.map(function (item, index) {
|
|
232
232
|
var _a;
|
|
233
|
-
return (_jsx(RenderBars, __assign({ data: data, side: side, minHeight: (_a = props.minHeight) !== null && _a !== void 0 ? _a : (isAnimated && !isThreeD ? 0.1 : 0), sideWidth: props.sideWidth, labelWidth: labelWidth, isThreeD: isThreeD, isAnimated: isAnimated, animationDuration: animationDuration, animatedHeight: animatedHeight, appearingOpacity: appearingOpacity, roundedTop: props.roundedTop, roundedBottom: props.roundedBottom, frontColor: props.frontColor, sideColor: props.sideColor, topColor: props.topColor, cappedBars: props.cappedBars, capThickness: props.capThickness, capColor: props.capColor, capRadius: props.capRadius, autoShiftLabels: autoShiftLabels,
|
|
233
|
+
return (_jsx(RenderBars, __assign({ data: data, side: side, minHeight: (_a = props.minHeight) !== null && _a !== void 0 ? _a : (isAnimated && !isThreeD ? 0.1 : 0), sideWidth: props.sideWidth, labelWidth: labelWidth, isThreeD: isThreeD, isAnimated: isAnimated, animationDuration: animationDuration, animatedHeight: animatedHeight, appearingOpacity: appearingOpacity, roundedTop: props.roundedTop, roundedBottom: props.roundedBottom, frontColor: props.frontColor, sideColor: props.sideColor, topColor: props.topColor, cappedBars: props.cappedBars, capThickness: props.capThickness, capColor: props.capColor, capRadius: props.capRadius, autoShiftLabels: autoShiftLabels, barStyle: props.barStyle }, getPropsCommonForBarAndStack(item, index)), index));
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
};
|
|
@@ -29,16 +29,17 @@ import Rule from '../lineSvg';
|
|
|
29
29
|
import { styles } from '../../LineChart/styles';
|
|
30
30
|
import { getHorizSectionVals, yAxisSides, chartTypes, } from 'gifted-charts-core';
|
|
31
31
|
export var renderHorizSections = function (props) {
|
|
32
|
-
var _a, _b, _c, _d;
|
|
33
|
-
var chartType = props.chartType, width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, xAxisThickness = props.xAxisThickness, xAxisColor = props.xAxisColor, xAxisLength = props.xAxisLength, xAxisType = props.xAxisType, dashWidth = props.dashWidth, dashGap = props.dashGap, backgroundColor = props.backgroundColor, hideRules = props.hideRules, rulesLength = props.rulesLength, rulesType = props.rulesType, rulesThickness = props.rulesThickness, rulesColor = props.rulesColor, rulesConfigArray = props.rulesConfigArray, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisTextStyle = props.yAxisTextStyle, rotateYAxisTexts = props.rotateYAxisTexts, rtl = props.rtl, containerHeight = props.containerHeight, maxValue = props.maxValue, yAxisOffset = props.yAxisOffset, horizontal = props.horizontal, yAxisAtTop = props.yAxisAtTop, secondaryYAxis = props.secondaryYAxis, onlyReferenceLines = props.onlyReferenceLines, renderReferenceLines = props.renderReferenceLines, secondaryXAxis = props.secondaryXAxis;
|
|
34
|
-
var
|
|
32
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
33
|
+
var chartType = props.chartType, width = props.width, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, totalWidth = props.totalWidth, endSpacing = props.endSpacing, yAxisSide = props.yAxisSide, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, yAxisLabelWidth = props.yAxisLabelWidth, yAxisLabelContainerStyle = props.yAxisLabelContainerStyle, yAxisThickness = props.yAxisThickness, yAxisColor = props.yAxisColor, xAxisThickness = props.xAxisThickness, xAxisColor = props.xAxisColor, xAxisLength = props.xAxisLength, xAxisType = props.xAxisType, dashWidth = props.dashWidth, dashGap = props.dashGap, backgroundColor = props.backgroundColor, hideRules = props.hideRules, rulesLength = props.rulesLength, rulesType = props.rulesType, rulesThickness = props.rulesThickness, rulesColor = props.rulesColor, rulesConfigArray = props.rulesConfigArray, spacing = props.spacing, showYAxisIndices = props.showYAxisIndices, yAxisIndicesHeight = props.yAxisIndicesHeight, yAxisIndicesWidth = props.yAxisIndicesWidth, yAxisIndicesColor = props.yAxisIndicesColor, hideOrigin = props.hideOrigin, hideYAxisText = props.hideYAxisText, yAxisTextNumberOfLines = props.yAxisTextNumberOfLines, yAxisTextStyle = props.yAxisTextStyle, rotateYAxisTexts = props.rotateYAxisTexts, rtl = props.rtl, containerHeight = props.containerHeight, maxValue = props.maxValue, yAxisOffset = props.yAxisOffset, horizontal = props.horizontal, yAxisAtTop = props.yAxisAtTop, secondaryYAxis = props.secondaryYAxis, onlyReferenceLines = props.onlyReferenceLines, renderReferenceLines = props.renderReferenceLines, secondaryXAxis = props.secondaryXAxis, customBackground = props.customBackground;
|
|
34
|
+
var _k = getHorizSectionVals(props), secondaryYAxisConfig = _k.secondaryYAxisConfig, horizSections = _k.horizSections, yAxisExtraHeightAtTop = _k.yAxisExtraHeightAtTop, secondaryHorizSections = _k.secondaryHorizSections, showReferenceLine1 = _k.showReferenceLine1, referenceLine1Config = _k.referenceLine1Config, referenceLine1Position = _k.referenceLine1Position, showReferenceLine2 = _k.showReferenceLine2, referenceLine2Config = _k.referenceLine2Config, referenceLine2Position = _k.referenceLine2Position, showReferenceLine3 = _k.showReferenceLine3, referenceLine3Config = _k.referenceLine3Config, referenceLine3Position = _k.referenceLine3Position, horizSectionsBelow = _k.horizSectionsBelow, secondaryHorizSectionsBelow = _k.secondaryHorizSectionsBelow, getLabelTexts = _k.getLabelTexts, getLabelTextsForSecondaryYAxis = _k.getLabelTextsForSecondaryYAxis;
|
|
35
35
|
var secondaryYAxisExtraHeightAtBottom = 10;
|
|
36
36
|
var negativeSectionsCountDiffPrimaryVsSecondary = secondaryHorizSectionsBelow.length - horizSectionsBelow.length;
|
|
37
37
|
var isLineChart = chartType === chartTypes.LINE;
|
|
38
38
|
var isLineBiColor = chartType === chartTypes.LINE_BI_COLOR;
|
|
39
39
|
var renderAxesAndRules = function (index) {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
41
41
|
var invertedIndex = horizSections.length - index - 1;
|
|
42
|
+
var rulesConfigArrayLocal = rulesConfigArray[invertedIndex - 1];
|
|
42
43
|
return (_jsxs(View, { style: [
|
|
43
44
|
index === noOfSections
|
|
44
45
|
? styles.lastLeftPart
|
|
@@ -63,12 +64,12 @@ export var renderHorizSections = function (props) {
|
|
|
63
64
|
dashGap: dashGap,
|
|
64
65
|
type: xAxisType,
|
|
65
66
|
} })) : hideRules ? null : (_jsx(Rule, { config: {
|
|
66
|
-
thickness: (
|
|
67
|
-
color: (
|
|
68
|
-
width: (
|
|
69
|
-
dashWidth: (
|
|
70
|
-
dashGap: (
|
|
71
|
-
type: (
|
|
67
|
+
thickness: (_b = rulesConfigArrayLocal === null || rulesConfigArrayLocal === void 0 ? void 0 : rulesConfigArrayLocal.rulesThickness) !== null && _b !== void 0 ? _b : rulesThickness,
|
|
68
|
+
color: (_c = rulesConfigArrayLocal === null || rulesConfigArrayLocal === void 0 ? void 0 : rulesConfigArrayLocal.rulesColor) !== null && _c !== void 0 ? _c : rulesColor,
|
|
69
|
+
width: (_e = (_d = rulesConfigArrayLocal === null || rulesConfigArrayLocal === void 0 ? void 0 : rulesConfigArrayLocal.rulesLength) !== null && _d !== void 0 ? _d : rulesLength) !== null && _e !== void 0 ? _e : (props.width || totalWidth - spacing) + endSpacing,
|
|
70
|
+
dashWidth: (_f = rulesConfigArrayLocal === null || rulesConfigArrayLocal === void 0 ? void 0 : rulesConfigArrayLocal.dashWidth) !== null && _f !== void 0 ? _f : dashWidth,
|
|
71
|
+
dashGap: (_g = rulesConfigArrayLocal === null || rulesConfigArrayLocal === void 0 ? void 0 : rulesConfigArrayLocal.dashGap) !== null && _g !== void 0 ? _g : dashGap,
|
|
72
|
+
type: (_h = rulesConfigArrayLocal === null || rulesConfigArrayLocal === void 0 ? void 0 : rulesConfigArrayLocal.rulesType) !== null && _h !== void 0 ? _h : rulesType,
|
|
72
73
|
} })), showYAxisIndices && index !== noOfSections ? (_jsx(View, { style: {
|
|
73
74
|
position: 'absolute',
|
|
74
75
|
height: yAxisIndicesHeight,
|
|
@@ -255,7 +256,19 @@ export var renderHorizSections = function (props) {
|
|
|
255
256
|
}, children: _jsx(View, { style: { width: (width !== null && width !== void 0 ? width : totalWidth) + endSpacing }, children: referenceLines() }) })) : (_jsxs(View, { pointerEvents: "none", style: {
|
|
256
257
|
flexDirection: 'row',
|
|
257
258
|
marginTop: stepHeight / -2,
|
|
258
|
-
}, children: [_jsxs(View, { style: { width: (width !== null && width !== void 0 ? width : totalWidth) + endSpacing }, children: [
|
|
259
|
+
}, children: [_jsxs(View, { style: { width: (width !== null && width !== void 0 ? width : totalWidth) + endSpacing }, children: [customBackground ? (_jsx(View, { style: {
|
|
260
|
+
position: 'absolute',
|
|
261
|
+
backgroundColor: customBackground.color,
|
|
262
|
+
width: (_a = customBackground.width) !== null && _a !== void 0 ? _a : (width !== null && width !== void 0 ? width : totalWidth) +
|
|
263
|
+
endSpacing -
|
|
264
|
+
9 +
|
|
265
|
+
((_b = customBackground.widthAdjustment) !== null && _b !== void 0 ? _b : 0),
|
|
266
|
+
height: (_c = customBackground.height) !== null && _c !== void 0 ? _c : '100%',
|
|
267
|
+
left: yAxisLabelWidth + ((_d = customBackground.horizontalShift) !== null && _d !== void 0 ? _d : 0),
|
|
268
|
+
top: (_e = customBackground.verticalShift) !== null && _e !== void 0 ? _e : 0,
|
|
269
|
+
}, children: customBackground.component
|
|
270
|
+
? customBackground.component()
|
|
271
|
+
: null })) : null, yAxisExtraHeightAtTop ? renderExtraHeightOfYAxisAtTop() : null, horizSections.map(function (sectionItems, index) {
|
|
259
272
|
return (_jsxs(View, { style: [
|
|
260
273
|
styles.horizBar,
|
|
261
274
|
{
|
|
@@ -388,12 +401,12 @@ export var renderHorizSections = function (props) {
|
|
|
388
401
|
/************************* Render the secondary Y Axis below origin *********************/
|
|
389
402
|
/***********************************************************************************************/
|
|
390
403
|
secondaryYAxis && secondaryYAxisConfig.noOfSectionsBelowXAxis ? (_jsx(View, { style: {
|
|
391
|
-
width: (
|
|
404
|
+
width: (_f = secondaryYAxisConfig.yAxisLabelWidth) !== null && _f !== void 0 ? _f : yAxisLabelWidth,
|
|
392
405
|
left: (width ? yAxisLabelWidth : yAxisLabelWidth - spacing) -
|
|
393
|
-
((
|
|
406
|
+
((_g = secondaryYAxisConfig.yAxisLabelWidth) !== null && _g !== void 0 ? _g : yAxisLabelWidth),
|
|
394
407
|
borderColor: secondaryYAxisConfig.yAxisColor,
|
|
395
408
|
borderLeftWidth: secondaryYAxisConfig.yAxisThickness,
|
|
396
|
-
height: ((
|
|
409
|
+
height: ((_j = (_h = secondaryYAxisConfig.negativeStepHeight) !== null && _h !== void 0 ? _h : secondaryYAxisConfig.stepHeight) !== null && _j !== void 0 ? _j : stepHeight) *
|
|
397
410
|
secondaryHorizSectionsBelow.length +
|
|
398
411
|
secondaryYAxisExtraHeightAtBottom,
|
|
399
412
|
bottom: -containerHeight - stepHeight / 2 - yAxisExtraHeightAtTop,
|
|
@@ -51,7 +51,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
51
51
|
width: animatedWidth,
|
|
52
52
|
zIndex: lineBehindBars ? -1 : 100000,
|
|
53
53
|
// backgroundColor: 'wheat',
|
|
54
|
-
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", stroke: lineConfig.color, strokeWidth: lineConfig.thickness }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
54
|
+
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", stroke: lineConfig.color, strokeWidth: lineConfig.thickness, strokeDasharray: lineConfig.strokeDashArray }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
55
55
|
? renderDataPoints(dataPointsProps)
|
|
56
56
|
: renderSpecificDataPoints(specificDataPointsProps), lineConfig.showArrow && (_jsx(Path, { d: arrowPoints, fill: (_a = lineConfig.arrowConfig) === null || _a === void 0 ? void 0 : _a.fillColor, stroke: (_b = lineConfig.arrowConfig) === null || _b === void 0 ? void 0 : _b.strokeColor, strokeWidth: (_c = lineConfig.arrowConfig) === null || _c === void 0 ? void 0 : _c.strokeWidth }))] }) }));
|
|
57
57
|
};
|
|
@@ -65,7 +65,7 @@ var RenderLineInBarChart = function (props) {
|
|
|
65
65
|
width: totalWidth,
|
|
66
66
|
zIndex: lineBehindBars ? -1 : 100000,
|
|
67
67
|
// backgroundColor: 'rgba(200,150,150,0.1)'
|
|
68
|
-
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", stroke: lineConfig.color, strokeWidth: lineConfig.thickness }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
68
|
+
}, children: _jsxs(Svg, { children: [_jsx(Path, { d: points, fill: "none", stroke: lineConfig.color, strokeWidth: lineConfig.thickness, strokeDasharray: lineConfig.strokeDashArray }), renderSpecificVerticalLines(specificVerticalLinesProps), !lineConfig.hideDataPoints
|
|
69
69
|
? renderDataPoints(dataPointsProps)
|
|
70
70
|
: renderSpecificDataPoints(specificDataPointsProps), lineConfig.showArrow && (_jsx(Path, { d: arrowPoints, fill: (_a = lineConfig.arrowConfig) === null || _a === void 0 ? void 0 : _a.fillColor, stroke: (_b = lineConfig.arrowConfig) === null || _b === void 0 ? void 0 : _b.strokeColor, strokeWidth: (_c = lineConfig.arrowConfig) === null || _c === void 0 ? void 0 : _c.strokeWidth }))] }) }));
|
|
71
71
|
};
|
|
@@ -26,7 +26,7 @@ var RenderVerticalLines = function (props) {
|
|
|
26
26
|
: 0;
|
|
27
27
|
return (_jsx(View, { style: {
|
|
28
28
|
position: 'absolute',
|
|
29
|
-
height:
|
|
29
|
+
height: containerHeightIncludingBelowXAxis,
|
|
30
30
|
bottom: 60 + xAxisLabelsVerticalShift, //stepHeight * -0.5 + xAxisThickness,
|
|
31
31
|
left: 0,
|
|
32
32
|
width: totalWidth,
|
|
@@ -89,7 +89,7 @@ var RenderVerticalLines = function (props) {
|
|
|
89
89
|
: index * spacing + (initialSpacing - 2));
|
|
90
90
|
return (_jsx(Line, { x1: x, y1: extendedContainerHeight -
|
|
91
91
|
getHeightOfVerticalLine(index) +
|
|
92
|
-
heightAdjustmentDueToStrokeLinecap, x2: x, y2:
|
|
92
|
+
heightAdjustmentDueToStrokeLinecap, x2: x, y2: containerHeightIncludingBelowXAxis - heightAdjustmentDueToStrokeLinecap, stroke: verticalLinesColor || 'lightgray', strokeWidth: verticalLinesThickness || 2, strokeDasharray: verticalLinesStrokeDashArray !== null && verticalLinesStrokeDashArray !== void 0 ? verticalLinesStrokeDashArray : '', strokeLinecap: verticalLinesStrokeLinecap }, index));
|
|
93
93
|
}) }) }));
|
|
94
94
|
};
|
|
95
95
|
export default RenderVerticalLines;
|
|
@@ -32,9 +32,7 @@ var Tooltip = function (props) {
|
|
|
32
32
|
if (!autoCenterTooltip)
|
|
33
33
|
return;
|
|
34
34
|
var width = event.nativeEvent.layout.width;
|
|
35
|
-
|
|
36
|
-
if (shift > 0)
|
|
37
|
-
setLeftShiftTooltipForCentering(shift);
|
|
35
|
+
setLeftShiftTooltipForCentering((width - barWidth) / 2);
|
|
38
36
|
}, children: renderTooltip === null || renderTooltip === void 0 ? void 0 : renderTooltip(item, index) }));
|
|
39
37
|
};
|
|
40
38
|
export default Tooltip;
|
package/dist/LineChart/index.js
CHANGED
|
@@ -35,18 +35,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
35
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
36
|
};
|
|
37
37
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
|
-
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
38
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
39
39
|
import { View, Animated, Easing, Text, Dimensions, I18nManager, } from 'react-native';
|
|
40
40
|
import { styles } from './styles';
|
|
41
41
|
import { screenWidth, usePrevious } from '../utils';
|
|
42
|
-
import Svg, { Path, LinearGradient, Stop, Circle, Rect, Text as CanvasText, Line, ClipPath, Use, } from 'react-native-svg';
|
|
42
|
+
import Svg, { Path, LinearGradient, Stop, Circle, Rect, Text as CanvasText, Line, ClipPath, Use, ForeignObject, } from 'react-native-svg';
|
|
43
43
|
import { getSegmentedPathObjects, getRegionPathObjects, RANGE_ENTER, RANGE_EXIT, SEGMENT_END, SEGMENT_START, STOP, useLineChart, adjustToOffset, LineDefaults, pointsWithPaddedRepititions, } 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
47
|
var AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
48
48
|
export var LineChart = function (props) {
|
|
49
|
-
var _a, _b;
|
|
49
|
+
var _a, _b, _c;
|
|
50
50
|
var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
|
|
51
51
|
var opacityValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
52
52
|
var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
@@ -55,7 +55,9 @@ export var LineChart = function (props) {
|
|
|
55
55
|
var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
56
56
|
var widthValue4 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
57
57
|
var widthValue5 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
58
|
-
var _c = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), curveType = _c.curveType, 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, pointerItemsForSet = _c.pointerItemsForSet, setPointerItemsForSet = _c.setPointerItemsForSet, secondaryPointerItemsForSet = _c.secondaryPointerItemsForSet, setSecondaryPointerItemsForSet = _c.setSecondaryPointerItemsForSet, 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, hidePointers = _c.hidePointers, hidePointer1 = _c.hidePointer1, hidePointer2 = _c.hidePointer2, hidePointer3 = _c.hidePointer3, hidePointer4 = _c.hidePointer4, hidePointer5 = _c.hidePointer5, cumulativeSpacing1 = _c.cumulativeSpacing1, cumulativeSpacing2 = _c.cumulativeSpacing2, cumulativeSpacing3 = _c.cumulativeSpacing3, cumulativeSpacing4 = _c.cumulativeSpacing4, cumulativeSpacing5 = _c.cumulativeSpacing5, cumulativeSpacingSecondary = _c.cumulativeSpacingSecondary, cumulativeSpacingForSet = _c.cumulativeSpacingForSet, hideSecondaryPointer = _c.hideSecondaryPointer, hidePointerDataPointForMissingValues = _c.hidePointerDataPointForMissingValues, pointerEvents = _c.pointerEvents, focusEnabled = _c.focusEnabled, showDataPointOnFocus = _c.showDataPointOnFocus, showStripOnFocus = _c.showStripOnFocus, stripOverDataPoints = _c.stripOverDataPoints, 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, _d = _c.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _d === void 0 ? 0 : _d, lineGradient = _c.lineGradient, lineGradientDirection = _c.lineGradientDirection, lineGradientStartColor = _c.lineGradientStartColor, lineGradientEndColor = _c.lineGradientEndColor, barAndLineChartsWrapperProps = _c.barAndLineChartsWrapperProps, areaChart = _c.areaChart, mostNegativeValue = _c.mostNegativeValue, strips = _c.strips;
|
|
58
|
+
var _d = useLineChart(__assign(__assign({}, props), { parentWidth: (_b = props.parentWidth) !== null && _b !== void 0 ? _b : screenWidth })), curveType = _d.curveType, scrollX = _d.scrollX, setScrollX = _d.setScrollX, arrow1Points = _d.arrow1Points, arrow2Points = _d.arrow2Points, arrow3Points = _d.arrow3Points, arrow4Points = _d.arrow4Points, arrow5Points = _d.arrow5Points, secondaryArrowPoints = _d.secondaryArrowPoints, pointerIndex = _d.pointerIndex, setPointerIndex = _d.setPointerIndex, pointerX = _d.pointerX, setPointerX = _d.setPointerX, pointerY = _d.pointerY, setPointerY = _d.setPointerY, pointerItem = _d.pointerItem, setPointerItem = _d.setPointerItem, pointerY2 = _d.pointerY2, setPointerY2 = _d.setPointerY2, pointerItem2 = _d.pointerItem2, setPointerItem2 = _d.setPointerItem2, pointerY3 = _d.pointerY3, setPointerY3 = _d.setPointerY3, pointerItem3 = _d.pointerItem3, setPointerItem3 = _d.setPointerItem3, pointerY4 = _d.pointerY4, setPointerY4 = _d.setPointerY4, pointerItem4 = _d.pointerItem4, setPointerItem4 = _d.setPointerItem4, pointerY5 = _d.pointerY5, setPointerY5 = _d.setPointerY5, pointerYsForDataSet = _d.pointerYsForDataSet, setPointerYsForDataSet = _d.setPointerYsForDataSet, pointerItem5 = _d.pointerItem5, setPointerItem5 = _d.setPointerItem5, secondaryPointerY = _d.secondaryPointerY, setSecondaryPointerY = _d.setSecondaryPointerY, secondaryPointerItem = _d.secondaryPointerItem, setSecondaryPointerItem = _d.setSecondaryPointerItem, pointerItemsForSet = _d.pointerItemsForSet, setPointerItemsForSet = _d.setPointerItemsForSet, secondaryPointerItemsForSet = _d.secondaryPointerItemsForSet, setSecondaryPointerItemsForSet = _d.setSecondaryPointerItemsForSet, responderStartTime = _d.responderStartTime, setResponderStartTime = _d.setResponderStartTime, setResponderActive = _d.setResponderActive, points = _d.points, points2 = _d.points2, points3 = _d.points3, points4 = _d.points4, points5 = _d.points5, secondaryPoints = _d.secondaryPoints, fillPoints = _d.fillPoints, fillPoints2 = _d.fillPoints2, fillPoints3 = _d.fillPoints3, fillPoints4 = _d.fillPoints4, fillPoints5 = _d.fillPoints5, secondaryFillPoints = _d.secondaryFillPoints, pointsFromSet = _d.pointsFromSet, fillPointsFromSet = _d.fillPointsFromSet, arrowPointsFromSet = _d.arrowPointsFromSet, selectedIndex = _d.selectedIndex, setSelectedIndex = _d.setSelectedIndex, containerHeight = _d.containerHeight, data = _d.data, data2 = _d.data2, data3 = _d.data3, data4 = _d.data4, data5 = _d.data5, secondaryData = _d.secondaryData, dataSet = _d.dataSet, data0 = _d.data0, labelsExtraHeight = _d.labelsExtraHeight, animationDuration = _d.animationDuration, onDataChangeAnimationDuration = _d.onDataChangeAnimationDuration, animateTogether = _d.animateTogether, animateOnDataChange = _d.animateOnDataChange, startIndex1 = _d.startIndex1, startIndex2 = _d.startIndex2, endIndex1 = _d.endIndex1, endIndex2 = _d.endIndex2, startIndex3 = _d.startIndex3, endIndex3 = _d.endIndex3, startIndex4 = _d.startIndex4, endIndex4 = _d.endIndex4, startIndex5 = _d.startIndex5, endIndex5 = _d.endIndex5, initialSpacing = _d.initialSpacing, thickness = _d.thickness, yAxisLabelWidth = _d.yAxisLabelWidth, spacing = _d.spacing, xAxisThickness = _d.xAxisThickness, dataPointsHeight1 = _d.dataPointsHeight1, dataPointsWidth1 = _d.dataPointsWidth1, dataPointsRadius1 = _d.dataPointsRadius1, dataPointsColor1 = _d.dataPointsColor1, dataPointsShape1 = _d.dataPointsShape1, dataPointsHeight2 = _d.dataPointsHeight2, dataPointsWidth2 = _d.dataPointsWidth2, dataPointsRadius2 = _d.dataPointsRadius2, dataPointsColor2 = _d.dataPointsColor2, dataPointsShape2 = _d.dataPointsShape2, dataPointsHeight3 = _d.dataPointsHeight3, dataPointsWidth3 = _d.dataPointsWidth3, dataPointsRadius3 = _d.dataPointsRadius3, dataPointsColor3 = _d.dataPointsColor3, dataPointsShape3 = _d.dataPointsShape3, dataPointsHeight4 = _d.dataPointsHeight4, dataPointsWidth4 = _d.dataPointsWidth4, dataPointsRadius4 = _d.dataPointsRadius4, dataPointsColor4 = _d.dataPointsColor4, dataPointsShape4 = _d.dataPointsShape4, dataPointsHeight5 = _d.dataPointsHeight5, dataPointsWidth5 = _d.dataPointsWidth5, dataPointsRadius5 = _d.dataPointsRadius5, dataPointsColor5 = _d.dataPointsColor5, dataPointsShape5 = _d.dataPointsShape5, getIsNthAreaChart = _d.getIsNthAreaChart, textFontSize1 = _d.textFontSize1, textFontSize2 = _d.textFontSize2, textFontSize3 = _d.textFontSize3, textFontSize4 = _d.textFontSize4, textFontSize5 = _d.textFontSize5, textColor1 = _d.textColor1, textColor2 = _d.textColor2, textColor3 = _d.textColor3, textColor4 = _d.textColor4, textColor5 = _d.textColor5, totalWidth = _d.totalWidth, maxValue = _d.maxValue, overflowTop = _d.overflowTop, extendedContainerHeight = _d.extendedContainerHeight, getX = _d.getX, getY = _d.getY, getSecondaryY = _d.getSecondaryY, secondaryMaxValue = _d.secondaryMaxValue, showValuesAsDataPointsText = _d.showValuesAsDataPointsText, thickness1 = _d.thickness1, thickness2 = _d.thickness2, thickness3 = _d.thickness3, thickness4 = _d.thickness4, thickness5 = _d.thickness5, zIndex1 = _d.zIndex1, zIndex2 = _d.zIndex2, zIndex3 = _d.zIndex3, zIndex4 = _d.zIndex4, zIndex5 = _d.zIndex5, strokeDashArray1 = _d.strokeDashArray1, strokeDashArray2 = _d.strokeDashArray2, strokeDashArray3 = _d.strokeDashArray3, strokeDashArray4 = _d.strokeDashArray4, strokeDashArray5 = _d.strokeDashArray5, rotateLabel = _d.rotateLabel, isAnimated = _d.isAnimated, hideDataPoints1 = _d.hideDataPoints1, hideDataPoints2 = _d.hideDataPoints2, hideDataPoints3 = _d.hideDataPoints3, hideDataPoints4 = _d.hideDataPoints4, hideDataPoints5 = _d.hideDataPoints5, color1 = _d.color1, color2 = _d.color2, color3 = _d.color3, color4 = _d.color4, color5 = _d.color5, startFillColor1 = _d.startFillColor1, endFillColor1 = _d.endFillColor1, startOpacity1 = _d.startOpacity1, endOpacity1 = _d.endOpacity1, startFillColor2 = _d.startFillColor2, endFillColor2 = _d.endFillColor2, startOpacity2 = _d.startOpacity2, endOpacity2 = _d.endOpacity2, startFillColor3 = _d.startFillColor3, endFillColor3 = _d.endFillColor3, startOpacity3 = _d.startOpacity3, endOpacity3 = _d.endOpacity3, startFillColor4 = _d.startFillColor4, endFillColor4 = _d.endFillColor4, startOpacity4 = _d.startOpacity4, endOpacity4 = _d.endOpacity4, startFillColor5 = _d.startFillColor5, endFillColor5 = _d.endFillColor5, startOpacity5 = _d.startOpacity5, endOpacity5 = _d.endOpacity5, arrowStrokeWidth1 = _d.arrowStrokeWidth1, arrowStrokeColor1 = _d.arrowStrokeColor1, arrowFillColor1 = _d.arrowFillColor1, arrowStrokeWidth2 = _d.arrowStrokeWidth2, arrowStrokeColor2 = _d.arrowStrokeColor2, arrowFillColor2 = _d.arrowFillColor2, arrowStrokeWidth3 = _d.arrowStrokeWidth3, arrowStrokeColor3 = _d.arrowStrokeColor3, arrowFillColor3 = _d.arrowFillColor3, arrowStrokeWidth4 = _d.arrowStrokeWidth4, arrowStrokeColor4 = _d.arrowStrokeColor4, arrowFillColor4 = _d.arrowFillColor4, arrowStrokeWidth5 = _d.arrowStrokeWidth5, arrowStrokeColor5 = _d.arrowStrokeColor5, arrowFillColor5 = _d.arrowFillColor5, arrowStrokeWidthsFromSet = _d.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _d.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _d.arrowFillColorsFromSet, secondaryLineConfig = _d.secondaryLineConfig, gradientDirection = _d.gradientDirection, stepHeight = _d.stepHeight, noOfSectionsBelowXAxis = _d.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _d.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _d.xAxisLabelsVerticalShift, pointerConfig = _d.pointerConfig, pointerHeight = _d.pointerHeight, pointerWidth = _d.pointerWidth, pointerRadius = _d.pointerRadius, pointerColor = _d.pointerColor, pointerComponent = _d.pointerComponent, showPointerStrip = _d.showPointerStrip, pointerStripHeight = _d.pointerStripHeight, pointerStripWidth = _d.pointerStripWidth, pointerStripColor = _d.pointerStripColor, pointerStripUptoDataPoint = _d.pointerStripUptoDataPoint, pointerLabelComponent = _d.pointerLabelComponent, stripOverPointer = _d.stripOverPointer, shiftPointerLabelX = _d.shiftPointerLabelX, shiftPointerLabelY = _d.shiftPointerLabelY, pointerLabelWidth = _d.pointerLabelWidth, pointerLabelHeight = _d.pointerLabelHeight, autoAdjustPointerLabelPosition = _d.autoAdjustPointerLabelPosition, pointerVanishDelay = _d.pointerVanishDelay, activatePointersOnLongPress = _d.activatePointersOnLongPress, activatePointersInstantlyOnTouch = _d.activatePointersInstantlyOnTouch, activatePointersDelay = _d.activatePointersDelay, persistPointer = _d.persistPointer, resetPointerIndexOnRelease = _d.resetPointerIndexOnRelease, hidePointers = _d.hidePointers, hidePointer1 = _d.hidePointer1, hidePointer2 = _d.hidePointer2, hidePointer3 = _d.hidePointer3, hidePointer4 = _d.hidePointer4, hidePointer5 = _d.hidePointer5, cumulativeSpacing1 = _d.cumulativeSpacing1, cumulativeSpacing2 = _d.cumulativeSpacing2, cumulativeSpacing3 = _d.cumulativeSpacing3, cumulativeSpacing4 = _d.cumulativeSpacing4, cumulativeSpacing5 = _d.cumulativeSpacing5, cumulativeSpacingSecondary = _d.cumulativeSpacingSecondary, cumulativeSpacingForSet = _d.cumulativeSpacingForSet, hideSecondaryPointer = _d.hideSecondaryPointer, hidePointerDataPointForMissingValues = _d.hidePointerDataPointForMissingValues, pointerEvents = _d.pointerEvents, focusEnabled = _d.focusEnabled, showDataPointOnFocus = _d.showDataPointOnFocus, showStripOnFocus = _d.showStripOnFocus, stripOverDataPoints = _d.stripOverDataPoints, showTextOnFocus = _d.showTextOnFocus, showDataPointLabelOnFocus = _d.showDataPointLabelOnFocus, stripHeight = _d.stripHeight, stripWidth = _d.stripWidth, stripColor = _d.stripColor, stripOpacity = _d.stripOpacity, stripStrokeDashArray = _d.stripStrokeDashArray, unFocusOnPressOut = _d.unFocusOnPressOut, delayBeforeUnFocus = _d.delayBeforeUnFocus, _e = _d.containerHeightIncludingBelowXAxis, containerHeightIncludingBelowXAxis = _e === void 0 ? 0 : _e, lineGradient = _d.lineGradient, lineGradientDirection = _d.lineGradientDirection, lineGradientStartColor = _d.lineGradientStartColor, lineGradientEndColor = _d.lineGradientEndColor, barAndLineChartsWrapperProps = _d.barAndLineChartsWrapperProps, areaChart = _d.areaChart, mostNegativeValue = _d.mostNegativeValue, strips = _d.strips, lastLineNumber = _d.lastLineNumber, focusTogether = _d.focusTogether, focusProximity = _d.focusProximity;
|
|
59
|
+
var svgHeight = containerHeightIncludingBelowXAxis +
|
|
60
|
+
((_c = props.overflowBottom) !== null && _c !== void 0 ? _c : dataPointsRadius1);
|
|
59
61
|
var secondaryXAxis = props.secondaryXAxis, intersectionAreaConfig = props.intersectionAreaConfig;
|
|
60
62
|
var widthValuesFromSet = useMemo(function () { return dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return new Animated.Value(0); }); }, []);
|
|
61
63
|
var animatedPoints = new Animated.Value(0);
|
|
@@ -199,7 +201,7 @@ export var LineChart = function (props) {
|
|
|
199
201
|
]);
|
|
200
202
|
var svgWrapperViewStyle = {
|
|
201
203
|
position: 'absolute',
|
|
202
|
-
bottom:
|
|
204
|
+
bottom: 61 + xAxisLabelsVerticalShift + labelsExtraHeight - xAxisThickness,
|
|
203
205
|
left: 0,
|
|
204
206
|
zIndex: 1,
|
|
205
207
|
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
@@ -257,18 +259,19 @@ export var LineChart = function (props) {
|
|
|
257
259
|
props.onFocus(item, index);
|
|
258
260
|
}
|
|
259
261
|
};
|
|
262
|
+
var _f = __read(useState(-1), 2), selectedLineNumber = _f[0], setSelectedLineNumber = _f[1];
|
|
260
263
|
var renderDataPoints = function (hideDataPoints, dataForRender, originalDataFromProps, dataPtsShape, dataPtsWidth, dataPtsHeight, dataPtsColor, dataPtsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, spacingArray, key) {
|
|
261
264
|
var getYOrSecondaryY = isSecondary ? getSecondaryY : getY;
|
|
262
265
|
return dataForRender.map(function (item, index) {
|
|
263
|
-
var _a;
|
|
264
|
-
var _b, _c, _d, _e;
|
|
266
|
+
var _a, _b, _c, _d, _e;
|
|
265
267
|
if (index < startIndex || index > endIndex)
|
|
266
268
|
return null;
|
|
267
269
|
if (item.hideDataPoint) {
|
|
268
270
|
return null;
|
|
269
271
|
}
|
|
270
272
|
var dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, text, customDataPoint, dataPointLabelComponent;
|
|
271
|
-
if (index === selectedIndex
|
|
273
|
+
if (index === selectedIndex &&
|
|
274
|
+
(focusTogether || key === selectedLineNumber)) {
|
|
272
275
|
dataPointsShape =
|
|
273
276
|
item.focusedDataPointShape ||
|
|
274
277
|
props.focusedDataPointShape ||
|
|
@@ -289,7 +292,7 @@ export var LineChart = function (props) {
|
|
|
289
292
|
props.focusedDataPointColor ||
|
|
290
293
|
LineDefaults.focusedDataPointColor;
|
|
291
294
|
dataPointsRadius =
|
|
292
|
-
(
|
|
295
|
+
(_c = (_b = (_a = item.focusedDataPointRadius) !== null && _a !== void 0 ? _a : props.focusedDataPointRadius) !== null && _b !== void 0 ? _b : item.dataPointRadius) !== null && _c !== void 0 ? _c : dataPtsRadius;
|
|
293
296
|
if (showTextOnFocus) {
|
|
294
297
|
text = item.dataPointText;
|
|
295
298
|
}
|
|
@@ -306,7 +309,7 @@ export var LineChart = function (props) {
|
|
|
306
309
|
dataPointsWidth = item.dataPointWidth || dataPtsWidth;
|
|
307
310
|
dataPointsHeight = item.dataPointHeight || dataPtsHeight;
|
|
308
311
|
dataPointsColor = item.dataPointColor || dataPtsColor;
|
|
309
|
-
dataPointsRadius = (
|
|
312
|
+
dataPointsRadius = (_d = item.dataPointRadius) !== null && _d !== void 0 ? _d : dataPtsRadius;
|
|
310
313
|
if (showTextOnFocus) {
|
|
311
314
|
text = '';
|
|
312
315
|
}
|
|
@@ -317,20 +320,104 @@ export var LineChart = function (props) {
|
|
|
317
320
|
text = originalDataFromProps[index].value;
|
|
318
321
|
}
|
|
319
322
|
var position = I18nManager.isRTL ? 'right' : 'left';
|
|
320
|
-
return (_jsxs(Fragment, { children: [focusEnabled
|
|
321
|
-
_jsx(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
323
|
+
return (_jsxs(Fragment, { children: [focusEnabled ||
|
|
324
|
+
(pointerConfig && activatePointersInstantlyOnTouch) ? (_jsx(_Fragment, { children: key === lastLineNumber - 1 ? (_jsx(Rect, { x: initialSpacing + (spacing * index - spacing / 2), y: 8, width: spacing, height: containerHeight - 0, fill: 'none', onPressIn: function (evt) {
|
|
325
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
326
|
+
if (pointerConfig && activatePointersInstantlyOnTouch) {
|
|
327
|
+
activatePointers(0, index);
|
|
328
|
+
}
|
|
329
|
+
if (focusEnabled) {
|
|
330
|
+
var locationY_1 = evt.nativeEvent.locationY; // Note that we have another property named pageY which can be useful
|
|
331
|
+
var lineNumber_1 = 0;
|
|
332
|
+
if (dataSet) {
|
|
333
|
+
var minDistance_1 = Infinity;
|
|
334
|
+
dataSet.forEach(function (setItem, setIndex) {
|
|
335
|
+
var _a;
|
|
336
|
+
var distance = Math.abs(getY((_a = setItem.data[index]) === null || _a === void 0 ? void 0 : _a.value) - locationY_1);
|
|
337
|
+
if (distance < minDistance_1) {
|
|
338
|
+
minDistance_1 = distance;
|
|
339
|
+
lineNumber_1 = setIndex + 1;
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
var distance1 = void 0, distance2 = void 0, distance3 = void 0, distance4 = void 0, distance5 = void 0, distance6 = void 0;
|
|
345
|
+
var minDistance = Infinity;
|
|
346
|
+
if (typeof ((_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) === 'number') {
|
|
347
|
+
distance1 = Math.abs(getY((_b = data[index]) === null || _b === void 0 ? void 0 : _b.value) - locationY_1);
|
|
348
|
+
minDistance = distance1;
|
|
349
|
+
if (distance1 < focusProximity)
|
|
350
|
+
lineNumber_1 = 1;
|
|
351
|
+
}
|
|
352
|
+
if (typeof ((_c = data2[index]) === null || _c === void 0 ? void 0 : _c.value) === 'number') {
|
|
353
|
+
distance2 = Math.abs(getY((_d = data2[index]) === null || _d === void 0 ? void 0 : _d.value) - locationY_1);
|
|
354
|
+
if (minDistance > distance2 &&
|
|
355
|
+
distance2 < focusProximity) {
|
|
356
|
+
minDistance = distance2;
|
|
357
|
+
lineNumber_1 = 2;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (typeof ((_e = data3[index]) === null || _e === void 0 ? void 0 : _e.value) === 'number') {
|
|
361
|
+
distance3 = Math.abs(getY((_f = data3[index]) === null || _f === void 0 ? void 0 : _f.value) - locationY_1);
|
|
362
|
+
if (minDistance > distance3 &&
|
|
363
|
+
distance3 < focusProximity) {
|
|
364
|
+
minDistance = distance3;
|
|
365
|
+
lineNumber_1 = 3;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (typeof ((_g = data4[index]) === null || _g === void 0 ? void 0 : _g.value) === 'number') {
|
|
369
|
+
distance4 = Math.abs(getY((_h = data4[index]) === null || _h === void 0 ? void 0 : _h.value) - locationY_1);
|
|
370
|
+
if (minDistance > distance4 &&
|
|
371
|
+
distance4 < focusProximity) {
|
|
372
|
+
minDistance = distance4;
|
|
373
|
+
lineNumber_1 = 4;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (typeof ((_j = data5[index]) === null || _j === void 0 ? void 0 : _j.value) === 'number') {
|
|
377
|
+
distance5 = Math.abs(getY((_k = data5[index]) === null || _k === void 0 ? void 0 : _k.value) - locationY_1);
|
|
378
|
+
if (minDistance > distance5 &&
|
|
379
|
+
distance5 < focusProximity) {
|
|
380
|
+
minDistance = distance5;
|
|
381
|
+
lineNumber_1 = 5;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (typeof ((_l = secondaryData[index]) === null || _l === void 0 ? void 0 : _l.value) === 'number') {
|
|
385
|
+
distance6 = Math.abs(getY((_m = secondaryData[index]) === null || _m === void 0 ? void 0 : _m.value) - locationY_1);
|
|
386
|
+
if (minDistance > distance6 &&
|
|
387
|
+
distance6 < focusProximity) {
|
|
388
|
+
minDistance = distance6;
|
|
389
|
+
lineNumber_1 = 6666;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
setSelectedLineNumber(lineNumber_1 - 1);
|
|
394
|
+
if (lineNumber_1) {
|
|
395
|
+
onStripPress(item, index);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
// This is to fix the blinking of pointer on "initial drag after press"
|
|
400
|
+
// onResponderTerminationRequest={(evt)=>{
|
|
401
|
+
// setTerminationRequested(true)
|
|
402
|
+
// return true
|
|
403
|
+
// }}
|
|
404
|
+
onPressOut: function () {
|
|
405
|
+
if (pointerConfig && activatePointersInstantlyOnTouch) {
|
|
406
|
+
// if(terminationRequested) {
|
|
407
|
+
// setTerminationRequested(false) // This is to fix the blinking of pointer on "initial drag after press"
|
|
408
|
+
// return
|
|
409
|
+
// }
|
|
410
|
+
if (resetPointerIndexOnRelease)
|
|
411
|
+
setPointerIndex(-1);
|
|
412
|
+
if (!persistPointer)
|
|
413
|
+
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
414
|
+
}
|
|
415
|
+
if (focusEnabled && unFocusOnPressOut) {
|
|
416
|
+
setTimeout(function () { return setSelectedIndex(-1); }, delayBeforeUnFocus);
|
|
417
|
+
}
|
|
418
|
+
} })) : null })) : null, hideDataPoints ? null : (_jsxs(_Fragment, { children: [customDataPoint ? (_jsx(ForeignObject, { height: svgHeight, width: totalWidth, x: initialSpacing -
|
|
419
|
+
dataPointsWidth / 2 +
|
|
420
|
+
((_e = spacingArray[index - 1]) !== null && _e !== void 0 ? _e : 0), y: getYOrSecondaryY(item.value) - dataPointsHeight / 2, children: customDataPoint(item, index) })) : null, dataPointsShape === 'rectangular' ? (_jsx(Fragment, { children: customDataPoint ? null : (_jsx(Rect, { x: getX(spacingArray, index) - dataPointsWidth / 2, y: getYOrSecondaryY(item.value) - dataPointsHeight / 2, width: dataPointsWidth, height: dataPointsHeight, fill: showDataPointOnFocus
|
|
334
421
|
? index === selectedIndex
|
|
335
422
|
? dataPointsColor
|
|
336
423
|
: 'none'
|
|
@@ -372,7 +459,8 @@ export var LineChart = function (props) {
|
|
|
372
459
|
spacing * index,
|
|
373
460
|
},
|
|
374
461
|
], children: showDataPointLabelOnFocus
|
|
375
|
-
? index === selectedIndex
|
|
462
|
+
? index === selectedIndex &&
|
|
463
|
+
(focusTogether || key == selectedLineNumber)
|
|
376
464
|
? dataPointLabelComponent()
|
|
377
465
|
: null
|
|
378
466
|
: dataPointLabelComponent() })) : null) : text || item.dataPointText ? (!showTextOnFocus || index === selectedIndex ? (_jsx(CanvasText, { fill: item.textColor || textColor, fontSize: item.textFontSize || textFontSize, x: getX(spacingArray, index) -
|
|
@@ -389,9 +477,13 @@ export var LineChart = function (props) {
|
|
|
389
477
|
var _a, _b, _c;
|
|
390
478
|
if (item.showVerticalLine) {
|
|
391
479
|
var x = getX(spacingArray, index);
|
|
392
|
-
return (_jsx(Line, { x1: x, y1: extendedContainerHeight, x2: x, y2:
|
|
393
|
-
?
|
|
394
|
-
:
|
|
480
|
+
return (_jsx(Line, { x1: x, y1: extendedContainerHeight, x2: x, y2: item.verticalLineHeight
|
|
481
|
+
? extendedContainerHeight - item.verticalLineHeight
|
|
482
|
+
: props.verticalLinesHeight
|
|
483
|
+
? extendedContainerHeight - props.verticalLinesHeight
|
|
484
|
+
: ((_a = item.verticalLineUptoDataPoint) !== null && _a !== void 0 ? _a : props.verticalLinesUptoDataPoint)
|
|
485
|
+
? getY(item.value)
|
|
486
|
+
: -xAxisThickness, stroke: item.verticalLineColor || props.verticalLinesColor || 'lightgray', strokeWidth: item.verticalLineThickness || props.verticalLinesThickness || 2, strokeDasharray: (_c = (_b = item.verticalLineStrokeDashArray) !== null && _b !== void 0 ? _b : props.verticalLinesStrokeDashArray) !== null && _c !== void 0 ? _c : '' }, index));
|
|
395
487
|
}
|
|
396
488
|
return null;
|
|
397
489
|
});
|
|
@@ -436,8 +528,8 @@ export var LineChart = function (props) {
|
|
|
436
528
|
return;
|
|
437
529
|
if (lineNumber === 5 && hidePointer5)
|
|
438
530
|
return;
|
|
439
|
-
//
|
|
440
|
-
if (lineNumber ===
|
|
531
|
+
// 6666 is for secondaryData
|
|
532
|
+
if (lineNumber === 6666 && hideSecondaryPointer)
|
|
441
533
|
return;
|
|
442
534
|
var pointerItemLocal, pointerYLocal, pointerColorLocal;
|
|
443
535
|
switch (lineNumber) {
|
|
@@ -466,7 +558,7 @@ export var LineChart = function (props) {
|
|
|
466
558
|
pointerYLocal = pointerY5;
|
|
467
559
|
pointerColorLocal = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointer5Color) || pointerColor;
|
|
468
560
|
break;
|
|
469
|
-
case
|
|
561
|
+
case 6666:
|
|
470
562
|
pointerItemLocal = secondaryPointerItem;
|
|
471
563
|
pointerYLocal = secondaryPointerY;
|
|
472
564
|
pointerColorLocal =
|
|
@@ -564,7 +656,7 @@ export var LineChart = function (props) {
|
|
|
564
656
|
return (_jsx(View, { style: [svgWrapperViewStyle, { width: totalWidth }], children: _jsxs(Svg, { children: [_jsx(Path, { id: "path1", d: fillPoints, fill: "none", stroke: 'none' }), _jsx(Path, { id: "path2", d: fillPoints2, fill: "none", stroke: 'none' }), _jsx(ClipPath, { id: "clip", children: _jsx(Use, { href: "#path1" }) }), _jsx(Path, { d: fillPoints2, clipPath: "url(#clip)", fill: (_a = intersectionAreaConfig === null || intersectionAreaConfig === void 0 ? void 0 : intersectionAreaConfig.fillColor) !== null && _a !== void 0 ? _a : 'white' }), _jsx(Path, { d: points, stroke: color1, strokeWidth: thickness1 !== null && thickness1 !== void 0 ? thickness1 : thickness, fill: 'none' })] }) }));
|
|
565
657
|
};
|
|
566
658
|
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, spacingArray) {
|
|
567
|
-
var _a, _b
|
|
659
|
+
var _a, _b;
|
|
568
660
|
if (!points)
|
|
569
661
|
return null;
|
|
570
662
|
var isCurved = points.includes('C') || points.includes('Q');
|
|
@@ -594,8 +686,7 @@ export var LineChart = function (props) {
|
|
|
594
686
|
typeof strokeDashArray[1] === 'number') {
|
|
595
687
|
lineSvgPropsOuter.strokeDasharray = strokeDashArray;
|
|
596
688
|
}
|
|
597
|
-
return (_jsxs(Svg, { height:
|
|
598
|
-
((_b = props.overflowBottom) !== null && _b !== void 0 ? _b : dataPointsRadius1),
|
|
689
|
+
return (_jsxs(Svg, { height: svgHeight,
|
|
599
690
|
// width={widthValue}
|
|
600
691
|
onPress: props.onBackgroundPress, children: [lineGradient && getLineGradientComponent(), points.includes(SEGMENT_START) || points.includes(RANGE_ENTER) ? (ar.map(function (item, index) {
|
|
601
692
|
var lineSvgProps = {
|
|
@@ -621,9 +712,9 @@ export var LineChart = function (props) {
|
|
|
621
712
|
? "url(#".concat(props.areaGradientId, ")")
|
|
622
713
|
: "url(#Gradient)", stroke: 'none', strokeWidth: currentLineThickness || thickness })) : (_jsx(Path, { onPress: props.onChartAreaPress, d: fillPoints, fill: props.areaGradientId
|
|
623
714
|
? "url(#".concat(props.areaGradientId, ")")
|
|
624
|
-
: "url(#Gradient)", stroke: 'none', strokeWidth: currentLineThickness || thickness }))) : null, renderSpecificVerticalLines(data, cumulativeSpacing1), renderSpecificVerticalLines(data2, cumulativeSpacing2), renderSpecificVerticalLines(data3, cumulativeSpacing3), renderSpecificVerticalLines(data4, cumulativeSpacing4), renderSpecificVerticalLines(data5, cumulativeSpacing5), (
|
|
715
|
+
: "url(#Gradient)", stroke: 'none', strokeWidth: currentLineThickness || thickness }))) : null, renderSpecificVerticalLines(data, cumulativeSpacing1), renderSpecificVerticalLines(data2, cumulativeSpacing2), renderSpecificVerticalLines(data3, cumulativeSpacing3), renderSpecificVerticalLines(data4, cumulativeSpacing4), renderSpecificVerticalLines(data5, cumulativeSpacing5), (_b = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set, index) {
|
|
625
716
|
return renderSpecificVerticalLines(set === null || set === void 0 ? void 0 : set.data, cumulativeSpacingForSet[index]);
|
|
626
|
-
})) !== null &&
|
|
717
|
+
})) !== null && _b !== void 0 ? _b : null, renderDataPoints(hideDataPoints, data, propsData, dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText, spacingArray, key), showArrow && (_jsx(Path, { d: arrowPoints, fill: arrowFillColor, stroke: arrowStrokeColor, strokeWidth: arrowStrokeWidth }))] }));
|
|
627
718
|
};
|
|
628
719
|
// const getClosestValueFromSpacingArray = (spacingArray:number[],x:number):number => {
|
|
629
720
|
// let dif=0,prevDif=0,i;
|
|
@@ -636,28 +727,34 @@ export var LineChart = function (props) {
|
|
|
636
727
|
// }
|
|
637
728
|
// return i-1;
|
|
638
729
|
// }
|
|
639
|
-
var activatePointers = function (x) {
|
|
640
|
-
var factor =
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
setPointerIndex(factor);
|
|
730
|
+
var activatePointers = function (x, index) {
|
|
731
|
+
var factor = index !== null && index !== void 0 ? index : -1;
|
|
732
|
+
if (typeof index !== 'number') {
|
|
733
|
+
factor = (x - initialSpacing) / spacing; // getClosestValueFromSpacingArray(cumulativeSpacing1,x-initialSpacing)
|
|
734
|
+
factor = Math.round(factor);
|
|
735
|
+
factor = Math.min(factor, (data0 !== null && data0 !== void 0 ? data0 : data).length - 1);
|
|
736
|
+
factor = index !== null && index !== void 0 ? index : Math.max(factor, 0);
|
|
737
|
+
// if(factor === pointerIndex) return; // This is to fix the blinking of pointer on "initial drag after press"
|
|
738
|
+
}
|
|
649
739
|
var item, y;
|
|
650
740
|
item = (data0 !== null && data0 !== void 0 ? data0 : data)[factor];
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
741
|
+
if (!item.hidePointer) {
|
|
742
|
+
var z = getX((dataSet === null || dataSet === void 0 ? void 0 : dataSet.length) ? cumulativeSpacingForSet[0] : cumulativeSpacing1, factor) -
|
|
743
|
+
(pointerRadius || pointerWidth / 2) -
|
|
744
|
+
1;
|
|
745
|
+
setPointerX(z);
|
|
746
|
+
setPointerIndex(factor);
|
|
747
|
+
y =
|
|
748
|
+
containerHeight -
|
|
749
|
+
(item.value * containerHeight) / maxValue -
|
|
750
|
+
(pointerRadius || pointerHeight / 2) +
|
|
751
|
+
10;
|
|
752
|
+
setPointerY(y);
|
|
753
|
+
setPointerItem(item);
|
|
754
|
+
}
|
|
658
755
|
if (data2 && data2.length) {
|
|
659
756
|
item = data2[factor];
|
|
660
|
-
if (item) {
|
|
757
|
+
if (item && !item.hidePointer) {
|
|
661
758
|
y =
|
|
662
759
|
containerHeight -
|
|
663
760
|
(item.value * containerHeight) / maxValue -
|
|
@@ -669,7 +766,7 @@ export var LineChart = function (props) {
|
|
|
669
766
|
}
|
|
670
767
|
if (data3 && data3.length) {
|
|
671
768
|
item = data3[factor];
|
|
672
|
-
if (item) {
|
|
769
|
+
if (item && !item.hidePointer) {
|
|
673
770
|
y =
|
|
674
771
|
containerHeight -
|
|
675
772
|
(item.value * containerHeight) / maxValue -
|
|
@@ -681,7 +778,7 @@ export var LineChart = function (props) {
|
|
|
681
778
|
}
|
|
682
779
|
if (data4 && data4.length) {
|
|
683
780
|
item = data4[factor];
|
|
684
|
-
if (item) {
|
|
781
|
+
if (item && !item.hidePointer) {
|
|
685
782
|
y =
|
|
686
783
|
containerHeight -
|
|
687
784
|
(item.value * containerHeight) / maxValue -
|
|
@@ -693,7 +790,7 @@ export var LineChart = function (props) {
|
|
|
693
790
|
}
|
|
694
791
|
if (data5 && data5.length) {
|
|
695
792
|
item = data5[factor];
|
|
696
|
-
if (item) {
|
|
793
|
+
if (item && !item.hidePointer) {
|
|
697
794
|
y =
|
|
698
795
|
containerHeight -
|
|
699
796
|
(item.value * containerHeight) / maxValue -
|
|
@@ -771,9 +868,9 @@ export var LineChart = function (props) {
|
|
|
771
868
|
// console.log('evt...reject.......',evt);
|
|
772
869
|
// }}
|
|
773
870
|
onResponderEnd: function (evt) {
|
|
774
|
-
// console.log('evt...end.......',evt);
|
|
775
871
|
setResponderStartTime(0);
|
|
776
|
-
|
|
872
|
+
if (resetPointerIndexOnRelease)
|
|
873
|
+
setPointerIndex(-1);
|
|
777
874
|
setResponderActive(false);
|
|
778
875
|
if (!persistPointer)
|
|
779
876
|
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
@@ -827,7 +924,8 @@ export var LineChart = function (props) {
|
|
|
827
924
|
onResponderEnd: function (evt) {
|
|
828
925
|
// console.log('evt...end.......',evt);
|
|
829
926
|
setResponderStartTime(0);
|
|
830
|
-
|
|
927
|
+
if (resetPointerIndexOnRelease)
|
|
928
|
+
setPointerIndex(-1);
|
|
831
929
|
setResponderActive(false);
|
|
832
930
|
if (!persistPointer)
|
|
833
931
|
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
@@ -933,8 +1031,8 @@ export var LineChart = function (props) {
|
|
|
933
1031
|
? renderAnimatedLine(containerHeightIncludingBelowXAxis, zIndex1, points, widthValue, 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, cumulativeSpacing1, 0)
|
|
934
1032
|
: renderLine(containerHeightIncludingBelowXAxis, 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, cumulativeSpacing1, 0), secondaryPoints
|
|
935
1033
|
? isAnimated
|
|
936
|
-
? renderAnimatedLine(containerHeightIncludingBelowXAxis, secondaryLineConfig.zIndex, secondaryPoints, widthValue, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_h = secondaryLineConfig.arrowConfig) === null || _h === void 0 ? void 0 : _h.strokeWidth, (_j = secondaryLineConfig.arrowConfig) === null || _j === void 0 ? void 0 : _j.strokeColor, (_k = secondaryLineConfig.arrowConfig) === null || _k === void 0 ? void 0 : _k.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, cumulativeSpacingSecondary,
|
|
937
|
-
: renderLine(containerHeightIncludingBelowXAxis, secondaryLineConfig.zIndex, secondaryPoints, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_l = secondaryLineConfig.arrowConfig) === null || _l === void 0 ? void 0 : _l.strokeWidth, (_m = secondaryLineConfig.arrowConfig) === null || _m === void 0 ? void 0 : _m.strokeColor, (_o = secondaryLineConfig.arrowConfig) === null || _o === void 0 ? void 0 : _o.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, cumulativeSpacingSecondary,
|
|
1034
|
+
? renderAnimatedLine(containerHeightIncludingBelowXAxis, secondaryLineConfig.zIndex, secondaryPoints, widthValue, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_h = secondaryLineConfig.arrowConfig) === null || _h === void 0 ? void 0 : _h.strokeWidth, (_j = secondaryLineConfig.arrowConfig) === null || _j === void 0 ? void 0 : _j.strokeColor, (_k = secondaryLineConfig.arrowConfig) === null || _k === void 0 ? void 0 : _k.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, cumulativeSpacingSecondary, 6666)
|
|
1035
|
+
: renderLine(containerHeightIncludingBelowXAxis, secondaryLineConfig.zIndex, secondaryPoints, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_l = secondaryLineConfig.arrowConfig) === null || _l === void 0 ? void 0 : _l.strokeWidth, (_m = secondaryLineConfig.arrowConfig) === null || _m === void 0 ? void 0 : _m.strokeColor, (_o = secondaryLineConfig.arrowConfig) === null || _o === void 0 ? void 0 : _o.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, cumulativeSpacingSecondary, 6666)
|
|
938
1036
|
: null, points2
|
|
939
1037
|
? isAnimated
|
|
940
1038
|
? renderAnimatedLine(containerHeightIncludingBelowXAxis, zIndex2, points2, widthValue2, 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, cumulativeSpacing2, 1)
|
|
@@ -962,7 +1060,7 @@ export var LineChart = function (props) {
|
|
|
962
1060
|
zIndex: 20,
|
|
963
1061
|
}, children: [!stripOverPointer && renderStripAndLabel(), dataSet ? (renderPointer(0, true)) : (
|
|
964
1062
|
// dataSet.map((set, index) => renderPointer(index))
|
|
965
|
-
_jsxs(_Fragment, { children: [renderPointer(1), points2 ? renderPointer(2) : null, points3 ? renderPointer(3) : null, points4 ? renderPointer(4) : null, points5 ? renderPointer(5) : null, secondaryPoints ? renderPointer(
|
|
1063
|
+
_jsxs(_Fragment, { children: [renderPointer(1), points2 ? renderPointer(2) : null, points3 ? renderPointer(3) : null, points4 ? renderPointer(4) : null, points5 ? renderPointer(5) : null, secondaryPoints ? renderPointer(6666) : null, stripOverPointer && renderStripAndLabel()] }))] })) : null, (data0 !== null && data0 !== void 0 ? data0 : data).map(function (item, index) {
|
|
966
1064
|
var _a, _b, _c, _d, _e, _f;
|
|
967
1065
|
var secondaryLabel = (_c = (_a = item.secondaryLabel) !== null && _a !== void 0 ? _a : (_b = secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelTexts) === null || _b === void 0 ? void 0 : _b[index]) !== null && _c !== void 0 ? _c : '';
|
|
968
1066
|
var secondaryLabelTextStyle = (_f = (_e = (_d = item.secondaryLabelTextStyle) !== null && _d !== void 0 ? _d : secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelsTextStyle) !== null && _e !== void 0 ? _e : item.labelTextStyle) !== null && _f !== void 0 ? _f : props.xAxisLabelTextStyle;
|
package/dist/PieChart/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Platform, View } from 'react-native';
|
|
14
14
|
import { PieChartMain } from './main';
|
|
15
|
-
import {
|
|
15
|
+
import { usePieChart } from 'gifted-charts-core';
|
|
16
16
|
export var PieChart = function (props) {
|
|
17
17
|
var _a = usePieChart(props), radius = _a.radius, extraRadius = _a.extraRadius, selectedIndex = _a.selectedIndex, setSelectedIndex = _a.setSelectedIndex, startAngle = _a.startAngle, total = _a.total, donut = _a.donut, isThreeD = _a.isThreeD, semiCircle = _a.semiCircle, inwardExtraLengthForFocused = _a.inwardExtraLengthForFocused, canvasWidth = _a.canvasWidth, canvasHeight = _a.canvasHeight, innerRadius = _a.innerRadius, innerCircleColor = _a.innerCircleColor, innerCircleBorderWidth = _a.innerCircleBorderWidth, innerCircleBorderColor = _a.innerCircleBorderColor, shiftInnerCenterX = _a.shiftInnerCenterX, shiftInnerCenterY = _a.shiftInnerCenterY, tiltAngle = _a.tiltAngle, isDataShifted = _a.isDataShifted, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical;
|
|
18
18
|
var renderInnerCircle = function (innerRadius, innerCircleBorderWidth) {
|
|
@@ -79,17 +79,7 @@ export var PieChart = function (props) {
|
|
|
79
79
|
left: -extraRadius,
|
|
80
80
|
zIndex: Platform.OS === 'web' ? -1 : 0, // was not getting displayed in web (using Expo)
|
|
81
81
|
}, children: _jsx(PieChartMain, __assign({}, props, { data: [
|
|
82
|
-
{
|
|
83
|
-
value: props.data[selectedIndex].value,
|
|
84
|
-
text: props.data[selectedIndex].text,
|
|
85
|
-
color: props.data[selectedIndex].color ||
|
|
86
|
-
pieColors[selectedIndex % 9],
|
|
87
|
-
strokeColor: props.data[selectedIndex].strokeColor || undefined,
|
|
88
|
-
strokeWidth: props.data[selectedIndex].strokeWidth || undefined,
|
|
89
|
-
gradientCenterColor: props.data[selectedIndex].gradientCenterColor || undefined,
|
|
90
|
-
shiftTextX: props.data[selectedIndex].shiftTextX || undefined,
|
|
91
|
-
shiftTextY: props.data[selectedIndex].shiftTextY || undefined,
|
|
92
|
-
},
|
|
82
|
+
__assign({}, props.data[selectedIndex]),
|
|
93
83
|
{
|
|
94
84
|
value: total - props.data[selectedIndex].value,
|
|
95
85
|
// onPress: () => alert('black'),
|
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.48",
|
|
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": [
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"android": "react-native run-android",
|
|
11
11
|
"build": "rm -rf ./dist && tsc -p . && ./build.sh",
|
|
12
|
+
"prepare": "npm run build",
|
|
12
13
|
"ios": "react-native run-ios",
|
|
13
14
|
"start": "react-native start",
|
|
14
15
|
"test": "jest",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"registry": "https://registry.npmjs.org/"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"gifted-charts-core": "0.1.
|
|
29
|
+
"gifted-charts-core": "0.1.49"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@babel/cli": "^7.24.8",
|