react-native-gifted-charts 1.4.20 → 1.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/BarChart/Animated2DWithGradient.d.ts +3 -0
- package/dist/BarChart/Animated2DWithGradient.js +113 -0
- package/dist/BarChart/RenderBars.d.ts +3 -0
- package/dist/BarChart/RenderBars.js +264 -0
- package/dist/BarChart/RenderStackBars.d.ts +3 -0
- package/dist/BarChart/RenderStackBars.js +172 -0
- package/dist/BarChart/index.d.ts +2 -0
- package/dist/BarChart/index.js +233 -0
- package/dist/BarChart/styles.d.ts +45 -0
- package/dist/BarChart/styles.js +46 -0
- package/dist/Components/AnimatedThreeDBar/index.d.ts +3 -0
- package/dist/Components/AnimatedThreeDBar/index.js +129 -0
- package/dist/Components/AnimatedThreeDBar/styles.d.ts +10 -0
- package/dist/Components/AnimatedThreeDBar/styles.js +13 -0
- package/dist/Components/BarAndLineChartsWrapper/index.d.ts +3 -0
- package/dist/Components/BarAndLineChartsWrapper/index.js +128 -0
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.d.ts +2 -0
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +322 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.d.ts +3 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +76 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.d.ts +2 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +50 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.d.ts +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +25 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.d.ts +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +20 -0
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.d.ts +2 -0
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +94 -0
- package/dist/Components/BarSpecificComponents/barBackgroundPattern.d.ts +2 -0
- package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +9 -0
- package/dist/Components/BarSpecificComponents/cap.d.ts +2 -0
- package/dist/Components/BarSpecificComponents/cap.js +16 -0
- package/dist/Components/BarSpecificComponents/tooltip.d.ts +15 -0
- package/dist/Components/BarSpecificComponents/tooltip.js +40 -0
- package/dist/Components/common/LinearGradient.d.ts +16 -0
- package/dist/Components/common/LinearGradient.js +15 -0
- package/dist/Components/common/Pointer.d.ts +1 -0
- package/dist/Components/common/Pointer.js +16 -0
- package/dist/Components/common/StripAndLabel.d.ts +1 -0
- package/dist/Components/common/StripAndLabel.js +43 -0
- package/dist/Components/lineSvg.d.ts +14 -0
- package/dist/Components/lineSvg.js +22 -0
- package/dist/LineChart/LineChartBicolor.d.ts +2 -0
- package/dist/LineChart/LineChartBicolor.js +294 -0
- package/dist/LineChart/index.d.ts +2 -0
- package/dist/LineChart/index.js +1089 -0
- package/dist/LineChart/styles.d.ts +43 -0
- package/dist/LineChart/styles.js +46 -0
- package/dist/PieChart/index.d.ts +2 -0
- package/dist/PieChart/index.js +99 -0
- package/dist/PieChart/main.d.ts +2 -0
- package/dist/PieChart/main.js +182 -0
- package/dist/PieChartPro/index.d.ts +2 -0
- package/dist/PieChartPro/index.js +124 -0
- package/dist/PopulationPyramid/index.d.ts +2 -0
- package/dist/PopulationPyramid/index.js +130 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +12 -0
- package/package.json +21 -20
- package/src/BarChart/Animated2DWithGradient.tsx +0 -197
- package/src/BarChart/RenderBars.tsx +0 -527
- package/src/BarChart/RenderStackBars.tsx +0 -359
- package/src/BarChart/index.tsx +0 -391
- package/src/BarChart/styles.tsx +0 -47
- package/src/Components/AnimatedThreeDBar/index.tsx +0 -258
- package/src/Components/AnimatedThreeDBar/styles.tsx +0 -14
- package/src/Components/BarAndLineChartsWrapper/index.tsx +0 -246
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +0 -607
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +0 -151
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +0 -175
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +0 -86
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +0 -42
- package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +0 -131
- package/src/Components/BarSpecificComponents/barBackgroundPattern.tsx +0 -30
- package/src/Components/BarSpecificComponents/cap.tsx +0 -34
- package/src/Components/BarSpecificComponents/tooltip.tsx +0 -59
- package/src/Components/common/LinearGradient.tsx +0 -27
- package/src/Components/common/Pointer.tsx +0 -37
- package/src/Components/common/StripAndLabel.tsx +0 -98
- package/src/Components/lineSvg.tsx +0 -42
- package/src/LineChart/LineChartBicolor.tsx +0 -740
- package/src/LineChart/index.tsx +0 -2231
- package/src/LineChart/styles.tsx +0 -47
- package/src/PieChart/index.tsx +0 -168
- package/src/PieChart/main.tsx +0 -363
- package/src/PieChartPro/index.tsx +0 -267
- package/src/PopulationPyramid/index.tsx +0 -603
- package/src/index.tsx +0 -26
- package/src/todos.md +0 -24
- package/src/utils/index.ts +0 -16
|
@@ -0,0 +1,1089 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
37
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
39
|
+
import { View, Animated, Easing, Text, Dimensions, Platform, I18nManager, } from 'react-native';
|
|
40
|
+
import { styles } from './styles';
|
|
41
|
+
import { screenWidth } from '../utils';
|
|
42
|
+
import Svg, { Path, LinearGradient, Stop, Circle, Rect, Text as CanvasText, Line, } from 'react-native-svg';
|
|
43
|
+
import { getSegmentedPathObjects, getRegionPathObjects, RANGE_ENTER, RANGE_EXIT, SEGMENT_END, SEGMENT_START, STOP, useLineChart, adjustToOffset, LineDefaults, } from 'gifted-charts-core';
|
|
44
|
+
import BarAndLineChartsWrapper from '../Components/BarAndLineChartsWrapper';
|
|
45
|
+
import { StripAndLabel } from '../Components/common/StripAndLabel';
|
|
46
|
+
import { Pointer } from '../Components/common/Pointer';
|
|
47
|
+
var initialData = null;
|
|
48
|
+
var animations = [];
|
|
49
|
+
export var LineChart = function (props) {
|
|
50
|
+
var _a, _b, _c, _d, _e, _f;
|
|
51
|
+
var scrollRef = (_a = props.scrollRef) !== null && _a !== void 0 ? _a : useRef(null);
|
|
52
|
+
var opacValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
53
|
+
var heightValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
54
|
+
var widthValue = useMemo(function () { return new Animated.Value(0); }, []);
|
|
55
|
+
var widthValue2 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
56
|
+
var widthValue3 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
57
|
+
var widthValue4 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
58
|
+
var widthValue5 = useMemo(function () { return new Animated.Value(0); }, []);
|
|
59
|
+
if (!initialData) {
|
|
60
|
+
initialData = (_e = (_d = (_c = (_b = props.dataSet) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.data) !== null && _d !== void 0 ? _d : props.data) !== null && _e !== void 0 ? _e : [];
|
|
61
|
+
animations = initialData
|
|
62
|
+
.filter(function (item) { return item.value; })
|
|
63
|
+
.map(function (item) { return new Animated.Value(item.value); });
|
|
64
|
+
}
|
|
65
|
+
var _g = useLineChart(__assign(__assign({}, props), { animations: animations, parentWidth: (_f = props.parentWidth) !== null && _f !== void 0 ? _f : screenWidth })), scrollX = _g.scrollX, setScrollX = _g.setScrollX, arrow1Points = _g.arrow1Points, arrow2Points = _g.arrow2Points, arrow3Points = _g.arrow3Points, arrow4Points = _g.arrow4Points, arrow5Points = _g.arrow5Points, secondaryArrowPoints = _g.secondaryArrowPoints, pointerIndex = _g.pointerIndex, setPointerIndex = _g.setPointerIndex, pointerX = _g.pointerX, setPointerX = _g.setPointerX, pointerY = _g.pointerY, setPointerY = _g.setPointerY, pointerItem = _g.pointerItem, setPointerItem = _g.setPointerItem, pointerY2 = _g.pointerY2, setPointerY2 = _g.setPointerY2, pointerItem2 = _g.pointerItem2, setPointerItem2 = _g.setPointerItem2, pointerY3 = _g.pointerY3, setPointerY3 = _g.setPointerY3, pointerItem3 = _g.pointerItem3, setPointerItem3 = _g.setPointerItem3, pointerY4 = _g.pointerY4, setPointerY4 = _g.setPointerY4, pointerItem4 = _g.pointerItem4, setPointerItem4 = _g.setPointerItem4, pointerY5 = _g.pointerY5, setPointerY5 = _g.setPointerY5, pointerYsForDataSet = _g.pointerYsForDataSet, setPointerYsForDataSet = _g.setPointerYsForDataSet, pointerItem5 = _g.pointerItem5, setPointerItem5 = _g.setPointerItem5, secondaryPointerY = _g.secondaryPointerY, setSecondaryPointerY = _g.setSecondaryPointerY, secondaryPointerItem = _g.secondaryPointerItem, setSecondaryPointerItem = _g.setSecondaryPointerItem, responderStartTime = _g.responderStartTime, setResponderStartTime = _g.setResponderStartTime, setResponderActive = _g.setResponderActive, points = _g.points, points2 = _g.points2, points3 = _g.points3, points4 = _g.points4, points5 = _g.points5, secondaryPoints = _g.secondaryPoints, fillPoints = _g.fillPoints, fillPoints2 = _g.fillPoints2, fillPoints3 = _g.fillPoints3, fillPoints4 = _g.fillPoints4, fillPoints5 = _g.fillPoints5, secondaryFillPoints = _g.secondaryFillPoints, pointsFromSet = _g.pointsFromSet, fillPointsFromSet = _g.fillPointsFromSet, arrowPointsFromSet = _g.arrowPointsFromSet, selectedIndex = _g.selectedIndex, setSelectedIndex = _g.setSelectedIndex, containerHeight = _g.containerHeight, data = _g.data, data2 = _g.data2, data3 = _g.data3, data4 = _g.data4, data5 = _g.data5, secondaryData = _g.secondaryData, dataSet = _g.dataSet, data0 = _g.data0, labelsExtraHeight = _g.labelsExtraHeight, animationDuration = _g.animationDuration, onDataChangeAnimationDuration = _g.onDataChangeAnimationDuration, animateTogether = _g.animateTogether, animateOnDataChange = _g.animateOnDataChange, startIndex1 = _g.startIndex1, startIndex2 = _g.startIndex2, endIndex1 = _g.endIndex1, endIndex2 = _g.endIndex2, startIndex3 = _g.startIndex3, endIndex3 = _g.endIndex3, startIndex4 = _g.startIndex4, endIndex4 = _g.endIndex4, startIndex5 = _g.startIndex5, endIndex5 = _g.endIndex5, initialSpacing = _g.initialSpacing, thickness = _g.thickness, yAxisLabelWidth = _g.yAxisLabelWidth, spacing = _g.spacing, xAxisThickness = _g.xAxisThickness, dataPointsHeight1 = _g.dataPointsHeight1, dataPointsWidth1 = _g.dataPointsWidth1, dataPointsRadius1 = _g.dataPointsRadius1, dataPointsColor1 = _g.dataPointsColor1, dataPointsShape1 = _g.dataPointsShape1, dataPointsHeight2 = _g.dataPointsHeight2, dataPointsWidth2 = _g.dataPointsWidth2, dataPointsRadius2 = _g.dataPointsRadius2, dataPointsColor2 = _g.dataPointsColor2, dataPointsShape2 = _g.dataPointsShape2, dataPointsHeight3 = _g.dataPointsHeight3, dataPointsWidth3 = _g.dataPointsWidth3, dataPointsRadius3 = _g.dataPointsRadius3, dataPointsColor3 = _g.dataPointsColor3, dataPointsShape3 = _g.dataPointsShape3, dataPointsHeight4 = _g.dataPointsHeight4, dataPointsWidth4 = _g.dataPointsWidth4, dataPointsRadius4 = _g.dataPointsRadius4, dataPointsColor4 = _g.dataPointsColor4, dataPointsShape4 = _g.dataPointsShape4, dataPointsHeight5 = _g.dataPointsHeight5, dataPointsWidth5 = _g.dataPointsWidth5, dataPointsRadius5 = _g.dataPointsRadius5, dataPointsColor5 = _g.dataPointsColor5, dataPointsShape5 = _g.dataPointsShape5, getIsNthAreaChart = _g.getIsNthAreaChart, textFontSize1 = _g.textFontSize1, textFontSize2 = _g.textFontSize2, textFontSize3 = _g.textFontSize3, textFontSize4 = _g.textFontSize4, textFontSize5 = _g.textFontSize5, textColor1 = _g.textColor1, textColor2 = _g.textColor2, textColor3 = _g.textColor3, textColor4 = _g.textColor4, textColor5 = _g.textColor5, totalWidth = _g.totalWidth, maxValue = _g.maxValue, overflowTop = _g.overflowTop, extendedContainerHeight = _g.extendedContainerHeight, getX = _g.getX, getY = _g.getY, getSecondaryY = _g.getSecondaryY, secondaryMaxValue = _g.secondaryMaxValue, showValuesAsDataPointsText = _g.showValuesAsDataPointsText, thickness1 = _g.thickness1, thickness2 = _g.thickness2, thickness3 = _g.thickness3, thickness4 = _g.thickness4, thickness5 = _g.thickness5, zIndex1 = _g.zIndex1, zIndex2 = _g.zIndex2, zIndex3 = _g.zIndex3, zIndex4 = _g.zIndex4, zIndex5 = _g.zIndex5, strokeDashArray1 = _g.strokeDashArray1, strokeDashArray2 = _g.strokeDashArray2, strokeDashArray3 = _g.strokeDashArray3, strokeDashArray4 = _g.strokeDashArray4, strokeDashArray5 = _g.strokeDashArray5, rotateLabel = _g.rotateLabel, isAnimated = _g.isAnimated, hideDataPoints1 = _g.hideDataPoints1, hideDataPoints2 = _g.hideDataPoints2, hideDataPoints3 = _g.hideDataPoints3, hideDataPoints4 = _g.hideDataPoints4, hideDataPoints5 = _g.hideDataPoints5, color1 = _g.color1, color2 = _g.color2, color3 = _g.color3, color4 = _g.color4, color5 = _g.color5, startFillColor1 = _g.startFillColor1, endFillColor1 = _g.endFillColor1, startOpacity1 = _g.startOpacity1, endOpacity1 = _g.endOpacity1, startFillColor2 = _g.startFillColor2, endFillColor2 = _g.endFillColor2, startOpacity2 = _g.startOpacity2, endOpacity2 = _g.endOpacity2, startFillColor3 = _g.startFillColor3, endFillColor3 = _g.endFillColor3, startOpacity3 = _g.startOpacity3, endOpacity3 = _g.endOpacity3, startFillColor4 = _g.startFillColor4, endFillColor4 = _g.endFillColor4, startOpacity4 = _g.startOpacity4, endOpacity4 = _g.endOpacity4, startFillColor5 = _g.startFillColor5, endFillColor5 = _g.endFillColor5, startOpacity5 = _g.startOpacity5, endOpacity5 = _g.endOpacity5, arrowStrokeWidth1 = _g.arrowStrokeWidth1, arrowStrokeColor1 = _g.arrowStrokeColor1, arrowFillColor1 = _g.arrowFillColor1, arrowStrokeWidth2 = _g.arrowStrokeWidth2, arrowStrokeColor2 = _g.arrowStrokeColor2, arrowFillColor2 = _g.arrowFillColor2, arrowStrokeWidth3 = _g.arrowStrokeWidth3, arrowStrokeColor3 = _g.arrowStrokeColor3, arrowFillColor3 = _g.arrowFillColor3, arrowStrokeWidth4 = _g.arrowStrokeWidth4, arrowStrokeColor4 = _g.arrowStrokeColor4, arrowFillColor4 = _g.arrowFillColor4, arrowStrokeWidth5 = _g.arrowStrokeWidth5, arrowStrokeColor5 = _g.arrowStrokeColor5, arrowFillColor5 = _g.arrowFillColor5, arrowStrokeWidthsFromSet = _g.arrowStrokeWidthsFromSet, arrowStrokeColorsFromSet = _g.arrowStrokeColorsFromSet, arrowFillColorsFromSet = _g.arrowFillColorsFromSet, secondaryLineConfig = _g.secondaryLineConfig, gradientDirection = _g.gradientDirection, stepHeight = _g.stepHeight, noOfSectionsBelowXAxis = _g.noOfSectionsBelowXAxis, xAxisTextNumberOfLines = _g.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = _g.xAxisLabelsVerticalShift, pointerConfig = _g.pointerConfig, pointerHeight = _g.pointerHeight, pointerWidth = _g.pointerWidth, pointerRadius = _g.pointerRadius, pointerColor = _g.pointerColor, pointerComponent = _g.pointerComponent, showPointerStrip = _g.showPointerStrip, pointerStripHeight = _g.pointerStripHeight, pointerStripWidth = _g.pointerStripWidth, pointerStripColor = _g.pointerStripColor, pointerStripUptoDataPoint = _g.pointerStripUptoDataPoint, pointerLabelComponent = _g.pointerLabelComponent, stripOverPointer = _g.stripOverPointer, shiftPointerLabelX = _g.shiftPointerLabelX, shiftPointerLabelY = _g.shiftPointerLabelY, pointerLabelWidth = _g.pointerLabelWidth, pointerLabelHeight = _g.pointerLabelHeight, autoAdjustPointerLabelPosition = _g.autoAdjustPointerLabelPosition, pointerVanishDelay = _g.pointerVanishDelay, activatePointersOnLongPress = _g.activatePointersOnLongPress, activatePointersDelay = _g.activatePointersDelay, persistPointer = _g.persistPointer, hidePointer1 = _g.hidePointer1, hidePointer2 = _g.hidePointer2, hidePointer3 = _g.hidePointer3, hidePointer4 = _g.hidePointer4, hidePointer5 = _g.hidePointer5, hideSecondaryPointer = _g.hideSecondaryPointer, pointerEvents = _g.pointerEvents, focusEnabled = _g.focusEnabled, showDataPointOnFocus = _g.showDataPointOnFocus, showStripOnFocus = _g.showStripOnFocus, showTextOnFocus = _g.showTextOnFocus, showDataPointLabelOnFocus = _g.showDataPointLabelOnFocus, stripHeight = _g.stripHeight, stripWidth = _g.stripWidth, stripColor = _g.stripColor, stripOpacity = _g.stripOpacity, stripStrokeDashArray = _g.stripStrokeDashArray, unFocusOnPressOut = _g.unFocusOnPressOut, delayBeforeUnFocus = _g.delayBeforeUnFocus, containerHeightIncludingBelowXAxis = _g.containerHeightIncludingBelowXAxis, lineGradient = _g.lineGradient, lineGradientDirection = _g.lineGradientDirection, lineGradientStartColor = _g.lineGradientStartColor, lineGradientEndColor = _g.lineGradientEndColor, barAndLineChartsWrapperProps = _g.barAndLineChartsWrapperProps;
|
|
66
|
+
var secondaryXAxis = props.secondaryXAxis;
|
|
67
|
+
var widthValuesFromSet = useMemo(function () { return dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return new Animated.Value(0); }); }, []);
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
if (animateOnDataChange) {
|
|
70
|
+
Animated.parallel(animations.map(function (anItem, index) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return Animated.timing(anItem, {
|
|
73
|
+
toValue: (_b = (_a = data[index]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0,
|
|
74
|
+
useNativeDriver: Platform.OS === 'ios', // if useNativeDriver is set to true, animateOnDataChange feature fails for Android, so setting it true only for iOS
|
|
75
|
+
duration: onDataChangeAnimationDuration,
|
|
76
|
+
});
|
|
77
|
+
})).start();
|
|
78
|
+
}
|
|
79
|
+
}, [animateOnDataChange, data, onDataChangeAnimationDuration]);
|
|
80
|
+
var labelsAppear = useCallback(function () {
|
|
81
|
+
opacValue.setValue(0);
|
|
82
|
+
Animated.timing(opacValue, {
|
|
83
|
+
toValue: 1,
|
|
84
|
+
duration: 500,
|
|
85
|
+
easing: Easing.ease,
|
|
86
|
+
useNativeDriver: false,
|
|
87
|
+
}).start();
|
|
88
|
+
}, [opacValue]);
|
|
89
|
+
var appearingOpacity = opacValue.interpolate({
|
|
90
|
+
inputRange: [0, 1],
|
|
91
|
+
outputRange: [0, 1],
|
|
92
|
+
});
|
|
93
|
+
var decreaseWidth = useCallback(function () {
|
|
94
|
+
widthValue.setValue(0);
|
|
95
|
+
Animated.timing(widthValue, {
|
|
96
|
+
toValue: 1,
|
|
97
|
+
duration: animationDuration,
|
|
98
|
+
easing: Easing.linear,
|
|
99
|
+
useNativeDriver: false,
|
|
100
|
+
}).start();
|
|
101
|
+
}, [animationDuration, widthValue]);
|
|
102
|
+
var decreaseWidth2 = useCallback(function () {
|
|
103
|
+
widthValue2.setValue(0);
|
|
104
|
+
Animated.timing(widthValue2, {
|
|
105
|
+
toValue: 1,
|
|
106
|
+
duration: animationDuration,
|
|
107
|
+
easing: Easing.linear,
|
|
108
|
+
useNativeDriver: false,
|
|
109
|
+
}).start();
|
|
110
|
+
}, [animationDuration, widthValue2]);
|
|
111
|
+
var decreaseWidth3 = useCallback(function () {
|
|
112
|
+
widthValue3.setValue(0);
|
|
113
|
+
Animated.timing(widthValue3, {
|
|
114
|
+
toValue: 1,
|
|
115
|
+
duration: animationDuration,
|
|
116
|
+
easing: Easing.linear,
|
|
117
|
+
useNativeDriver: false,
|
|
118
|
+
}).start();
|
|
119
|
+
}, [animationDuration, widthValue3]);
|
|
120
|
+
var decreaseWidth4 = useCallback(function () {
|
|
121
|
+
widthValue4.setValue(0);
|
|
122
|
+
Animated.timing(widthValue4, {
|
|
123
|
+
toValue: 1,
|
|
124
|
+
duration: animationDuration,
|
|
125
|
+
easing: Easing.linear,
|
|
126
|
+
useNativeDriver: false,
|
|
127
|
+
}).start();
|
|
128
|
+
}, [animationDuration, widthValue4]);
|
|
129
|
+
var decreaseWidth5 = useCallback(function () {
|
|
130
|
+
widthValue5.setValue(0);
|
|
131
|
+
Animated.timing(widthValue5, {
|
|
132
|
+
toValue: 1,
|
|
133
|
+
duration: animationDuration,
|
|
134
|
+
easing: Easing.linear,
|
|
135
|
+
useNativeDriver: false,
|
|
136
|
+
}).start();
|
|
137
|
+
}, [animationDuration, widthValue5]);
|
|
138
|
+
var decreaseWidthsFromSet = useCallback(function () {
|
|
139
|
+
dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set, index) {
|
|
140
|
+
var _a;
|
|
141
|
+
(_a = widthValuesFromSet === null || widthValuesFromSet === void 0 ? void 0 : widthValuesFromSet[index]) === null || _a === void 0 ? void 0 : _a.setValue(0);
|
|
142
|
+
if (widthValuesFromSet === null || widthValuesFromSet === void 0 ? void 0 : widthValuesFromSet[index]) {
|
|
143
|
+
Animated.timing(widthValuesFromSet === null || widthValuesFromSet === void 0 ? void 0 : widthValuesFromSet[index], {
|
|
144
|
+
toValue: 1,
|
|
145
|
+
duration: animationDuration,
|
|
146
|
+
easing: Easing.linear,
|
|
147
|
+
useNativeDriver: false,
|
|
148
|
+
}).start();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}, [animationDuration, widthValuesFromSet]);
|
|
152
|
+
useEffect(function () {
|
|
153
|
+
decreaseWidth();
|
|
154
|
+
labelsAppear();
|
|
155
|
+
widthValuesFromSet === null || widthValuesFromSet === void 0 ? void 0 : widthValuesFromSet.forEach(function (item, index) {
|
|
156
|
+
setTimeout(function () {
|
|
157
|
+
decreaseWidthsFromSet();
|
|
158
|
+
}, animateTogether ? 0 : animationDuration * index);
|
|
159
|
+
});
|
|
160
|
+
setTimeout(function () {
|
|
161
|
+
decreaseWidth2();
|
|
162
|
+
}, animateTogether ? 0 : animationDuration);
|
|
163
|
+
setTimeout(function () {
|
|
164
|
+
decreaseWidth3();
|
|
165
|
+
}, animateTogether ? 0 : animationDuration * 2);
|
|
166
|
+
setTimeout(function () {
|
|
167
|
+
decreaseWidth4();
|
|
168
|
+
}, animateTogether ? 0 : animationDuration * 3);
|
|
169
|
+
setTimeout(function () {
|
|
170
|
+
decreaseWidth5();
|
|
171
|
+
}, animateTogether ? 0 : animationDuration * 4);
|
|
172
|
+
}, [
|
|
173
|
+
animateTogether,
|
|
174
|
+
animationDuration,
|
|
175
|
+
decreaseWidth,
|
|
176
|
+
decreaseWidth2,
|
|
177
|
+
decreaseWidth3,
|
|
178
|
+
decreaseWidth4,
|
|
179
|
+
decreaseWidth5,
|
|
180
|
+
labelsAppear,
|
|
181
|
+
]);
|
|
182
|
+
var renderLabel = function (top, index, label, labelTextStyle, labelComponent) {
|
|
183
|
+
var _a, _b;
|
|
184
|
+
return (_jsx(View, { style: [
|
|
185
|
+
{
|
|
186
|
+
position: 'absolute',
|
|
187
|
+
bottom: top
|
|
188
|
+
? containerHeight +
|
|
189
|
+
60 +
|
|
190
|
+
((_a = secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelsDistanceFromXaxis) !== null && _a !== void 0 ? _a : 15)
|
|
191
|
+
: 54 - xAxisTextNumberOfLines * 18,
|
|
192
|
+
zIndex: 10,
|
|
193
|
+
width: spacing + labelsExtraHeight,
|
|
194
|
+
left: index === 0 && initialSpacing < 10
|
|
195
|
+
? initialSpacing / 2 + spacing * index - spacing / 2 + 4
|
|
196
|
+
: initialSpacing / 2 + spacing * index - spacing / 2 - 10,
|
|
197
|
+
height: (_b = props.xAxisLabelsHeight) !== null && _b !== void 0 ? _b : xAxisTextNumberOfLines * 18,
|
|
198
|
+
},
|
|
199
|
+
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
200
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: [{ textAlign: 'center' }, labelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label })) }));
|
|
201
|
+
};
|
|
202
|
+
var renderAnimatedLabel = function (top, index, label, labelTextStyle, labelComponent) {
|
|
203
|
+
var _a, _b;
|
|
204
|
+
return (_jsx(Animated.View, { style: [
|
|
205
|
+
{
|
|
206
|
+
height: rotateLabel
|
|
207
|
+
? 40
|
|
208
|
+
: (_a = props.xAxisLabelsHeight) !== null && _a !== void 0 ? _a : xAxisTextNumberOfLines * 18,
|
|
209
|
+
position: 'absolute',
|
|
210
|
+
bottom: top
|
|
211
|
+
? containerHeight +
|
|
212
|
+
60 +
|
|
213
|
+
((_b = secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelsDistanceFromXaxis) !== null && _b !== void 0 ? _b : 15)
|
|
214
|
+
: rotateLabel
|
|
215
|
+
? 10
|
|
216
|
+
: 54 - xAxisTextNumberOfLines * 18,
|
|
217
|
+
zIndex: 10,
|
|
218
|
+
width: spacing,
|
|
219
|
+
left: index === 0 && initialSpacing < 10
|
|
220
|
+
? initialSpacing / 2 + spacing * index - spacing / 2 + 4
|
|
221
|
+
: initialSpacing / 2 + spacing * index - spacing / 2 - 10,
|
|
222
|
+
opacity: appearingOpacity,
|
|
223
|
+
},
|
|
224
|
+
rotateLabel && { transform: [{ rotate: '60deg' }] },
|
|
225
|
+
], children: labelComponent ? (labelComponent()) : (_jsx(Text, { style: [{ textAlign: 'center' }, labelTextStyle], numberOfLines: xAxisTextNumberOfLines, children: label })) }));
|
|
226
|
+
};
|
|
227
|
+
var animatedWidth = widthValue.interpolate({
|
|
228
|
+
inputRange: [0, 1],
|
|
229
|
+
outputRange: [0, totalWidth],
|
|
230
|
+
});
|
|
231
|
+
var animatedWidth2 = widthValue2.interpolate({
|
|
232
|
+
inputRange: [0, 1],
|
|
233
|
+
outputRange: [0, totalWidth],
|
|
234
|
+
});
|
|
235
|
+
var animatedWidth3 = widthValue3.interpolate({
|
|
236
|
+
inputRange: [0, 1],
|
|
237
|
+
outputRange: [0, totalWidth],
|
|
238
|
+
});
|
|
239
|
+
var animatedWidth4 = widthValue4.interpolate({
|
|
240
|
+
inputRange: [0, 1],
|
|
241
|
+
outputRange: [0, totalWidth],
|
|
242
|
+
});
|
|
243
|
+
var animatedWidth5 = widthValue5.interpolate({
|
|
244
|
+
inputRange: [0, 1],
|
|
245
|
+
outputRange: [0, totalWidth],
|
|
246
|
+
});
|
|
247
|
+
var onStripPress = function (item, index) {
|
|
248
|
+
if (props.focusedDataPointIndex === undefined || !props.onFocus) {
|
|
249
|
+
setSelectedIndex(index);
|
|
250
|
+
}
|
|
251
|
+
if (props.onFocus) {
|
|
252
|
+
props.onFocus(item, index);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
var renderDataPoints = function (hideDataPoints, dataForRender, originalDataFromProps, dataPtsShape, dataPtsWidth, dataPtsHeight, dataPtsColor, dataPtsRadius, textColor, textFontSize, startIndex, endIndex, isSecondary, showValuesAsDataPointsText) {
|
|
256
|
+
var getYOrSecondaryY = isSecondary ? getSecondaryY : getY;
|
|
257
|
+
return dataForRender.map(function (item, index) {
|
|
258
|
+
var _a;
|
|
259
|
+
var _b, _c, _d, _e, _f;
|
|
260
|
+
if (index < startIndex || index > endIndex)
|
|
261
|
+
return null;
|
|
262
|
+
if (item.hideDataPoint) {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
var dataPointsShape, dataPointsWidth, dataPointsHeight, dataPointsColor, dataPointsRadius, text, customDataPoint, dataPointLabelComponent;
|
|
266
|
+
if (index === selectedIndex) {
|
|
267
|
+
dataPointsShape =
|
|
268
|
+
item.focusedDataPointShape ||
|
|
269
|
+
props.focusedDataPointShape ||
|
|
270
|
+
item.dataPointShape ||
|
|
271
|
+
dataPtsShape;
|
|
272
|
+
dataPointsWidth =
|
|
273
|
+
item.focusedDataPointWidth ||
|
|
274
|
+
props.focusedDataPointWidth ||
|
|
275
|
+
item.dataPointWidth ||
|
|
276
|
+
dataPtsWidth;
|
|
277
|
+
dataPointsHeight =
|
|
278
|
+
item.focusedDataPointHeight ||
|
|
279
|
+
props.focusedDataPointHeight ||
|
|
280
|
+
item.dataPointHeight ||
|
|
281
|
+
dataPtsHeight;
|
|
282
|
+
dataPointsColor =
|
|
283
|
+
item.focusedDataPointColor ||
|
|
284
|
+
props.focusedDataPointColor ||
|
|
285
|
+
LineDefaults.focusedDataPointColor;
|
|
286
|
+
dataPointsRadius =
|
|
287
|
+
item.focusedDataPointRadius ||
|
|
288
|
+
props.focusedDataPointRadius ||
|
|
289
|
+
item.dataPointRadius ||
|
|
290
|
+
dataPtsRadius;
|
|
291
|
+
if (showTextOnFocus) {
|
|
292
|
+
text = item.dataPointText;
|
|
293
|
+
}
|
|
294
|
+
customDataPoint =
|
|
295
|
+
item.focusedCustomDataPoint ||
|
|
296
|
+
props.focusedCustomDataPoint ||
|
|
297
|
+
item.customDataPoint ||
|
|
298
|
+
props.customDataPoint;
|
|
299
|
+
dataPointLabelComponent =
|
|
300
|
+
item.focusedDataPointLabelComponent || item.dataPointLabelComponent;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
dataPointsShape = item.dataPointShape || dataPtsShape;
|
|
304
|
+
dataPointsWidth = item.dataPointWidth || dataPtsWidth;
|
|
305
|
+
dataPointsHeight = item.dataPointHeight || dataPtsHeight;
|
|
306
|
+
dataPointsColor = item.dataPointColor || dataPtsColor;
|
|
307
|
+
dataPointsRadius = item.dataPointRadius || dataPtsRadius;
|
|
308
|
+
if (showTextOnFocus) {
|
|
309
|
+
text = '';
|
|
310
|
+
}
|
|
311
|
+
customDataPoint = item.customDataPoint || props.customDataPoint;
|
|
312
|
+
dataPointLabelComponent = item.dataPointLabelComponent;
|
|
313
|
+
}
|
|
314
|
+
if (showValuesAsDataPointsText) {
|
|
315
|
+
text = originalDataFromProps[index].value;
|
|
316
|
+
}
|
|
317
|
+
var currentStripHeight = (_b = item.stripHeight) !== null && _b !== void 0 ? _b : stripHeight;
|
|
318
|
+
var currentStripWidth = (_c = item.stripWidth) !== null && _c !== void 0 ? _c : stripWidth;
|
|
319
|
+
var currentStripOpacity = (_d = item.stripOpacity) !== null && _d !== void 0 ? _d : stripOpacity;
|
|
320
|
+
var currentStripStrokeDashArray = (_f = (_e = item.stripStrokeDashArray) !== null && _e !== void 0 ? _e : stripStrokeDashArray) !== null && _f !== void 0 ? _f : '';
|
|
321
|
+
var currentStripColor = item.stripColor || stripColor;
|
|
322
|
+
var position = I18nManager.isRTL ? 'right' : 'left';
|
|
323
|
+
var y1 = currentStripHeight
|
|
324
|
+
? containerHeight - currentStripHeight + 8
|
|
325
|
+
: containerHeight -
|
|
326
|
+
dataPointsHeight / 2 +
|
|
327
|
+
14 -
|
|
328
|
+
(item.value * containerHeight) / maxValue;
|
|
329
|
+
var actualStripHeight = currentStripHeight ||
|
|
330
|
+
(item.value * containerHeight) / maxValue - 2 + overflowTop;
|
|
331
|
+
return (_jsxs(Fragment, { children: [focusEnabled ? (_jsx(_Fragment, { children: unFocusOnPressOut ? ( // remove strip on onFocus
|
|
332
|
+
_jsx(Rect, { onPressIn: function () { return onStripPress(item, index); }, onPressOut: function () {
|
|
333
|
+
return setTimeout(function () { return setSelectedIndex(-1); }, delayBeforeUnFocus);
|
|
334
|
+
}, x: initialSpacing + (spacing * index - spacing / 2), y: 8, width: spacing, height: containerHeight - 0, fill: 'none' })) : (_jsx(Rect, { onPress: function () { return onStripPress(item, index); }, x: initialSpacing + (spacing * index - spacing / 2), y: 8, width: spacing, height: containerHeight, fill: 'none' })) })) : null, item.showStrip ||
|
|
335
|
+
(focusEnabled && index === selectedIndex && showStripOnFocus) ? (_jsx(Line, { x1: initialSpacing + spacing * index - currentStripWidth / 2 - 1, y1: y1, x2: initialSpacing + spacing * index - currentStripWidth / 2 - 1, y2: y1 + actualStripHeight, strokeWidth: currentStripWidth, stroke: currentStripColor, strokeDasharray: currentStripStrokeDashArray, opacity: currentStripOpacity })) : null, hideDataPoints ? null : (_jsxs(_Fragment, { children: [customDataPoint ? (_jsx(View, { style: [
|
|
336
|
+
styles.customDataPointContainer,
|
|
337
|
+
(_a = {
|
|
338
|
+
height: dataPointsHeight,
|
|
339
|
+
width: dataPointsWidth,
|
|
340
|
+
top: getYOrSecondaryY(item.value)
|
|
341
|
+
},
|
|
342
|
+
_a[position] = initialSpacing - dataPointsWidth + spacing * index,
|
|
343
|
+
_a.transform = [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
344
|
+
_a),
|
|
345
|
+
], children: customDataPoint(item, index) })) : null, dataPointsShape === 'rectangular' ? (_jsx(Fragment, { children: customDataPoint ? null : (_jsx(Rect, { x: getX(index) - dataPointsWidth / 2, y: getYOrSecondaryY(item.value) - dataPointsHeight / 2, width: dataPointsWidth, height: dataPointsHeight, fill: showDataPointOnFocus
|
|
346
|
+
? index === selectedIndex
|
|
347
|
+
? dataPointsColor
|
|
348
|
+
: 'none'
|
|
349
|
+
: dataPointsColor, onPress: function () {
|
|
350
|
+
item.onPress
|
|
351
|
+
? item.onPress(item, index)
|
|
352
|
+
: props.onPress
|
|
353
|
+
? props.onPress(item, index)
|
|
354
|
+
: null;
|
|
355
|
+
} })) }, index)) : (_jsx(Fragment, { children: customDataPoint ? null : (_jsx(Circle, { cx: getX(index), cy: getYOrSecondaryY(item.value), r: dataPointsRadius, fill: showDataPointOnFocus
|
|
356
|
+
? index === selectedIndex
|
|
357
|
+
? dataPointsColor
|
|
358
|
+
: 'none'
|
|
359
|
+
: dataPointsColor, onPress: function () {
|
|
360
|
+
item.onPress
|
|
361
|
+
? item.onPress(item, index)
|
|
362
|
+
: props.onPress
|
|
363
|
+
? props.onPress(item, index)
|
|
364
|
+
: null;
|
|
365
|
+
} })) }, index)), dataPointLabelComponent ? (!showTextOnFocus || index === selectedIndex ? (_jsx(View, { style: [
|
|
366
|
+
styles.customDataPointContainer,
|
|
367
|
+
{
|
|
368
|
+
zIndex: index === selectedIndex ? 1000 : 0,
|
|
369
|
+
top: containerHeight +
|
|
370
|
+
(item.dataPointLabelShiftY ||
|
|
371
|
+
props.dataPointLabelShiftY ||
|
|
372
|
+
0) -
|
|
373
|
+
(item.value * containerHeight) / maxValue,
|
|
374
|
+
left: initialSpacing +
|
|
375
|
+
(item.dataPointLabelShiftX ||
|
|
376
|
+
props.dataPointLabelShiftX ||
|
|
377
|
+
0) -
|
|
378
|
+
(item.dataPointLabelWidth
|
|
379
|
+
? item.dataPointLabelWidth + 20
|
|
380
|
+
: props.dataPointLabelWidth
|
|
381
|
+
? props.dataPointLabelWidth + 20
|
|
382
|
+
: 50) /
|
|
383
|
+
2 +
|
|
384
|
+
spacing * index,
|
|
385
|
+
},
|
|
386
|
+
], children: showDataPointLabelOnFocus
|
|
387
|
+
? index === selectedIndex
|
|
388
|
+
? dataPointLabelComponent()
|
|
389
|
+
: null
|
|
390
|
+
: dataPointLabelComponent() })) : null) : text || item.dataPointText ? (!showTextOnFocus || index === selectedIndex ? (_jsx(CanvasText, { fill: item.textColor || textColor, fontSize: item.textFontSize || textFontSize, x: getX(index) -
|
|
391
|
+
dataPointsWidth +
|
|
392
|
+
(item.textShiftX || props.textShiftX || 0), y: getYOrSecondaryY(item.value) -
|
|
393
|
+
dataPointsHeight / 2 +
|
|
394
|
+
(item.textShiftY || props.textShiftY || 0), children: !showTextOnFocus && !showValuesAsDataPointsText
|
|
395
|
+
? item.dataPointText
|
|
396
|
+
: text })) : null) : null] }))] }, index));
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
var renderSpecificVerticalLines = function (dataForRender) {
|
|
400
|
+
return dataForRender.map(function (item, index) {
|
|
401
|
+
var _a, _b, _c;
|
|
402
|
+
if (item.showVerticalLine) {
|
|
403
|
+
var x = getX(index);
|
|
404
|
+
return (_jsx(Line, { x1: x, y1: extendedContainerHeight, x2: x, y2: ((_a = item.verticalLineUptoDataPoint) !== null && _a !== void 0 ? _a : props.verticalLinesUptoDataPoint)
|
|
405
|
+
? getY(item.value)
|
|
406
|
+
: -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));
|
|
407
|
+
}
|
|
408
|
+
return null;
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
var renderPointer = function (lineNumber, isDataSet) {
|
|
412
|
+
if (isDataSet) {
|
|
413
|
+
var pointerItemLocal_1, pointerYLocal_1, pointerColorLocal_1;
|
|
414
|
+
return dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set, index) {
|
|
415
|
+
var _a, _b;
|
|
416
|
+
var pIndex = barAndLineChartsWrapperProps.pointerIndex;
|
|
417
|
+
pointerItemLocal_1 = set.data[pIndex];
|
|
418
|
+
pointerYLocal_1 = pointerYsForDataSet[index];
|
|
419
|
+
pointerColorLocal_1 =
|
|
420
|
+
(_b = (_a = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColorsForDataSet) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : pointerColor;
|
|
421
|
+
return (_jsx(Fragment, { children: Pointer({
|
|
422
|
+
pointerX: pointerX,
|
|
423
|
+
pointerYLocal: pointerYLocal_1 + xAxisThickness,
|
|
424
|
+
pointerComponent: pointerComponent,
|
|
425
|
+
pointerHeight: pointerHeight,
|
|
426
|
+
pointerRadius: pointerRadius,
|
|
427
|
+
pointerWidth: pointerWidth,
|
|
428
|
+
pointerItemLocal: pointerItemLocal_1,
|
|
429
|
+
pointerColorLocal: pointerColorLocal_1,
|
|
430
|
+
}) }, 'dSetPts' + index));
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
if (lineNumber === 1 && hidePointer1)
|
|
434
|
+
return;
|
|
435
|
+
if (lineNumber === 2 && hidePointer2)
|
|
436
|
+
return;
|
|
437
|
+
if (lineNumber === 3 && hidePointer3)
|
|
438
|
+
return;
|
|
439
|
+
if (lineNumber === 4 && hidePointer4)
|
|
440
|
+
return;
|
|
441
|
+
if (lineNumber === 5 && hidePointer5)
|
|
442
|
+
return;
|
|
443
|
+
// 6 is for secondaryData
|
|
444
|
+
if (lineNumber === 6 && hideSecondaryPointer)
|
|
445
|
+
return;
|
|
446
|
+
var pointerItemLocal, pointerYLocal, pointerColorLocal;
|
|
447
|
+
switch (lineNumber) {
|
|
448
|
+
case 1:
|
|
449
|
+
pointerItemLocal = pointerItem;
|
|
450
|
+
pointerYLocal = pointerY;
|
|
451
|
+
pointerColorLocal = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointer1Color) || pointerColor;
|
|
452
|
+
break;
|
|
453
|
+
case 2:
|
|
454
|
+
pointerItemLocal = pointerItem2;
|
|
455
|
+
pointerYLocal = pointerY2;
|
|
456
|
+
pointerColorLocal = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointer2Color) || pointerColor;
|
|
457
|
+
break;
|
|
458
|
+
case 3:
|
|
459
|
+
pointerItemLocal = pointerItem3;
|
|
460
|
+
pointerYLocal = pointerY3;
|
|
461
|
+
pointerColorLocal = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointer3Color) || pointerColor;
|
|
462
|
+
break;
|
|
463
|
+
case 4:
|
|
464
|
+
pointerItemLocal = pointerItem4;
|
|
465
|
+
pointerYLocal = pointerY4;
|
|
466
|
+
pointerColorLocal = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointer4Color) || pointerColor;
|
|
467
|
+
break;
|
|
468
|
+
case 5:
|
|
469
|
+
pointerItemLocal = pointerItem5;
|
|
470
|
+
pointerYLocal = pointerY5;
|
|
471
|
+
pointerColorLocal = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointer5Color) || pointerColor;
|
|
472
|
+
break;
|
|
473
|
+
case 6:
|
|
474
|
+
pointerItemLocal = secondaryPointerItem;
|
|
475
|
+
pointerYLocal = secondaryPointerY;
|
|
476
|
+
pointerColorLocal =
|
|
477
|
+
(pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.secondaryPointerColor) || pointerColor;
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
if (!pointerYLocal)
|
|
481
|
+
return;
|
|
482
|
+
return Pointer({
|
|
483
|
+
pointerX: pointerX,
|
|
484
|
+
pointerYLocal: pointerYLocal + xAxisThickness,
|
|
485
|
+
pointerComponent: pointerComponent,
|
|
486
|
+
pointerHeight: pointerHeight,
|
|
487
|
+
pointerRadius: pointerRadius,
|
|
488
|
+
pointerWidth: pointerWidth,
|
|
489
|
+
pointerItemLocal: pointerItemLocal,
|
|
490
|
+
pointerColorLocal: pointerColorLocal,
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
var renderStripAndLabel = function () {
|
|
494
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
495
|
+
var pointerItemLocal, pointerYLocal;
|
|
496
|
+
pointerItemLocal = [
|
|
497
|
+
__assign(__assign({}, pointerItem), { value: (_b = (_a = props.data) === null || _a === void 0 ? void 0 : _a[pointerIndex]) === null || _b === void 0 ? void 0 : _b.value }),
|
|
498
|
+
];
|
|
499
|
+
var arr = [pointerY];
|
|
500
|
+
if (pointerY2 !== 0) {
|
|
501
|
+
arr.push(pointerY2);
|
|
502
|
+
pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_d = (_c = props.data2) === null || _c === void 0 ? void 0 : _c[pointerIndex]) === null || _d === void 0 ? void 0 : _d.value }));
|
|
503
|
+
}
|
|
504
|
+
if (pointerY3 !== 0) {
|
|
505
|
+
arr.push(pointerY3);
|
|
506
|
+
pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_f = (_e = props.data3) === null || _e === void 0 ? void 0 : _e[pointerIndex]) === null || _f === void 0 ? void 0 : _f.value }));
|
|
507
|
+
}
|
|
508
|
+
if (pointerY4 !== 0) {
|
|
509
|
+
arr.push(pointerY4);
|
|
510
|
+
pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_h = (_g = props.data4) === null || _g === void 0 ? void 0 : _g[pointerIndex]) === null || _h === void 0 ? void 0 : _h.value }));
|
|
511
|
+
}
|
|
512
|
+
if (pointerY5 !== 0) {
|
|
513
|
+
arr.push(pointerY5);
|
|
514
|
+
pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_k = (_j = props.data5) === null || _j === void 0 ? void 0 : _j[pointerIndex]) === null || _k === void 0 ? void 0 : _k.value }));
|
|
515
|
+
}
|
|
516
|
+
if (secondaryPointerY !== 0) {
|
|
517
|
+
pointerItemLocal.push(__assign(__assign({}, pointerItem), { value: (_m = (_l = props.secondaryData) === null || _l === void 0 ? void 0 : _l[pointerIndex]) === null || _m === void 0 ? void 0 : _m.value }));
|
|
518
|
+
}
|
|
519
|
+
pointerYLocal = Math.min.apply(Math, __spreadArray([], __read(arr), false));
|
|
520
|
+
return StripAndLabel({
|
|
521
|
+
autoAdjustPointerLabelPosition: autoAdjustPointerLabelPosition,
|
|
522
|
+
pointerX: pointerX,
|
|
523
|
+
pointerLabelWidth: pointerLabelWidth,
|
|
524
|
+
activatePointersOnLongPress: activatePointersOnLongPress,
|
|
525
|
+
yAxisLabelWidth: yAxisLabelWidth,
|
|
526
|
+
pointerRadius: pointerRadius,
|
|
527
|
+
pointerWidth: pointerWidth,
|
|
528
|
+
shiftPointerLabelX: shiftPointerLabelX,
|
|
529
|
+
pointerLabelHeight: pointerLabelHeight,
|
|
530
|
+
pointerYLocal: pointerYLocal,
|
|
531
|
+
pointerStripUptoDataPoint: pointerStripUptoDataPoint,
|
|
532
|
+
pointerStripHeight: pointerStripHeight,
|
|
533
|
+
shiftPointerLabelY: shiftPointerLabelY,
|
|
534
|
+
pointerItemLocal: pointerItemLocal,
|
|
535
|
+
showPointerStrip: showPointerStrip,
|
|
536
|
+
pointerStripWidth: pointerStripWidth,
|
|
537
|
+
containerHeight: containerHeight,
|
|
538
|
+
xAxisThickness: xAxisThickness,
|
|
539
|
+
pointerStripColor: pointerStripColor,
|
|
540
|
+
pointerConfig: pointerConfig,
|
|
541
|
+
pointerLabelComponent: pointerLabelComponent,
|
|
542
|
+
secondaryPointerItem: secondaryPointerItem,
|
|
543
|
+
scrollX: scrollX,
|
|
544
|
+
pointerEvents: pointerEvents,
|
|
545
|
+
});
|
|
546
|
+
};
|
|
547
|
+
var getLineGradientComponent = function () {
|
|
548
|
+
return props.lineGradientComponent ? (props.lineGradientComponent()) : (_jsxs(LinearGradient, { id: "lineGradient", x1: "0", y1: "0", x2: lineGradientDirection === 'horizontal' ? '1' : '0', y2: lineGradientDirection === 'vertical' ? '1' : '0', children: [_jsx(Stop, { offset: "0", stopColor: lineGradientStartColor }), _jsx(Stop, { offset: "1", stopColor: lineGradientEndColor })] }));
|
|
549
|
+
};
|
|
550
|
+
var getAreaGradientComponent = function (startFillColor, endFillColor, startOpacity, endOpacity) {
|
|
551
|
+
return props.areaGradientComponent ? (props.areaGradientComponent()) : (_jsxs(LinearGradient, { id: "Gradient", x1: "0", y1: "0", x2: gradientDirection === 'horizontal' ? '1' : '0', y2: gradientDirection === 'vertical' ? '1' : '0', children: [_jsx(Stop, { offset: "0", stopColor: startFillColor, stopOpacity: startOpacity.toString() }), _jsx(Stop, { offset: "1", stopColor: endFillColor, stopOpacity: endOpacity.toString() })] }));
|
|
552
|
+
};
|
|
553
|
+
var lineSvgComponent = function (points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) {
|
|
554
|
+
var _a, _b;
|
|
555
|
+
if (!points)
|
|
556
|
+
return null;
|
|
557
|
+
var isCurved = points.includes('C');
|
|
558
|
+
var isNthAreaChart = getIsNthAreaChart(key !== null && key !== void 0 ? key : 0);
|
|
559
|
+
var ar = [{ d: '', color: '', strokeWidth: 0 }];
|
|
560
|
+
if (points.includes(RANGE_ENTER)) {
|
|
561
|
+
ar = getRegionPathObjects(points, color, currentLineThickness !== null && currentLineThickness !== void 0 ? currentLineThickness : 0, thickness, strokeDashArray !== null && strokeDashArray !== void 0 ? strokeDashArray : [], isCurved, RANGE_ENTER, STOP, RANGE_EXIT);
|
|
562
|
+
}
|
|
563
|
+
else if (points.includes(SEGMENT_START)) {
|
|
564
|
+
ar = getSegmentedPathObjects(points, color, currentLineThickness !== null && currentLineThickness !== void 0 ? currentLineThickness : 0, thickness, strokeDashArray !== null && strokeDashArray !== void 0 ? strokeDashArray : [], isCurved, SEGMENT_START, SEGMENT_END);
|
|
565
|
+
}
|
|
566
|
+
var lineSvgPropsOuter = {
|
|
567
|
+
d: points,
|
|
568
|
+
fill: 'none',
|
|
569
|
+
stroke: lineGradient
|
|
570
|
+
? props.lineGradientId
|
|
571
|
+
? "url(#".concat(props.lineGradientId, ")")
|
|
572
|
+
: "url(#lineGradient)"
|
|
573
|
+
: color,
|
|
574
|
+
strokeWidth: currentLineThickness || thickness,
|
|
575
|
+
};
|
|
576
|
+
if (strokeDashArray &&
|
|
577
|
+
strokeDashArray.length === 2 &&
|
|
578
|
+
typeof strokeDashArray[0] === 'number' &&
|
|
579
|
+
typeof strokeDashArray[1] === 'number') {
|
|
580
|
+
lineSvgPropsOuter.strokeDasharray = strokeDashArray;
|
|
581
|
+
}
|
|
582
|
+
return (_jsxs(Svg, { onPress: props.onBackgroundPress, children: [lineGradient && getLineGradientComponent(), points.includes(SEGMENT_START) || points.includes(RANGE_ENTER) ? (ar.map(function (item, index) {
|
|
583
|
+
var lineSvgProps = {
|
|
584
|
+
d: item.d,
|
|
585
|
+
fill: 'none',
|
|
586
|
+
stroke: lineGradient
|
|
587
|
+
? props.lineGradientId
|
|
588
|
+
? "url(#".concat(props.lineGradientId, ")")
|
|
589
|
+
: "url(#lineGradient)"
|
|
590
|
+
: item.color,
|
|
591
|
+
strokeWidth: item.strokeWidth,
|
|
592
|
+
};
|
|
593
|
+
if (item.strokeDashArray &&
|
|
594
|
+
item.strokeDashArray.length === 2 &&
|
|
595
|
+
typeof item.strokeDashArray[0] === 'number' &&
|
|
596
|
+
typeof item.strokeDashArray[1] === 'number') {
|
|
597
|
+
lineSvgProps.strokeDasharray = item.strokeDashArray;
|
|
598
|
+
}
|
|
599
|
+
return _jsx(Path, __assign({}, lineSvgProps), index);
|
|
600
|
+
})) : (_jsx(Path, __assign({}, lineSvgPropsOuter))), isNthAreaChart &&
|
|
601
|
+
getAreaGradientComponent(startFillColor, endFillColor, startOpacity, endOpacity), isNthAreaChart && (_jsx(Path, { onPress: props.onChartAreaPress, d: fillPoints, fill: props.areaGradientId
|
|
602
|
+
? "url(#".concat(props.areaGradientId, ")")
|
|
603
|
+
: "url(#Gradient)", stroke: 'transparent', strokeWidth: currentLineThickness || thickness })), renderSpecificVerticalLines(data), renderSpecificVerticalLines(data2), renderSpecificVerticalLines(data3), renderSpecificVerticalLines(data4), renderSpecificVerticalLines(data5), (_a = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) { return renderSpecificVerticalLines(set === null || set === void 0 ? void 0 : set.data); })) !== null && _a !== void 0 ? _a : null, (_b = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
|
|
604
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
605
|
+
return renderDataPoints((_a = set.hideDataPoints) !== null && _a !== void 0 ? _a : hideDataPoints1, set.data, adjustToOffset(set.data, -((_b = props.yAxisOffset) !== null && _b !== void 0 ? _b : 0)), // need the actual values passed by user
|
|
606
|
+
(_c = set.dataPointsShape) !== null && _c !== void 0 ? _c : dataPointsShape1, (_d = set.dataPointsWidth) !== null && _d !== void 0 ? _d : dataPointsWidth1, (_e = set.dataPointsHeight) !== null && _e !== void 0 ? _e : dataPointsHeight1, (_f = set.dataPointsColor) !== null && _f !== void 0 ? _f : dataPointsColor1, (_g = set.dataPointsRadius) !== null && _g !== void 0 ? _g : dataPointsRadius1, (_h = set.textColor) !== null && _h !== void 0 ? _h : textColor1, (_j = set.textFontSize) !== null && _j !== void 0 ? _j : textFontSize1, (_k = set.startIndex) !== null && _k !== void 0 ? _k : 0, (_l = set.endIndex) !== null && _l !== void 0 ? _l : set.data.length - 1, set.isSecondary, showValuesAsDataPointsText);
|
|
607
|
+
})) !== null && _b !== void 0 ? _b : null, renderDataPoints(hideDataPoints1, data, props.data, dataPointsShape1, dataPointsWidth1, dataPointsHeight1, dataPointsColor1, dataPointsRadius1, textColor1, textFontSize1, startIndex1, endIndex1, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints2, data2, props.data2, dataPointsShape2, dataPointsWidth2, dataPointsHeight2, dataPointsColor2, dataPointsRadius2, textColor2, textFontSize2, startIndex2, endIndex2, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints3, data3, props.data3, dataPointsShape3, dataPointsWidth3, dataPointsHeight3, dataPointsColor3, dataPointsRadius3, textColor3, textFontSize3, startIndex3, endIndex3, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints4, data4, props.data4, dataPointsShape4, dataPointsWidth4, dataPointsHeight4, dataPointsColor4, dataPointsRadius4, textColor4, textFontSize4, startIndex4, endIndex4, false, showValuesAsDataPointsText), renderDataPoints(hideDataPoints5, data5, props.data5, dataPointsShape5, dataPointsWidth5, dataPointsHeight5, dataPointsColor5, dataPointsRadius5, textColor5, textFontSize5, startIndex5, endIndex5, false, showValuesAsDataPointsText), (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length)
|
|
608
|
+
? renderDataPoints(secondaryLineConfig.hideDataPoints, secondaryData, props.secondaryData, secondaryLineConfig.dataPointsShape, secondaryLineConfig.dataPointsWidth, secondaryLineConfig.dataPointsHeight, secondaryLineConfig.dataPointsColor, secondaryLineConfig.dataPointsRadius, secondaryLineConfig.textColor, secondaryLineConfig.textFontSize, secondaryLineConfig.startIndex, secondaryLineConfig.endIndex, true, secondaryLineConfig.showValuesAsDataPointsText)
|
|
609
|
+
: null, showArrow && (_jsx(Path, { d: arrowPoints, fill: arrowFillColor, stroke: arrowStrokeColor, strokeWidth: arrowStrokeWidth }))] }));
|
|
610
|
+
};
|
|
611
|
+
var activatePointers = function (x) {
|
|
612
|
+
var factor = (x - initialSpacing) / spacing;
|
|
613
|
+
factor = Math.round(factor);
|
|
614
|
+
factor = Math.min(factor, (data0 !== null && data0 !== void 0 ? data0 : data).length - 1);
|
|
615
|
+
factor = Math.max(factor, 0);
|
|
616
|
+
var z = initialSpacing +
|
|
617
|
+
spacing * factor -
|
|
618
|
+
(pointerRadius || pointerWidth / 2) -
|
|
619
|
+
1;
|
|
620
|
+
setPointerX(z);
|
|
621
|
+
setPointerIndex(factor);
|
|
622
|
+
var item, y;
|
|
623
|
+
item = (data0 !== null && data0 !== void 0 ? data0 : data)[factor];
|
|
624
|
+
y =
|
|
625
|
+
containerHeight -
|
|
626
|
+
(item.value * containerHeight) / maxValue -
|
|
627
|
+
(pointerRadius || pointerHeight / 2) +
|
|
628
|
+
10;
|
|
629
|
+
setPointerY(y);
|
|
630
|
+
setPointerItem(item);
|
|
631
|
+
if (data2 && data2.length) {
|
|
632
|
+
item = data2[factor];
|
|
633
|
+
if (item) {
|
|
634
|
+
y =
|
|
635
|
+
containerHeight -
|
|
636
|
+
(item.value * containerHeight) / maxValue -
|
|
637
|
+
(pointerRadius || pointerHeight / 2) +
|
|
638
|
+
10;
|
|
639
|
+
setPointerY2(y);
|
|
640
|
+
setPointerItem2(item);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (data3 && data3.length) {
|
|
644
|
+
item = data3[factor];
|
|
645
|
+
if (item) {
|
|
646
|
+
y =
|
|
647
|
+
containerHeight -
|
|
648
|
+
(item.value * containerHeight) / maxValue -
|
|
649
|
+
(pointerRadius || pointerHeight / 2) +
|
|
650
|
+
10;
|
|
651
|
+
setPointerY3(y);
|
|
652
|
+
setPointerItem3(item);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
if (data4 && data4.length) {
|
|
656
|
+
item = data4[factor];
|
|
657
|
+
if (item) {
|
|
658
|
+
y =
|
|
659
|
+
containerHeight -
|
|
660
|
+
(item.value * containerHeight) / maxValue -
|
|
661
|
+
(pointerRadius || pointerHeight / 2) +
|
|
662
|
+
10;
|
|
663
|
+
setPointerY4(y);
|
|
664
|
+
setPointerItem4(item);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (data5 && data5.length) {
|
|
668
|
+
item = data5[factor];
|
|
669
|
+
if (item) {
|
|
670
|
+
y =
|
|
671
|
+
containerHeight -
|
|
672
|
+
(item.value * containerHeight) / maxValue -
|
|
673
|
+
(pointerRadius || pointerHeight / 2) +
|
|
674
|
+
10;
|
|
675
|
+
setPointerY5(y);
|
|
676
|
+
setPointerItem5(item);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length) {
|
|
680
|
+
item = secondaryData[factor];
|
|
681
|
+
if (item) {
|
|
682
|
+
y =
|
|
683
|
+
containerHeight -
|
|
684
|
+
(item.value * containerHeight) / secondaryMaxValue -
|
|
685
|
+
(pointerRadius || pointerHeight / 2) +
|
|
686
|
+
10;
|
|
687
|
+
setSecondaryPointerY(y);
|
|
688
|
+
// @ts-ignore
|
|
689
|
+
setSecondaryPointerItem(item);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
if (dataSet === null || dataSet === void 0 ? void 0 : dataSet.length) {
|
|
693
|
+
if (dataSet[0].data[factor]) {
|
|
694
|
+
var ysForDataSet = dataSet.map(function (set) {
|
|
695
|
+
var item = set.data[factor];
|
|
696
|
+
var y = item
|
|
697
|
+
? containerHeight -
|
|
698
|
+
(item.value * containerHeight) / maxValue -
|
|
699
|
+
(pointerRadius || pointerHeight / 2) +
|
|
700
|
+
10
|
|
701
|
+
: 0;
|
|
702
|
+
return y;
|
|
703
|
+
});
|
|
704
|
+
setPointerYsForDataSet(ysForDataSet);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
var renderLine = function (zIndex, points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) {
|
|
709
|
+
var _a, _b;
|
|
710
|
+
return (_jsx(View, { onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onResponderGrant: function (evt) {
|
|
711
|
+
if (!pointerConfig)
|
|
712
|
+
return;
|
|
713
|
+
setResponderStartTime(evt.timeStamp);
|
|
714
|
+
if (activatePointersOnLongPress) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
var x = evt.nativeEvent.locationX;
|
|
718
|
+
activatePointers(x);
|
|
719
|
+
}, onResponderMove: function (evt) {
|
|
720
|
+
if (!pointerConfig)
|
|
721
|
+
return;
|
|
722
|
+
if (activatePointersOnLongPress &&
|
|
723
|
+
evt.timeStamp - responderStartTime < activatePointersDelay) {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
setResponderActive(true);
|
|
728
|
+
}
|
|
729
|
+
var x = evt.nativeEvent.locationX;
|
|
730
|
+
if (!activatePointersOnLongPress &&
|
|
731
|
+
x > (props.width || Dimensions.get('window').width))
|
|
732
|
+
return;
|
|
733
|
+
var factor = (x - initialSpacing) / spacing;
|
|
734
|
+
factor = Math.round(factor);
|
|
735
|
+
factor = Math.min(factor, (data0 !== null && data0 !== void 0 ? data0 : data).length - 1);
|
|
736
|
+
factor = Math.max(factor, 0);
|
|
737
|
+
var z = initialSpacing +
|
|
738
|
+
spacing * factor -
|
|
739
|
+
(pointerRadius || pointerWidth / 2) -
|
|
740
|
+
1;
|
|
741
|
+
var item, y;
|
|
742
|
+
setPointerX(z);
|
|
743
|
+
setPointerIndex(factor);
|
|
744
|
+
item = (data0 !== null && data0 !== void 0 ? data0 : data)[factor];
|
|
745
|
+
y =
|
|
746
|
+
containerHeight -
|
|
747
|
+
(item.value * containerHeight) / maxValue -
|
|
748
|
+
(pointerRadius || pointerHeight / 2) +
|
|
749
|
+
10;
|
|
750
|
+
setPointerY(y);
|
|
751
|
+
setPointerItem(item);
|
|
752
|
+
if (data2 && data2.length) {
|
|
753
|
+
item = data2[factor];
|
|
754
|
+
if (item) {
|
|
755
|
+
y =
|
|
756
|
+
containerHeight -
|
|
757
|
+
(item.value * containerHeight) / maxValue -
|
|
758
|
+
(pointerRadius || pointerHeight / 2) +
|
|
759
|
+
10;
|
|
760
|
+
setPointerY2(y);
|
|
761
|
+
setPointerItem2(item);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
if (data3 && data3.length) {
|
|
765
|
+
item = data3[factor];
|
|
766
|
+
if (item) {
|
|
767
|
+
y =
|
|
768
|
+
containerHeight -
|
|
769
|
+
(item.value * containerHeight) / maxValue -
|
|
770
|
+
(pointerRadius || pointerHeight / 2) +
|
|
771
|
+
10;
|
|
772
|
+
setPointerY3(y);
|
|
773
|
+
setPointerItem3(item);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
if (data4 && data4.length) {
|
|
777
|
+
item = data4[factor];
|
|
778
|
+
if (item) {
|
|
779
|
+
y =
|
|
780
|
+
containerHeight -
|
|
781
|
+
(item.value * containerHeight) / maxValue -
|
|
782
|
+
(pointerRadius || pointerHeight / 2) +
|
|
783
|
+
10;
|
|
784
|
+
setPointerY4(y);
|
|
785
|
+
setPointerItem4(item);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
if (data5 && data5.length) {
|
|
789
|
+
item = data5[factor];
|
|
790
|
+
if (item) {
|
|
791
|
+
y =
|
|
792
|
+
containerHeight -
|
|
793
|
+
(item.value * containerHeight) / maxValue -
|
|
794
|
+
(pointerRadius || pointerHeight / 2) +
|
|
795
|
+
10;
|
|
796
|
+
setPointerY5(y);
|
|
797
|
+
setPointerItem5(item);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
if (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length) {
|
|
801
|
+
item = secondaryData[factor];
|
|
802
|
+
if (item) {
|
|
803
|
+
y =
|
|
804
|
+
containerHeight -
|
|
805
|
+
(item.value * containerHeight) / secondaryMaxValue -
|
|
806
|
+
(pointerRadius || pointerHeight / 2) +
|
|
807
|
+
10;
|
|
808
|
+
setSecondaryPointerY(y);
|
|
809
|
+
// @ts-ignore
|
|
810
|
+
setSecondaryPointerItem(item);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if (dataSet === null || dataSet === void 0 ? void 0 : dataSet.length) {
|
|
814
|
+
var ysForDataSet = dataSet.map(function (set) {
|
|
815
|
+
var item = set.data[factor];
|
|
816
|
+
var y = item
|
|
817
|
+
? containerHeight -
|
|
818
|
+
(item.value * containerHeight) / maxValue -
|
|
819
|
+
(pointerRadius || pointerHeight / 2) +
|
|
820
|
+
10
|
|
821
|
+
: 0;
|
|
822
|
+
return y;
|
|
823
|
+
});
|
|
824
|
+
setPointerYsForDataSet(ysForDataSet);
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
// onResponderReject={evt => {
|
|
828
|
+
// console.log('evt...reject.......',evt);
|
|
829
|
+
// }}
|
|
830
|
+
onResponderEnd: function (evt) {
|
|
831
|
+
// console.log('evt...end.......',evt);
|
|
832
|
+
setResponderStartTime(0);
|
|
833
|
+
setPointerIndex(-1);
|
|
834
|
+
setResponderActive(false);
|
|
835
|
+
if (!persistPointer)
|
|
836
|
+
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
837
|
+
}, onResponderTerminationRequest: function (evt) { return false; },
|
|
838
|
+
// onResponderTerminate={evt => {
|
|
839
|
+
// console.log('evt...terminate.......',evt);
|
|
840
|
+
// }}
|
|
841
|
+
// onResponderRelease={evt => {
|
|
842
|
+
// setResponderStartTime(0);
|
|
843
|
+
// setResponderActive(false);
|
|
844
|
+
// setTimeout(() => setPointerX(0), pointerVanishDelay);
|
|
845
|
+
// }}
|
|
846
|
+
style: {
|
|
847
|
+
position: 'absolute',
|
|
848
|
+
height: containerHeightIncludingBelowXAxis +
|
|
849
|
+
((_a = props.overflowBottom) !== null && _a !== void 0 ? _a : dataPointsRadius1),
|
|
850
|
+
bottom: 60 +
|
|
851
|
+
xAxisLabelsVerticalShift +
|
|
852
|
+
labelsExtraHeight -
|
|
853
|
+
xAxisThickness -
|
|
854
|
+
((_b = props.overflowBottom) !== null && _b !== void 0 ? _b : dataPointsRadius1),
|
|
855
|
+
zIndex: zIndex,
|
|
856
|
+
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
857
|
+
width: totalWidth,
|
|
858
|
+
}, children: lineSvgComponent(points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) }, key !== null && key !== void 0 ? key : 0));
|
|
859
|
+
};
|
|
860
|
+
var renderAnimatedLine = function (zIndex, points, animatedWidth, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) {
|
|
861
|
+
var _a, _b;
|
|
862
|
+
return (_jsx(Animated.View, { onStartShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onMoveShouldSetResponder: function (evt) { return (pointerConfig ? true : false); }, onResponderGrant: function (evt) {
|
|
863
|
+
if (!pointerConfig)
|
|
864
|
+
return;
|
|
865
|
+
setResponderStartTime(evt.timeStamp);
|
|
866
|
+
if (activatePointersOnLongPress) {
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
var x = evt.nativeEvent.locationX;
|
|
870
|
+
activatePointers(x);
|
|
871
|
+
}, onResponderMove: function (evt) {
|
|
872
|
+
if (!pointerConfig)
|
|
873
|
+
return;
|
|
874
|
+
if (activatePointersOnLongPress &&
|
|
875
|
+
evt.timeStamp - responderStartTime < activatePointersDelay) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
setResponderActive(true);
|
|
880
|
+
}
|
|
881
|
+
var x = evt.nativeEvent.locationX;
|
|
882
|
+
if (!activatePointersOnLongPress &&
|
|
883
|
+
x > (props.width || Dimensions.get('window').width))
|
|
884
|
+
return;
|
|
885
|
+
var factor = (x - initialSpacing) / spacing;
|
|
886
|
+
factor = Math.round(factor);
|
|
887
|
+
factor = Math.min(factor, (data0 !== null && data0 !== void 0 ? data0 : data).length - 1);
|
|
888
|
+
factor = Math.max(factor, 0);
|
|
889
|
+
var z = initialSpacing +
|
|
890
|
+
spacing * factor -
|
|
891
|
+
(pointerRadius || pointerWidth / 2) -
|
|
892
|
+
1;
|
|
893
|
+
var item, y;
|
|
894
|
+
setPointerX(z);
|
|
895
|
+
setPointerIndex(factor);
|
|
896
|
+
item = (data0 !== null && data0 !== void 0 ? data0 : data)[factor];
|
|
897
|
+
y =
|
|
898
|
+
containerHeight -
|
|
899
|
+
(item.value * containerHeight) / maxValue -
|
|
900
|
+
(pointerRadius || pointerHeight / 2) +
|
|
901
|
+
10;
|
|
902
|
+
setPointerY(y);
|
|
903
|
+
setPointerItem(item);
|
|
904
|
+
if (data2 && data2.length) {
|
|
905
|
+
item = data2[factor];
|
|
906
|
+
if (item) {
|
|
907
|
+
y =
|
|
908
|
+
containerHeight -
|
|
909
|
+
(item.value * containerHeight) / maxValue -
|
|
910
|
+
(pointerRadius || pointerHeight / 2) +
|
|
911
|
+
10;
|
|
912
|
+
setPointerY2(y);
|
|
913
|
+
setPointerItem2(item);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
if (data3 && data3.length) {
|
|
917
|
+
item = data3[factor];
|
|
918
|
+
if (item) {
|
|
919
|
+
y =
|
|
920
|
+
containerHeight -
|
|
921
|
+
(item.value * containerHeight) / maxValue -
|
|
922
|
+
(pointerRadius || pointerHeight / 2) +
|
|
923
|
+
10;
|
|
924
|
+
setPointerY3(y);
|
|
925
|
+
setPointerItem3(item);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
if (data4 && data4.length) {
|
|
929
|
+
item = data4[factor];
|
|
930
|
+
if (item) {
|
|
931
|
+
y =
|
|
932
|
+
containerHeight -
|
|
933
|
+
(item.value * containerHeight) / maxValue -
|
|
934
|
+
(pointerRadius || pointerHeight / 2) +
|
|
935
|
+
10;
|
|
936
|
+
setPointerY4(y);
|
|
937
|
+
setPointerItem4(item);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
if (data5 && data5.length) {
|
|
941
|
+
item = data5[factor];
|
|
942
|
+
if (item) {
|
|
943
|
+
y =
|
|
944
|
+
containerHeight -
|
|
945
|
+
(item.value * containerHeight) / maxValue -
|
|
946
|
+
(pointerRadius || pointerHeight / 2) +
|
|
947
|
+
10;
|
|
948
|
+
setPointerY5(y);
|
|
949
|
+
setPointerItem5(item);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
if (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length) {
|
|
953
|
+
item = secondaryData[factor];
|
|
954
|
+
if (item) {
|
|
955
|
+
y =
|
|
956
|
+
containerHeight -
|
|
957
|
+
(item.value * containerHeight) / secondaryMaxValue -
|
|
958
|
+
(pointerRadius || pointerHeight / 2) +
|
|
959
|
+
10;
|
|
960
|
+
setSecondaryPointerY(y);
|
|
961
|
+
// @ts-ignore
|
|
962
|
+
setSecondaryPointerItem(item);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
if (dataSet === null || dataSet === void 0 ? void 0 : dataSet.length) {
|
|
966
|
+
if (dataSet[0].data[factor]) {
|
|
967
|
+
var ysForDataSet = dataSet.map(function (set) {
|
|
968
|
+
var item = set.data[factor];
|
|
969
|
+
var y = item
|
|
970
|
+
? containerHeight -
|
|
971
|
+
(item.value * containerHeight) / maxValue -
|
|
972
|
+
(pointerRadius || pointerHeight / 2) +
|
|
973
|
+
10
|
|
974
|
+
: 0;
|
|
975
|
+
return y;
|
|
976
|
+
});
|
|
977
|
+
setPointerYsForDataSet(ysForDataSet);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
// onResponderReject={evt => {
|
|
982
|
+
// console.log('evt...reject.......',evt);
|
|
983
|
+
// }}
|
|
984
|
+
onResponderEnd: function (evt) {
|
|
985
|
+
// console.log('evt...end.......',evt);
|
|
986
|
+
setResponderStartTime(0);
|
|
987
|
+
setPointerIndex(-1);
|
|
988
|
+
setResponderActive(false);
|
|
989
|
+
if (!persistPointer)
|
|
990
|
+
setTimeout(function () { return setPointerX(0); }, pointerVanishDelay);
|
|
991
|
+
}, onResponderTerminationRequest: function (evt) { return false; },
|
|
992
|
+
// onResponderTerminate={evt => {
|
|
993
|
+
// console.log('evt...terminate.......',evt);
|
|
994
|
+
// }}
|
|
995
|
+
// onResponderRelease={evt => {
|
|
996
|
+
// setResponderStartTime(0);
|
|
997
|
+
// setResponderActive(false);
|
|
998
|
+
// setTimeout(() => setPointerX(0), pointerVanishDelay);
|
|
999
|
+
// }}
|
|
1000
|
+
style: {
|
|
1001
|
+
position: 'absolute',
|
|
1002
|
+
height: containerHeightIncludingBelowXAxis +
|
|
1003
|
+
((_a = props.overflowBottom) !== null && _a !== void 0 ? _a : dataPointsRadius1),
|
|
1004
|
+
bottom: 60 +
|
|
1005
|
+
xAxisLabelsVerticalShift +
|
|
1006
|
+
labelsExtraHeight -
|
|
1007
|
+
xAxisThickness -
|
|
1008
|
+
((_b = props.overflowBottom) !== null && _b !== void 0 ? _b : dataPointsRadius1),
|
|
1009
|
+
zIndex: zIndex,
|
|
1010
|
+
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
|
|
1011
|
+
width: animatedWidth,
|
|
1012
|
+
}, children: lineSvgComponent(points, currentLineThickness, color, fillPoints, startFillColor, endFillColor, startOpacity, endOpacity, strokeDashArray, showArrow, arrowPoints, arrowStrokeWidth, arrowStrokeColor, arrowFillColor, key) }, key !== null && key !== void 0 ? key : 0));
|
|
1013
|
+
};
|
|
1014
|
+
var remainingScrollViewProps = {
|
|
1015
|
+
onScroll: function (ev) {
|
|
1016
|
+
var _a;
|
|
1017
|
+
(_a = props.onScroll) === null || _a === void 0 ? void 0 : _a.call(props, ev);
|
|
1018
|
+
if (pointerConfig &&
|
|
1019
|
+
pointerConfig.activatePointersOnLongPress &&
|
|
1020
|
+
pointerConfig.autoAdjustPointerLabelPosition) {
|
|
1021
|
+
setScrollX(ev.nativeEvent.contentOffset.x);
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
};
|
|
1025
|
+
var renderChartContent = function () {
|
|
1026
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1027
|
+
return (_jsxs(_Fragment, { children: [dataSet
|
|
1028
|
+
? pointsFromSet.length
|
|
1029
|
+
? dataSet.map(function (set, index) {
|
|
1030
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1031
|
+
if (isAnimated) {
|
|
1032
|
+
return renderAnimatedLine((_a = set.zIndex) !== null && _a !== void 0 ? _a : zIndex1, pointsFromSet[index], animatedWidth, (_b = set.thickness) !== null && _b !== void 0 ? _b : thickness1, (_c = set.color) !== null && _c !== void 0 ? _c : color1, fillPointsFromSet[index], (_d = set.startFillColor) !== null && _d !== void 0 ? _d : startFillColor1, (_e = set.endFillColor) !== null && _e !== void 0 ? _e : endFillColor1, (_f = set.startOpacity) !== null && _f !== void 0 ? _f : startOpacity1, (_g = set.endOpacity) !== null && _g !== void 0 ? _g : endOpacity1, (_h = set.strokeDashArray) !== null && _h !== void 0 ? _h : strokeDashArray1, set.showArrow || props.showArrows, arrowPointsFromSet[index], arrowStrokeWidthsFromSet === null || arrowStrokeWidthsFromSet === void 0 ? void 0 : arrowStrokeWidthsFromSet[index], arrowStrokeColorsFromSet === null || arrowStrokeColorsFromSet === void 0 ? void 0 : arrowStrokeColorsFromSet[index], arrowFillColorsFromSet === null || arrowFillColorsFromSet === void 0 ? void 0 : arrowFillColorsFromSet[index], index);
|
|
1033
|
+
}
|
|
1034
|
+
else {
|
|
1035
|
+
return renderLine((_j = set.zIndex) !== null && _j !== void 0 ? _j : zIndex1, pointsFromSet[index], (_k = set.thickness) !== null && _k !== void 0 ? _k : thickness1, (_l = set.color) !== null && _l !== void 0 ? _l : color1, fillPointsFromSet[index], (_m = set.startFillColor) !== null && _m !== void 0 ? _m : startFillColor1, (_o = set.endFillColor) !== null && _o !== void 0 ? _o : endFillColor1, (_p = set.startOpacity) !== null && _p !== void 0 ? _p : startOpacity1, (_q = set.endOpacity) !== null && _q !== void 0 ? _q : endOpacity1, (_r = set.strokeDashArray) !== null && _r !== void 0 ? _r : strokeDashArray1, set.showArrow || props.showArrows, arrowPointsFromSet[index], arrowStrokeWidthsFromSet === null || arrowStrokeWidthsFromSet === void 0 ? void 0 : arrowStrokeWidthsFromSet[index], arrowStrokeColorsFromSet === null || arrowStrokeColorsFromSet === void 0 ? void 0 : arrowStrokeColorsFromSet[index], arrowFillColorsFromSet === null || arrowFillColorsFromSet === void 0 ? void 0 : arrowFillColorsFromSet[index], index);
|
|
1036
|
+
}
|
|
1037
|
+
})
|
|
1038
|
+
: null
|
|
1039
|
+
: isAnimated
|
|
1040
|
+
? renderAnimatedLine(zIndex1, points, animatedWidth, thickness1, color1, fillPoints, startFillColor1, endFillColor1, startOpacity1, endOpacity1, strokeDashArray1, props.showArrow1 || props.showArrows, arrow1Points, arrowStrokeWidth1, arrowStrokeColor1, arrowFillColor1, 0)
|
|
1041
|
+
: renderLine(zIndex1, points, thickness1, color1, fillPoints, startFillColor1, endFillColor1, startOpacity1, endOpacity1, strokeDashArray1, props.showArrow1 || props.showArrows, arrow1Points, arrowStrokeWidth1, arrowStrokeColor1, arrowFillColor1, 0), secondaryPoints
|
|
1042
|
+
? isAnimated
|
|
1043
|
+
? renderAnimatedLine(secondaryLineConfig.zIndex, secondaryPoints, animatedWidth, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_a = secondaryLineConfig.arrowConfig) === null || _a === void 0 ? void 0 : _a.strokeWidth, (_b = secondaryLineConfig.arrowConfig) === null || _b === void 0 ? void 0 : _b.strokeColor, (_c = secondaryLineConfig.arrowConfig) === null || _c === void 0 ? void 0 : _c.fillColor, 6)
|
|
1044
|
+
: renderLine(secondaryLineConfig.zIndex, secondaryPoints, secondaryLineConfig.thickness, secondaryLineConfig.color, secondaryFillPoints, secondaryLineConfig.startFillColor, secondaryLineConfig.endFillColor, secondaryLineConfig.startOpacity, secondaryLineConfig.endOpacity, secondaryLineConfig.strokeDashArray, secondaryLineConfig.showArrow, secondaryArrowPoints, (_d = secondaryLineConfig.arrowConfig) === null || _d === void 0 ? void 0 : _d.strokeWidth, (_e = secondaryLineConfig.arrowConfig) === null || _e === void 0 ? void 0 : _e.strokeColor, (_f = secondaryLineConfig.arrowConfig) === null || _f === void 0 ? void 0 : _f.fillColor, 6)
|
|
1045
|
+
: null, points2
|
|
1046
|
+
? isAnimated
|
|
1047
|
+
? renderAnimatedLine(zIndex2, points2, animatedWidth2, thickness2, color2, fillPoints2, startFillColor2, endFillColor2, startOpacity2, endOpacity2, strokeDashArray2, props.showArrow2 || props.showArrows, arrow2Points, arrowStrokeWidth2, arrowStrokeColor2, arrowFillColor2, 1)
|
|
1048
|
+
: renderLine(zIndex2, points2, thickness2, color2, fillPoints2, startFillColor2, endFillColor2, startOpacity2, endOpacity2, strokeDashArray2, props.showArrow2 || props.showArrows, arrow2Points, arrowStrokeWidth2, arrowStrokeColor2, arrowFillColor2, 1)
|
|
1049
|
+
: null, points3
|
|
1050
|
+
? isAnimated
|
|
1051
|
+
? renderAnimatedLine(zIndex3, points3, animatedWidth3, thickness3, color3, fillPoints3, startFillColor3, endFillColor3, startOpacity3, endOpacity3, strokeDashArray3, props.showArrow3 || props.showArrows, arrow3Points, arrowStrokeWidth3, arrowStrokeColor3, arrowFillColor3, 2)
|
|
1052
|
+
: renderLine(zIndex3, points3, thickness3, color3, fillPoints3, startFillColor3, endFillColor3, startOpacity3, endOpacity3, strokeDashArray3, props.showArrow3 || props.showArrows, arrow3Points, arrowStrokeWidth3, arrowStrokeColor3, arrowFillColor3, 2)
|
|
1053
|
+
: null, points4
|
|
1054
|
+
? isAnimated
|
|
1055
|
+
? renderAnimatedLine(zIndex4, points4, animatedWidth4, thickness4, color4, fillPoints4, startFillColor4, endFillColor4, startOpacity4, endOpacity4, strokeDashArray4, props.showArrow4 || props.showArrows, arrow4Points, arrowStrokeWidth4, arrowStrokeColor4, arrowFillColor4, 3)
|
|
1056
|
+
: renderLine(zIndex4, points4, thickness4, color4, fillPoints4, startFillColor4, endFillColor4, startOpacity4, endOpacity4, strokeDashArray4, props.showArrow4 || props.showArrows, arrow4Points, arrowStrokeWidth4, arrowStrokeColor4, arrowFillColor4, 3)
|
|
1057
|
+
: null, points5
|
|
1058
|
+
? isAnimated
|
|
1059
|
+
? renderAnimatedLine(zIndex5, points5, animatedWidth5, thickness5, color5, fillPoints5, startFillColor5, endFillColor5, startOpacity5, endOpacity5, strokeDashArray5, props.showArrow5 || props.showArrows, arrow5Points, arrowStrokeWidth5, arrowStrokeColor5, arrowFillColor5, 4)
|
|
1060
|
+
: renderLine(zIndex5, points5, thickness5, color5, fillPoints5, startFillColor5, endFillColor5, startOpacity5, endOpacity5, strokeDashArray5, props.showArrow5 || props.showArrows, arrow5Points, arrowStrokeWidth5, arrowStrokeColor5, arrowFillColor5, 4)
|
|
1061
|
+
: null, pointerX > 0 ? (_jsxs(View, { pointerEvents: pointerEvents !== null && pointerEvents !== void 0 ? pointerEvents : 'none', style: {
|
|
1062
|
+
position: 'absolute',
|
|
1063
|
+
height: extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight,
|
|
1064
|
+
bottom: 58 + labelsExtraHeight + xAxisLabelsVerticalShift - overflowTop,
|
|
1065
|
+
// width: totalWidth,
|
|
1066
|
+
zIndex: 20,
|
|
1067
|
+
}, children: [!stripOverPointer && renderStripAndLabel(), dataSet ? (renderPointer(0, true)) : (
|
|
1068
|
+
// dataSet.map((set, index) => renderPointer(index))
|
|
1069
|
+
_jsxs(_Fragment, { children: [renderPointer(1), points2 ? renderPointer(2) : null, points3 ? renderPointer(3) : null, points4 ? renderPointer(4) : null, points5 ? renderPointer(5) : null, secondaryPoints ? renderPointer(6) : null, stripOverPointer && renderStripAndLabel()] }))] })) : null, (data0 !== null && data0 !== void 0 ? data0 : data).map(function (item, index) {
|
|
1070
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1071
|
+
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 : '';
|
|
1072
|
+
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;
|
|
1073
|
+
return (_jsxs(View, { children: [isAnimated
|
|
1074
|
+
? renderAnimatedLabel(false, index, item.label ||
|
|
1075
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
1076
|
+
? props.xAxisLabelTexts[index]
|
|
1077
|
+
: ''), item.labelTextStyle || props.xAxisLabelTextStyle, item.labelComponent)
|
|
1078
|
+
: renderLabel(false, index, item.label ||
|
|
1079
|
+
(props.xAxisLabelTexts && props.xAxisLabelTexts[index]
|
|
1080
|
+
? props.xAxisLabelTexts[index]
|
|
1081
|
+
: ''), item.labelTextStyle || props.xAxisLabelTextStyle, item.labelComponent), secondaryXAxis
|
|
1082
|
+
? isAnimated
|
|
1083
|
+
? renderAnimatedLabel(true, index, secondaryLabel, secondaryLabelTextStyle, item.secondaryLabelComponent)
|
|
1084
|
+
: renderLabel(true, index, secondaryLabel, secondaryLabelTextStyle, item.secondaryLabelComponent)
|
|
1085
|
+
: null] }, index));
|
|
1086
|
+
})] }));
|
|
1087
|
+
};
|
|
1088
|
+
return (_jsx(BarAndLineChartsWrapper, __assign({}, barAndLineChartsWrapperProps, { scrollRef: scrollRef, animatedWidth: animatedWidth, renderChartContent: renderChartContent, remainingScrollViewProps: remainingScrollViewProps })));
|
|
1089
|
+
};
|