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