react-native-gifted-charts 1.4.19 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/BarChart/Animated2DWithGradient.js +1 -0
- package/dist/BarChart/RenderBars.js +1 -0
- package/dist/BarChart/RenderStackBars.js +1 -0
- package/dist/BarChart/index.js +1 -0
- package/dist/BarChart/styles.js +1 -0
- package/dist/Components/AnimatedThreeDBar/index.js +1 -0
- package/dist/Components/AnimatedThreeDBar/styles.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/index.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +1 -0
- package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +1 -0
- package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +1 -0
- package/dist/Components/BarSpecificComponents/cap.js +1 -0
- package/dist/Components/BarSpecificComponents/tooltip.js +1 -0
- package/dist/Components/common/LinearGradient.js +1 -0
- package/dist/Components/common/Pointer.js +1 -0
- package/dist/Components/common/StripAndLabel.js +1 -0
- package/dist/Components/lineSvg.js +1 -0
- package/dist/LineChart/LineChartBicolor.js +1 -0
- package/dist/LineChart/index.js +1 -0
- package/dist/LineChart/styles.js +1 -0
- package/dist/PieChart/index.js +1 -0
- package/dist/PieChart/main.js +1 -0
- package/dist/PieChartPro/index.js +1 -0
- package/dist/PopulationPyramid/index.js +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +21 -20
- package/src/BarChart/Animated2DWithGradient.tsx +0 -197
- package/src/BarChart/RenderBars.tsx +0 -527
- package/src/BarChart/RenderStackBars.tsx +0 -359
- package/src/BarChart/index.tsx +0 -391
- package/src/BarChart/styles.tsx +0 -47
- package/src/Components/AnimatedThreeDBar/index.tsx +0 -258
- package/src/Components/AnimatedThreeDBar/styles.tsx +0 -14
- package/src/Components/BarAndLineChartsWrapper/index.tsx +0 -246
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +0 -607
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +0 -147
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +0 -158
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +0 -86
- package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +0 -42
- package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +0 -131
- package/src/Components/BarSpecificComponents/barBackgroundPattern.tsx +0 -30
- package/src/Components/BarSpecificComponents/cap.tsx +0 -34
- package/src/Components/BarSpecificComponents/tooltip.tsx +0 -59
- package/src/Components/common/LinearGradient.tsx +0 -27
- package/src/Components/common/Pointer.tsx +0 -37
- package/src/Components/common/StripAndLabel.tsx +0 -98
- package/src/Components/lineSvg.tsx +0 -42
- package/src/LineChart/LineChartBicolor.tsx +0 -740
- package/src/LineChart/index.tsx +0 -2228
- package/src/LineChart/styles.tsx +0 -47
- package/src/PieChart/index.tsx +0 -168
- package/src/PieChart/main.tsx +0 -363
- package/src/PieChartPro/index.tsx +0 -267
- package/src/PopulationPyramid/index.tsx +0 -603
- package/src/index.tsx +0 -26
- package/src/todos.md +0 -24
- package/src/utils/index.ts +0 -16
package/README.md
CHANGED
|
@@ -23,6 +23,8 @@ The exact same piece of code that you write to render charts in react-native, ca
|
|
|
23
23
|
|
|
24
24
|
## [Release notes 🎉](release-notes/release-notes.md)
|
|
25
25
|
|
|
26
|
+
See the **[release changes by version here.](release-notes/release-notes.md)**
|
|
27
|
+
|
|
26
28
|
|
|
27
29
|
<img src='/demos/bars.png' alt=''/>
|
|
28
30
|
<img src='/demos/lineArea.png' alt=''/>
|
|
@@ -50,16 +52,17 @@ The exact same piece of code that you write to render charts in react-native, ca
|
|
|
50
52
|
### React Native CLI
|
|
51
53
|
|
|
52
54
|
```sh
|
|
53
|
-
npm install react-native-gifted-charts react-native-linear-gradient react-native-svg
|
|
55
|
+
npm install react-native-gifted-charts gifted-charts-core react-native-linear-gradient react-native-svg
|
|
54
56
|
```
|
|
55
57
|
|
|
56
58
|
### Expo
|
|
57
59
|
|
|
58
60
|
```sh
|
|
59
|
-
npx expo install react-native-gifted-charts expo-linear-gradient react-native-svg
|
|
61
|
+
npx expo install react-native-gifted-charts gifted-charts-core expo-linear-gradient react-native-svg
|
|
60
62
|
```
|
|
61
63
|
|
|
62
|
-
Please note that `react-native-svg` and `react-native-linear-gradient`/`expo-linear-gradient` are needed for the library to work, so make sure they are installed in your project.
|
|
64
|
+
Please note that `gifted-charts-core`, `react-native-svg` and `react-native-linear-gradient`/`expo-linear-gradient` are needed for the library to work, so make sure they are installed in your project. <br />
|
|
65
|
+
**[gifted-charts-core](https://www.npmjs.com/package/gifted-charts-core)** contains the mathematical and logical utilities used by this library.
|
|
63
66
|
|
|
64
67
|
# Docs
|
|
65
68
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _cap=_interopRequireDefault(require("../Components/BarSpecificComponents/cap"));var _LinearGradient=_interopRequireDefault(require("../Components/common/LinearGradient"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/BarChart/Animated2DWithGradient.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;}if(_reactNative.Platform.OS==='android'){_reactNative.UIManager.setLayoutAnimationEnabledExperimental&&_reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);}var Animated2DWithGradient=function Animated2DWithGradient(props){var barBackgroundPattern=props.barBackgroundPattern,patternId=props.patternId,barWidth=props.barWidth,barStyle=props.barStyle,item=props.item,index=props.index,opacity=props.opacity,animationDuration=props.animationDuration,noGradient=props.noGradient,noAnimation=props.noAnimation,barMarginBottom=props.barMarginBottom,barInnerComponent=props.barInnerComponent,intactTopLabel=props.intactTopLabel,showValuesAsTopLabel=props.showValuesAsTopLabel,topLabelContainerStyle=props.topLabelContainerStyle,topLabelTextStyle=props.topLabelTextStyle,commonStyleForBar=props.commonStyleForBar,barStyleWithBackground=props.barStyleWithBackground,yAxisOffset=props.yAxisOffset;var _useState=(0,_react.useState)(noAnimation?props.height:0.2),_useState2=(0,_slicedToArray2.default)(_useState,2),height=_useState2[0],setHeight=_useState2[1];var _useState3=(0,_react.useState)(noAnimation?false:true),_useState4=(0,_slicedToArray2.default)(_useState3,2),initialRender=_useState4[0],setInitialRender=_useState4[1];(0,_react.useEffect)(function(){if(!noAnimation){if(initialRender){setTimeout(function(){return layoutAppear();},20);}else{elevate();}}else{setHeight(props.height);}},[props.height]);var elevate=function elevate(){_reactNative.LayoutAnimation.configureNext({duration:animationDuration,update:{type:'linear',property:'scaleXY'}});setHeight(props.height);};var layoutAppear=function layoutAppear(){_reactNative.LayoutAnimation.configureNext({duration:_reactNative.Platform.OS=='ios'?animationDuration:20,create:{type:'linear',property:'opacity'},update:{type:'linear',property:'scaleXY'}});setInitialRender(false);setTimeout(function(){return elevate();},_reactNative.Platform.OS=='ios'?10:100);};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[!initialRender&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',bottom:0,width:'100%',overflow:'hidden',height:(noAnimation?Math.max(props.minHeight,Math.abs(height)):height)-(barMarginBottom||0)},children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{width:'100%',height:(noAnimation?Math.max(props.minHeight,Math.abs(height)):height)-(barMarginBottom||0)},item.barStyle||barStyle],children:[noGradient?(0,_jsxRuntime.jsx)(_reactNative.View,{style:barStyleWithBackground,children:props.cappedBars&&item.value?(0,_jsxRuntime.jsx)(_cap.default,{capThicknessFromItem:item.capThickness,capThicknessFromProps:props.capThickness,capColorFromItem:item.capColor,capColorFromProps:props.capColor,capRadiusFromItem:item.capRadius,capRadiusFromProps:props.capRadius}):null}):(0,_jsxRuntime.jsx)(_LinearGradient.default,{style:commonStyleForBar,start:{x:0,y:0},end:{x:1,y:1},colors:[item.gradientColor||props.gradientColor||'white',item.frontColor||props.frontColor||'black'],children:props.cappedBars&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',width:'100%',height:item.capThickness===0?0:item.capThickness||props.capThickness||6,backgroundColor:item.capColor||props.capColor||'black',borderTopLeftRadius:item.capRadius===0?0:item.capRadius||props.capRadius||0,borderTopRightRadius:item.capRadius===0?0:item.capRadius||props.capRadius||0}})}),(item.barBackgroundPattern||barBackgroundPattern)&&(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Defs,{children:item.barBackgroundPattern?item.barBackgroundPattern():barBackgroundPattern==null?void 0:barBackgroundPattern()}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{stroke:"transparent",x:"1",y:"1",width:item.barWidth||props.barWidth||30,height:noAnimation?Math.abs(height):height,fill:`url(#${item.patternId||patternId})`})]}),barInnerComponent?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:'100%',width:'100%'},children:barInnerComponent(item,index)}):null]})}),item.topLabelComponent||showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{position:'absolute',top:(item.barWidth||barWidth||30)*-1,height:item.barWidth||barWidth||30,width:item.barWidth||barWidth||30,justifyContent:props.horizontal&&!intactTopLabel||item.value<0?'center':'flex-end',alignItems:'center',opacity:opacity},item.value<0&&{transform:[{rotate:'180deg'}]},props.horizontal&&!intactTopLabel&&{transform:[{rotate:'270deg'}]},topLabelContainerStyle!=null?topLabelContainerStyle:item.topLabelContainerStyle],children:showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:topLabelTextStyle,children:item.value+yAxisOffset}):item.topLabelComponent==null?void 0:item.topLabelComponent()}):null]});};var _default=exports.default=Animated2DWithGradient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _AnimatedThreeDBar=_interopRequireDefault(require("../Components/AnimatedThreeDBar"));var _Animated2DWithGradient=_interopRequireDefault(require("./Animated2DWithGradient"));var _cap=_interopRequireDefault(require("../Components/BarSpecificComponents/cap"));var _barBackgroundPattern=_interopRequireDefault(require("../Components/BarSpecificComponents/barBackgroundPattern"));var _LinearGradient=_interopRequireDefault(require("../Components/common/LinearGradient"));var _giftedChartsCore=require("gifted-charts-core");var _tooltip=_interopRequireDefault(require("../Components/BarSpecificComponents/tooltip"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/BarChart/RenderBars.tsx";var RenderBars=function RenderBars(props){var _item$barInnerCompone,_focusedBarConfig$bar,_ref,_item$leftShiftForToo;var item=props.item,index=props.index,containerHeight=props.containerHeight,maxValue=props.maxValue,minHeight=props.minHeight,spacing=props.spacing,propSpacing=props.propSpacing,side=props.side,data=props.data,barBorderWidth=props.barBorderWidth,barBorderColor=props.barBorderColor,isThreeD=props.isThreeD,isAnimated=props.isAnimated,rotateLabel=props.rotateLabel,appearingOpacity=props.appearingOpacity,animationDuration=props.animationDuration,autoShiftLabels=props.autoShiftLabels,label=props.label,secondaryLabel=props.secondaryLabel,labelTextStyle=props.labelTextStyle,secondaryLabelTextStyle=props.secondaryLabelTextStyle,xAxisTextNumberOfLines=props.xAxisTextNumberOfLines,xAxisLabelsVerticalShift=props.xAxisLabelsVerticalShift,renderTooltip=props.renderTooltip,leftShiftForTooltip=props.leftShiftForTooltip,leftShiftForLastIndexTooltip=props.leftShiftForLastIndexTooltip,initialSpacing=props.initialSpacing,selectedIndex=props.selectedIndex,setSelectedIndex=props.setSelectedIndex,_props$xAxisThickness=props.xAxisThickness,xAxisThickness=_props$xAxisThickness===void 0?_giftedChartsCore.AxesAndRulesDefaults.xAxisThickness:_props$xAxisThickness,horizontal=props.horizontal,rtl=props.rtl,intactTopLabel=props.intactTopLabel,showValuesAsTopLabel=props.showValuesAsTopLabel,topLabelContainerStyle=props.topLabelContainerStyle,topLabelTextStyle=props.topLabelTextStyle,pointerConfig=props.pointerConfig,noOfSectionsBelowXAxis=props.noOfSectionsBelowXAxis,yAxisOffset=props.yAxisOffset,barWidth=props.barWidth,_props$labelsDistance=props.labelsDistanceFromXaxis,labelsDistanceFromXaxis=_props$labelsDistance===void 0?0:_props$labelsDistance,stepHeight=props.stepHeight,stepValue=props.stepValue,negativeStepHeight=props.negativeStepHeight,negativeStepValue=props.negativeStepValue,autoCenterTooltip=props.autoCenterTooltip,secondaryXAxis=props.secondaryXAxis;var heightFactor=item.value<0?negativeStepHeight/negativeStepValue:stepHeight/stepValue;var barHeight=Math.max(minHeight,Math.abs(item.value)*heightFactor-xAxisThickness);var _getPropsForAnimated=(0,_giftedChartsCore.getPropsForAnimated2DWithGradient)(Object.assign({},props,{barHeight:barHeight})),commonStyleForBar=_getPropsForAnimated.commonStyleForBar,barStyleWithBackground=_getPropsForAnimated.barStyleWithBackground,commonPropsFor2Dand3Dbars=_getPropsForAnimated.commonPropsFor2Dand3Dbars,isFocused=_getPropsForAnimated.isFocused,focusedBarConfig=_getPropsForAnimated.focusedBarConfig,localFrontColor=_getPropsForAnimated.localFrontColor;var itemOrPropsBarInnerComponent=(_item$barInnerCompone=item.barInnerComponent)!=null?_item$barInnerCompone:props.barInnerComponent;var localBarInnerComponent=isFocused?(_focusedBarConfig$bar=focusedBarConfig==null?void 0:focusedBarConfig.barInnerComponent)!=null?_focusedBarConfig$bar:itemOrPropsBarInnerComponent:itemOrPropsBarInnerComponent;var barMarginBottom=item.barMarginBottom===0?0:item.barMarginBottom||props.barMarginBottom||0;var renderLabel=function renderLabel(top,label,labelTextStyle,value){var _props$xAxisLabelsHei,_secondaryXAxis$label;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{width:(item.labelWidth||props.labelWidth||item.barWidth||barWidth)+spacing,left:spacing/-2,position:'absolute',height:(_props$xAxisLabelsHei=props.xAxisLabelsHeight)!=null?_props$xAxisLabelsHei:xAxisTextNumberOfLines*18,bottom:top?(containerHeight||200)+((_secondaryXAxis$label=secondaryXAxis==null?void 0:secondaryXAxis.labelsDistanceFromXaxis)!=null?_secondaryXAxis$label:15):(rotateLabel?-40:-6-xAxisTextNumberOfLines*18-xAxisLabelsVerticalShift)-barMarginBottom-labelsDistanceFromXaxis},rotateLabel?horizontal?{transform:[{rotate:'330deg'}]}:{transform:[{rotate:value<0?'240deg':'60deg'},{translateX:value<0?56:0},{translateY:value<0?32:0}]}:horizontal?{transform:[{rotate:'-90deg'}]}:value<0?{transform:[{rotate:'180deg'},{translateY:autoShiftLabels?0:16.5*xAxisTextNumberOfLines+14}]}:{}],children:top?item.secondaryLabelComponent?item.secondaryLabelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label}):item.labelComponent?item.labelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label})});};var renderAnimatedLabel=function renderAnimatedLabel(top,label,labelTextStyle,value){var _props$xAxisLabelsHei2,_secondaryXAxis$label2;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[{width:(item.labelWidth||props.labelWidth||item.barWidth||barWidth)+spacing,left:spacing/-2,position:'absolute',height:(_props$xAxisLabelsHei2=props.xAxisLabelsHeight)!=null?_props$xAxisLabelsHei2:xAxisTextNumberOfLines*18,bottom:top?(containerHeight||200)+((_secondaryXAxis$label2=secondaryXAxis==null?void 0:secondaryXAxis.labelsDistanceFromXaxis)!=null?_secondaryXAxis$label2:15):(rotateLabel?-40:-6-xAxisTextNumberOfLines*18-xAxisLabelsVerticalShift)-barMarginBottom,opacity:appearingOpacity},value<0&&{transform:[{rotate:'180deg'}]},rotateLabel?horizontal?{transform:[{rotate:'330deg'}]}:{transform:[{rotate:'60deg'}]}:horizontal?{transform:[{rotate:'-90deg'}]}:value<0?{transform:[{rotate:'180deg'},{translateY:autoShiftLabels?0:16.5*xAxisTextNumberOfLines+14}]}:{}],children:top?item.secondaryLabelComponent?item.secondaryLabelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label}):item.labelComponent?item.labelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label})});};var leftSpacing=initialSpacing;for(var i=0;i<index;i++){var _data$i$spacing;leftSpacing+=((_data$i$spacing=data[i].spacing)!=null?_data$i$spacing:propSpacing)+(data[i].barWidth||barWidth);}var static2DWithGradient=function static2DWithGradient(item){var _focusedBarConfig$gra;var localGradientColor=item.gradientColor||props.gradientColor||'white';return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_LinearGradient.default,{style:commonStyleForBar,start:{x:0,y:0},end:{x:0,y:1},colors:[isFocused?(_focusedBarConfig$gra=focusedBarConfig==null?void 0:focusedBarConfig.gradientColor)!=null?_focusedBarConfig$gra:localGradientColor:localGradientColor,localFrontColor],children:props.cappedBars&&item.value?(0,_jsxRuntime.jsx)(_cap.default,{capThicknessFromItem:item.capThickness,capThicknessFromProps:props.capThickness,capColorFromItem:item.capColor,capColorFromProps:props.capColor,capRadiusFromItem:item.capRadius,capRadiusFromProps:props.capRadius}):null}),(item.barBackgroundPattern||props.barBackgroundPattern)&&(0,_jsxRuntime.jsx)(_barBackgroundPattern.default,{barBackgroundPatternFromItem:item.barBackgroundPattern,barBackgroundPatternFromProps:props.barBackgroundPattern,patternIdFromItem:item.patternId,patternIdFromProps:props.patternId}),(item.topLabelComponent||showValuesAsTopLabel)&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{position:'absolute',top:(item.barWidth||barWidth)*-1,height:item.barWidth||barWidth,width:item.barWidth||barWidth,justifyContent:horizontal&&!intactTopLabel||item.value<0?'center':'flex-end',alignItems:'center'},item.value<0&&{transform:[{rotate:'180deg'}]},horizontal&&!intactTopLabel&&{transform:[{rotate:'270deg'}]},topLabelContainerStyle!=null?topLabelContainerStyle:item.topLabelContainerStyle],children:showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:topLabelTextStyle,children:item.value+yAxisOffset}):item.topLabelComponent==null?void 0:item.topLabelComponent()}),localBarInnerComponent?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:'100%',width:'100%'},children:localBarInnerComponent(item,index)}):null]});};var barWrapperStyle=[{marginBottom:60+barMarginBottom+xAxisLabelsVerticalShift-0.5,width:commonPropsFor2Dand3Dbars.barWidth,height:barHeight,marginRight:spacing},pointerConfig?{transform:[{translateY:(containerHeight||200)-(barHeight-10+xAxisLabelsVerticalShift)+(item.value<0?Math.abs(item.value)*heightFactor:0)}]}:item.value<0?{transform:[{translateY:Math.abs(item.value)*heightFactor},{rotateZ:'180deg'}]}:null,side!=='right'&&{zIndex:data.length-index}];var pressDisabled=item.disablePress||props.disablePress||pointerConfig&&pointerConfig.barTouchable!==true;var barContent=function barContent(){var isBarBelowXaxisAndInvisible=item.value<0&&!noOfSectionsBelowXAxis;var animated2DWithGradient=function animated2DWithGradient(noGradient,noAnimation){return(0,_jsxRuntime.jsx)(_Animated2DWithGradient.default,Object.assign({},commonPropsFor2Dand3Dbars,{animationDuration:animationDuration||800,roundedBottom:props.roundedBottom||false,roundedTop:props.roundedTop||false,noGradient:noGradient,noAnimation:noAnimation,containerHeight:containerHeight,maxValue:maxValue,minHeight:minHeight!=null?minHeight:0,barMarginBottom:barMarginBottom,cappedBars:props.cappedBars,capThickness:props.capThickness,capColor:props.capColor,capRadius:props.capRadius,horizontal:horizontal,barBorderWidth:barBorderWidth,barBorderColor:barBorderColor,commonStyleForBar:commonStyleForBar,barStyleWithBackground:barStyleWithBackground}));};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(props.showXAxisIndices||item.showXAxisIndex)&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{zIndex:2,position:'absolute',height:props.xAxisIndicesHeight,width:props.xAxisIndicesWidth,bottom:props.xAxisIndicesHeight/-2,left:((item.barWidth||barWidth)-props.xAxisIndicesWidth)/2,backgroundColor:props.xAxisIndicesColor}}),isBarBelowXaxisAndInvisible?null:isThreeD?(0,_jsxRuntime.jsx)(_AnimatedThreeDBar.default,Object.assign({},commonPropsFor2Dand3Dbars,{sideWidth:item.sideWidth||props.sideWidth||(item.barWidth||barWidth)/2,side:side||'left',sideColor:item.sideColor||props.sideColor||'',topColor:item.topColor||props.topColor||'',horizontal:horizontal,isAnimated:isAnimated,animationDuration:animationDuration||800,selectedIndex:selectedIndex})):item.showGradient||props.showGradient?isAnimated?animated2DWithGradient(false,false):static2DWithGradient(item):isAnimated?animated2DWithGradient(true,false):animated2DWithGradient(true,true),isAnimated?renderAnimatedLabel(false,label,labelTextStyle,item.value):renderLabel(false,label,labelTextStyle,item.value),secondaryXAxis?isAnimated?renderAnimatedLabel(true,secondaryLabel,secondaryLabelTextStyle,item.value):renderLabel(true,secondaryLabel,secondaryLabelTextStyle,item.value):null]});};var tooltipProps={barHeight:barHeight,barWidth:item.barWidth||barWidth,item:item,index:index,isLast:index===data.length-1,leftSpacing:leftSpacing,leftShiftForLastIndexTooltip:leftShiftForLastIndexTooltip,leftShiftForTooltip:(_ref=(_item$leftShiftForToo=item.leftShiftForTooltip)!=null?_item$leftShiftForToo:leftShiftForTooltip)!=null?_ref:0,renderTooltip:renderTooltip,autoCenterTooltip:autoCenterTooltip,horizontal:horizontal};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[pressDisabled?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:barWrapperStyle,children:barContent()}):(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{activeOpacity:props.activeOpacity||0.2,onPress:function onPress(){if(renderTooltip||props.focusBarOnPress){if(props.focusedBarIndex===undefined||!props.onPress){setSelectedIndex(index);}}item.onPress?item.onPress():props.onPress?props.onPress(item,index):null;},onLongPress:function onLongPress(){item.onLongPress?item.onLongPress():props.onLongPress?props.onLongPress(item,index):null;},onPressOut:function onPressOut(){item.onPressOut?item.onPressOut():props.onPressOut?props.onPressOut(item,index):null;},style:barWrapperStyle,children:barContent()}),renderTooltip&&selectedIndex===index&&(0,_jsxRuntime.jsx)(_tooltip.default,Object.assign({},tooltipProps))]});};var _default=exports.default=RenderBars;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _LinearGradient=_interopRequireDefault(require("../Components/common/LinearGradient"));var _giftedChartsCore=require("gifted-charts-core");var _tooltip=_interopRequireDefault(require("../Components/BarSpecificComponents/tooltip"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/BarChart/RenderStackBars.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;}if(_reactNative.Platform.OS==='android'){_reactNative.UIManager.setLayoutAnimationEnabledExperimental&&_reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);}var RenderStackBars=function RenderStackBars(props){var _props$pointerConfig$;var barBackgroundPattern=props.barBackgroundPattern,patternId=props.patternId,item=props.item,index=props.index,containerHeight=props.containerHeight,spacing=props.spacing,rotateLabel=props.rotateLabel,label=props.label,labelTextStyle=props.labelTextStyle,xAxisTextNumberOfLines=props.xAxisTextNumberOfLines,xAxisLabelsVerticalShift=props.xAxisLabelsVerticalShift,renderTooltip=props.renderTooltip,selectedIndex=props.selectedIndex,setSelectedIndex=props.setSelectedIndex,activeOpacity=props.activeOpacity,_props$animationDurat=props.animationDuration,animationDuration=_props$animationDurat===void 0?_giftedChartsCore.BarDefaults.animationDuration:_props$animationDurat,barBorderWidth=props.barBorderWidth,barBorderColor=props.barBorderColor,stackBorderRadius=props.stackBorderRadius,stackBorderTopLeftRadius=props.stackBorderTopLeftRadius,stackBorderTopRightRadius=props.stackBorderTopRightRadius,stackBorderBottomLeftRadius=props.stackBorderBottomLeftRadius,stackBorderBottomRightRadius=props.stackBorderBottomRightRadius,showValuesAsTopLabel=props.showValuesAsTopLabel,_props$autoShiftLabel=props.autoShiftLabelsForNegativeStacks,autoShiftLabelsForNegativeStacks=_props$autoShiftLabel===void 0?true:_props$autoShiftLabel,_props$labelsDistance=props.labelsDistanceFromXaxis,labelsDistanceFromXaxis=_props$labelsDistance===void 0?0:_props$labelsDistance,horizontal=props.horizontal;var _useRenderStackBars=(0,_giftedChartsCore.useRenderStackBars)(props),cotainsNegative=_useRenderStackBars.cotainsNegative,noAnimation=_useRenderStackBars.noAnimation,localBarInnerComponent=_useRenderStackBars.localBarInnerComponent,borderRadius=_useRenderStackBars.borderRadius,borderTopLeftRadius=_useRenderStackBars.borderTopLeftRadius,borderTopRightRadius=_useRenderStackBars.borderTopRightRadius,borderBottomLeftRadius=_useRenderStackBars.borderBottomLeftRadius,borderBottomRightRadius=_useRenderStackBars.borderBottomRightRadius,disablePress=_useRenderStackBars.disablePress,totalHeight=_useRenderStackBars.totalHeight,height=_useRenderStackBars.height,setHeight=_useRenderStackBars.setHeight,getBarHeight=_useRenderStackBars.getBarHeight,getPosition=_useRenderStackBars.getPosition,lowestBarPosition=_useRenderStackBars.lowestBarPosition,getStackBorderRadii=_useRenderStackBars.getStackBorderRadii,tooltipProps=_useRenderStackBars.tooltipProps;var renderLabel=function renderLabel(label,labelTextStyle){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{width:(item.stacks[0].barWidth||props.barWidth||30)+spacing/2,position:'absolute',bottom:autoShiftLabelsForNegativeStacks?-6-xAxisTextNumberOfLines*18+lowestBarPosition:-labelsDistanceFromXaxis},rotateLabel?horizontal?{transform:[{rotate:'330deg'}]}:{transform:[{rotate:'60deg'}]}:horizontal?{transform:[{rotate:'-90deg'}]}:{}],children:item.labelComponent?item.labelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label||''})});};(0,_react.useEffect)(function(){if(!noAnimation){layoutAppear();}},[totalHeight]);var elevate=function elevate(){_reactNative.LayoutAnimation.configureNext({duration:animationDuration,update:{type:'linear',property:'scaleXY'}});setHeight(totalHeight);};var layoutAppear=function layoutAppear(){_reactNative.LayoutAnimation.configureNext({duration:_reactNative.Platform.OS=='ios'?animationDuration:20,create:{type:'linear',property:'opacity'},update:{type:'linear',property:'scaleXY'}});setTimeout(function(){return elevate();},_reactNative.Platform.OS=='ios'?10:100);};var static2DSimple=function static2DSimple(){var _ref,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7,_ref8;return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{disabled:disablePress,activeOpacity:activeOpacity,onPress:function onPress(){setSelectedIndex(index);if(item.onPress){item.onPress();}else if(props.onPress){props.onPress(item,index);}},onLongPress:function onLongPress(){if(item.onLongPress){item.onLongPress();}else if(props.onLongPress){props.onLongPress(item,index);}},onPressOut:function onPressOut(){if(item.onPressOut){item.onPressOut();}else if(props.onPressOut){props.onPressOut(item,index);}},style:[{position:'absolute',width:item.stacks[0].barWidth||props.barWidth||30,height:'100%',borderTopLeftRadius:(_ref=(_ref2=borderTopLeftRadius!=null?borderTopLeftRadius:borderRadius)!=null?_ref2:stackBorderTopLeftRadius)!=null?_ref:stackBorderRadius,borderTopRightRadius:(_ref3=(_ref4=borderTopRightRadius!=null?borderTopRightRadius:borderRadius)!=null?_ref4:stackBorderTopRightRadius)!=null?_ref3:stackBorderRadius,borderBottomLeftRadius:(_ref5=(_ref6=borderBottomLeftRadius!=null?borderBottomLeftRadius:borderRadius)!=null?_ref6:stackBorderBottomLeftRadius)!=null?_ref5:stackBorderRadius,borderBottomRightRadius:(_ref7=(_ref8=borderBottomRightRadius!=null?borderBottomRightRadius:borderRadius)!=null?_ref8:stackBorderBottomRightRadius)!=null?_ref7:stackBorderRadius,overflow:lowestBarPosition?'visible':'hidden'}],children:[item.stacks.map(function(stackItem,index){var borderRadii=getStackBorderRadii(item,index);var barHeight=getBarHeight(stackItem.value,stackItem.marginBottom);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:stackItem.onPress,activeOpacity:activeOpacity,disabled:disablePress||!stackItem.onPress,style:Object.assign({position:'absolute',bottom:getPosition(index)+(stackItem.marginBottom||0),width:'100%',height:barHeight,backgroundColor:stackItem.color||item.color||props.color||'black',borderWidth:barBorderWidth!=null?barBorderWidth:0,borderColor:barBorderColor},borderRadii),children:[stackItem.showGradient||item.showGradient||props.showGradient?(0,_jsxRuntime.jsx)(_LinearGradient.default,{style:Object.assign({position:'absolute',width:'100%',height:'100%'},borderRadii),start:{x:0,y:0},end:{x:0,y:1},colors:[stackItem.gradientColor||item.gradientColor||props.gradientColor||'white',stackItem.color||item.color||props.color||'black']}):null,stackItem.innerBarComponent&&stackItem.innerBarComponent()]},index);}),(item.barBackgroundPattern||barBackgroundPattern)&&(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Defs,{children:item.barBackgroundPattern?item.barBackgroundPattern():barBackgroundPattern==null?void 0:barBackgroundPattern()}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{stroke:"transparent",x:"1",y:"1",width:"100%",height:"100%",fill:`url(#${item.patternId||patternId})`})]})]}),localBarInnerComponent?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:'100%',width:'100%'},children:localBarInnerComponent(item,index)}):null,(item.topLabelComponent||showValuesAsTopLabel)&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{position:'absolute',top:cotainsNegative?0:(item.barWidth||props.barWidth||30)*-1,height:item.barWidth||props.barWidth||30,width:item.barWidth||props.barWidth||30,justifyContent:'center',alignItems:'center'},cotainsNegative&&{transform:[{translateY:totalHeight*2}]},horizontal&&!props.intactTopLabel&&{transform:[{rotate:'270deg'}]},item.topLabelContainerStyle],children:showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:item.topLabelTextStyle,children:item.stacks.reduce(function(acc,stack){return acc+stack.value;},0)}):item.topLabelComponent==null?void 0:item.topLabelComponent()})]});};var barWrapper=function barWrapper(){return noAnimation?static2DSimple():(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',bottom:0,height:height,width:'100%',overflow:'hidden'},children:static2DSimple()});};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:props.pointerConfig?(_props$pointerConfig$=props.pointerConfig.pointerEvents)!=null?_props$pointerConfig$:'none':'auto',style:[{marginBottom:60+xAxisLabelsVerticalShift,width:item.stacks[0].barWidth||props.barWidth||30,height:totalHeight,marginRight:spacing},props.pointerConfig?{transform:[{translateY:(containerHeight||200)-(totalHeight-10+xAxisLabelsVerticalShift)}]}:null],children:[(props.showXAxisIndices||item.showXAxisIndex)&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{zIndex:2,position:'absolute',height:props.xAxisIndicesHeight,width:props.xAxisIndicesWidth,bottom:props.xAxisIndicesHeight/-2,left:((item.barWidth||props.barWidth||30)-props.xAxisIndicesWidth)/2,backgroundColor:props.xAxisIndicesColor}}),barWrapper(),renderLabel(label||'',labelTextStyle)]}),renderTooltip&&selectedIndex===index&&(0,_jsxRuntime.jsx)(_tooltip.default,Object.assign({},tooltipProps))]});};var _default=exports.default=RenderStackBars;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.BarChart=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _RenderBars=_interopRequireDefault(require("./RenderBars"));var _RenderStackBars=_interopRequireDefault(require("./RenderStackBars"));var _BarAndLineChartsWrapper=_interopRequireDefault(require("../Components/BarAndLineChartsWrapper"));var _giftedChartsCore=require("gifted-charts-core");var _StripAndLabel=require("../Components/common/StripAndLabel");var _Pointer=require("../Components/common/Pointer");var _utils=require("../utils");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/BarChart/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 BarChart=exports.BarChart=function BarChart(props){var _props$scrollRef,_props$parentWidth;var heightValue=(0,_react.useMemo)(function(){return new _reactNative.Animated.Value(0);},[]);var opacValue=(0,_react.useMemo)(function(){return new _reactNative.Animated.Value(0);},[]);var widthValue=(0,_react.useMemo)(function(){return new _reactNative.Animated.Value(0);},[]);var scrollRef=(_props$scrollRef=props.scrollRef)!=null?_props$scrollRef:(0,_react.useRef)(null);var remainingScrollViewProps={onScroll:function onScroll(ev){return props.onScroll==null?void 0:props.onScroll(ev);},onTouchStart:function onTouchStart(evt){if(props.renderTooltip){setSelectedIndex(-1);}}};var _useBarChart=(0,_giftedChartsCore.useBarChart)(Object.assign({},props,{heightValue:heightValue,widthValue:widthValue,opacValue:opacValue,parentWidth:(_props$parentWidth=props.parentWidth)!=null?_props$parentWidth:_utils.screenWidth})),lineConfig=_useBarChart.lineConfig,hidePointer1=_useBarChart.hidePointer1,pointerItem=_useBarChart.pointerItem,pointerY=_useBarChart.pointerY,pointerConfig=_useBarChart.pointerConfig,pointerColor=_useBarChart.pointerColor,pointerX=_useBarChart.pointerX,pointerComponent=_useBarChart.pointerComponent,pointerHeight=_useBarChart.pointerHeight,pointerRadius=_useBarChart.pointerRadius,pointerWidth=_useBarChart.pointerWidth,autoAdjustPointerLabelPosition=_useBarChart.autoAdjustPointerLabelPosition,pointerLabelWidth=_useBarChart.pointerLabelWidth,activatePointersOnLongPress=_useBarChart.activatePointersOnLongPress,yAxisLabelWidth=_useBarChart.yAxisLabelWidth,shiftPointerLabelX=_useBarChart.shiftPointerLabelX,pointerLabelHeight=_useBarChart.pointerLabelHeight,pointerStripUptoDataPoint=_useBarChart.pointerStripUptoDataPoint,pointerStripHeight=_useBarChart.pointerStripHeight,shiftPointerLabelY=_useBarChart.shiftPointerLabelY,showPointerStrip=_useBarChart.showPointerStrip,pointerStripWidth=_useBarChart.pointerStripWidth,containerHeight=_useBarChart.containerHeight,xAxisThickness=_useBarChart.xAxisThickness,pointerStripColor=_useBarChart.pointerStripColor,pointerEvents=_useBarChart.pointerEvents,setResponderStartTime=_useBarChart.setResponderStartTime,setPointerY=_useBarChart.setPointerY,setPointerItem=_useBarChart.setPointerItem,initialSpacing=_useBarChart.initialSpacing,spacing=_useBarChart.spacing,data=_useBarChart.data,barWidth=_useBarChart.barWidth,setPointerX=_useBarChart.setPointerX,setPointerIndex=_useBarChart.setPointerIndex,maxValue=_useBarChart.maxValue,responderStartTime=_useBarChart.responderStartTime,setResponderActive=_useBarChart.setResponderActive,activatePointersDelay=_useBarChart.activatePointersDelay,persistPointer=_useBarChart.persistPointer,pointerVanishDelay=_useBarChart.pointerVanishDelay,containerHeightIncludingBelowXAxis=_useBarChart.containerHeightIncludingBelowXAxis,extendedContainerHeight=_useBarChart.extendedContainerHeight,totalWidth=_useBarChart.totalWidth,stripBehindBars=_useBarChart.stripBehindBars,noOfSectionsBelowXAxis=_useBarChart.noOfSectionsBelowXAxis,stepHeight=_useBarChart.stepHeight,xAxisLabelsVerticalShift=_useBarChart.xAxisLabelsVerticalShift,labelsExtraHeight=_useBarChart.labelsExtraHeight,stripOverPointer=_useBarChart.stripOverPointer,pointerLabelComponent=_useBarChart.pointerLabelComponent,setSelectedIndex=_useBarChart.setSelectedIndex,isAnimated=_useBarChart.isAnimated,animationDuration=_useBarChart.animationDuration,side=_useBarChart.side,labelWidth=_useBarChart.labelWidth,isThreeD=_useBarChart.isThreeD,animatedHeight=_useBarChart.animatedHeight,appearingOpacity=_useBarChart.appearingOpacity,autoShiftLabels=_useBarChart.autoShiftLabels,getPropsCommonForBarAndStack=_useBarChart.getPropsCommonForBarAndStack,barAndLineChartsWrapperProps=_useBarChart.barAndLineChartsWrapperProps,autoShiftLabelsForNegativeStacks=_useBarChart.autoShiftLabelsForNegativeStacks;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 decreaseWidth=(0,_react.useCallback)(function(){widthValue.setValue(0);_reactNative.Animated.timing(widthValue,{toValue:1,duration:lineConfig.animationDuration,easing:_reactNative.Easing.linear,useNativeDriver:false}).start();},[lineConfig.animationDuration,widthValue]);(0,_react.useEffect)(function(){if(lineConfig.isAnimated){setTimeout(function(){return decreaseWidth();},lineConfig.delay||0);}setTimeout(function(){return labelsAppear();},animationDuration);},[decreaseWidth,labelsAppear,animationDuration]);var renderPointer=function renderPointer(lineNumber){if(lineNumber===1&&hidePointer1)return;var pointerItemLocal=pointerItem;var pointerYLocal=pointerY;var pointerColorLocal=(pointerConfig==null?void 0:pointerConfig.pointer1Color)||pointerColor;return(0,_Pointer.Pointer)({pointerX:pointerX,pointerYLocal:pointerYLocal,pointerComponent:pointerComponent,pointerHeight:pointerHeight,pointerRadius:pointerRadius,pointerWidth:pointerWidth,pointerItemLocal:pointerItemLocal,pointerColorLocal:pointerColorLocal});};var renderStripAndLabel=function renderStripAndLabel(pointerLabelComponent){var pointerItemLocal,pointerYLocal=pointerY;pointerItemLocal=[pointerItem];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,scrollX:0,pointerEvents:pointerEvents,isBarChart:true});};var renderChartContent=function renderChartContent(){if(pointerConfig){return(0,_jsxRuntime.jsxs)(_reactNative.View,{onStartShouldSetResponder:function onStartShouldSetResponder(evt){return pointerConfig?true:false;},onMoveShouldSetResponder:function onMoveShouldSetResponder(evt){return pointerConfig?true:false;},onResponderGrant:function onResponderGrant(evt){var _props$stackData,_stackSum;if(!pointerConfig)return;setResponderStartTime(evt.timeStamp);if(activatePointersOnLongPress){return;}var x=evt.nativeEvent.locationX;if(!activatePointersOnLongPress&&x>(props.width||_utils.screenWidth))return;var factor=(x-initialSpacing-barWidth/2)/(spacing+barWidth);factor=Math.round(factor);factor=Math.min(factor,data.length-1);factor=Math.max(factor,0);var z=initialSpacing+(spacing+barWidth)*factor-(pointerRadius||pointerWidth/2)+barWidth/2;setPointerX(z);setPointerIndex(factor);var item,y;item=((_props$stackData=props.stackData)!=null?_props$stackData:data)[factor];var stackSum=0;if('stacks'in item){stackSum=item.stacks.reduce(function(acc,stack){var _stack$value;return acc+((_stack$value=stack.value)!=null?_stack$value:0);},0);}y=containerHeight-((_stackSum=stackSum)!=null?_stackSum:item.value)*containerHeight/maxValue-(pointerRadius||pointerHeight/2)+10;setPointerY(y);setPointerItem(item);},onResponderMove:function onResponderMove(evt){var _props$stackData2,_props$stackData3;if(!pointerConfig)return;if(activatePointersOnLongPress&&evt.timeStamp-responderStartTime<activatePointersDelay){return;}else{setResponderActive(true);}var x=evt.nativeEvent.locationX;if(!activatePointersOnLongPress&&x>(props.width||_utils.screenWidth))return;var factor=(x-initialSpacing-barWidth/2)/(spacing+barWidth);factor=Math.round(factor);factor=Math.min(factor,((_props$stackData2=props.stackData)!=null?_props$stackData2:data).length-1);factor=Math.max(factor,0);var z=initialSpacing+(spacing+barWidth)*factor-(pointerRadius||pointerWidth/2)+barWidth/2;var item,y;setPointerX(z);setPointerIndex(factor);item=((_props$stackData3=props.stackData)!=null?_props$stackData3:data)[factor];var stackSum=0;if('stacks'in item){var _item$stacks;(_item$stacks=item.stacks)==null?void 0:_item$stacks.reduce(function(acc,stack){var _stack$value2;return acc+((_stack$value2=stack.value)!=null?_stack$value2:0);},0);}y=containerHeight-(stackSum!=null?stackSum:item.value)*containerHeight/maxValue-(pointerRadius||pointerHeight/2)+10;setPointerY(y);setPointerItem(item);},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,bottom:60,paddingLeft:initialSpacing,width:totalWidth,flexDirection:'row'},children:[pointerX>0&&stripBehindBars?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:pointerEvents!=null?pointerEvents:'none',style:{position:'absolute',height:extendedContainerHeight+noOfSectionsBelowXAxis*stepHeight,bottom:xAxisLabelsVerticalShift+labelsExtraHeight,width:totalWidth},children:renderStripAndLabel(null)}):null,renderChart(),pointerX>0?(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:pointerEvents!=null?pointerEvents:'none',style:{position:'absolute',height:extendedContainerHeight+noOfSectionsBelowXAxis*stepHeight,bottom:xAxisLabelsVerticalShift+labelsExtraHeight,width:totalWidth,zIndex:20},children:[!stripOverPointer&&!stripBehindBars&&renderStripAndLabel(null),renderPointer(1),stripOverPointer&&!stripBehindBars&&renderStripAndLabel(null),pointerLabelComponent&&renderStripAndLabel(pointerLabelComponent)]}):null]});}else{return renderChart();}};var renderChart=function renderChart(){if(props.stackData){return props.stackData.map(function(item,index){return(0,_jsxRuntime.jsx)(_RenderStackBars.default,Object.assign({stackData:props.stackData||[],isAnimated:isAnimated,animationDuration:animationDuration,stackBorderRadius:props.stackBorderRadius,stackBorderTopLeftRadius:props.stackBorderTopLeftRadius,stackBorderTopRightRadius:props.stackBorderTopRightRadius,stackBorderBottomLeftRadius:props.stackBorderBottomLeftRadius,stackBorderBottomRightRadius:props.stackBorderBottomRightRadius,autoShiftLabelsForNegativeStacks:autoShiftLabelsForNegativeStacks},getPropsCommonForBarAndStack(item,index)),index);});}else{return data.map(function(item,index){var _props$minHeight;return(0,_jsxRuntime.jsx)(_RenderBars.default,Object.assign({data:data,side:side,minHeight:(_props$minHeight=props.minHeight)!=null?_props$minHeight:isAnimated&&!isThreeD?0.1:0,sideWidth:props.sideWidth,labelWidth:labelWidth,isThreeD:isThreeD,isAnimated:isAnimated,animationDuration:animationDuration,animatedHeight:animatedHeight,appearingOpacity:appearingOpacity,roundedTop:props.roundedTop,roundedBottom:props.roundedBottom,frontColor:props.frontColor,sideColor:props.sideColor,topColor:props.topColor,cappedBars:props.cappedBars,capThickness:props.capThickness,capColor:props.capColor,capRadius:props.capRadius,autoShiftLabels:autoShiftLabels,barMarginBottom:props.barMarginBottom,barStyle:props.barStyle},getPropsCommonForBarAndStack(item,index)),index);});}};return(0,_jsxRuntime.jsx)(_BarAndLineChartsWrapper.default,Object.assign({},barAndLineChartsWrapperProps,{scrollRef:scrollRef,renderChartContent:renderChartContent,remainingScrollViewProps:remainingScrollViewProps,nestedScrollEnabled:props.nestedScrollEnabled}));};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var styles=exports.styles=_reactNative.StyleSheet.create({container:{width:'100%',marginBottom:40,marginRight:40},horizBar:{flexDirection:'row'},leftLabel:{justifyContent:'center',alignItems:'center'},lastLeftLabel:{justifyContent:'center',alignItems:'center'},leftPart:{justifyContent:'center',width:'100%'},lastLeftPart:{justifyContent:'flex-end',width:'100%'},line:{width:'100%',height:1,backgroundColor:'gray',opacity:0.5},lastLine:{width:'100%',height:1,backgroundColor:'black'},bottomLabel:{width:'100%'},customDataPointContainer:{position:'absolute',justifyContent:'center',alignItems:'center'}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _styles=require("./styles");var _LinearGradient=_interopRequireDefault(require("../common/LinearGradient"));var _giftedChartsCore=require("gifted-charts-core");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/AnimatedThreeDBar/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;}if(_reactNative.Platform.OS==='android'){_reactNative.UIManager.setLayoutAnimationEnabledExperimental&&_reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);}var TriangleCorner=function TriangleCorner(props){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[triangleStyles.triangleCorner,props.style,{borderRightWidth:props.width/2,borderTopWidth:props.width/2,borderTopColor:props.color}]});};var triangleStyles=_reactNative.StyleSheet.create({triangleCorner:{width:0,height:0,backgroundColor:'transparent',borderStyle:'solid',borderRightColor:'transparent',transform:[{rotate:'90deg'}]}});var AnimatedThreeDBar=function AnimatedThreeDBar(props){var heightCopy=props.height;var _useState=(0,_react.useState)(props.isAnimated?_reactNative.Platform.OS==='ios'?0:20:heightCopy),_useState2=(0,_slicedToArray2.default)(_useState,2),height=_useState2[0],setHeight=_useState2[1];var isAnimated=props.isAnimated,animationDuration=props.animationDuration,item=props.item,index=props.index,barWidth=props.barWidth,sideWidth=props.sideWidth,barStyle=props.barStyle,barBackgroundPattern=props.barBackgroundPattern,barInnerComponent=props.barInnerComponent,patternId=props.patternId,intactTopLabel=props.intactTopLabel,showValuesAsTopLabel=props.showValuesAsTopLabel,topLabelContainerStyle=props.topLabelContainerStyle,topLabelTextStyle=props.topLabelTextStyle;var _useAnimatedThreeDBar=(0,_giftedChartsCore.useAnimatedThreeDBar)(props),showGradient=_useAnimatedThreeDBar.showGradient,gradientColor=_useAnimatedThreeDBar.gradientColor,frontColor=_useAnimatedThreeDBar.frontColor,sideColor=_useAnimatedThreeDBar.sideColor,topColor=_useAnimatedThreeDBar.topColor,opacity=_useAnimatedThreeDBar.opacity,initialRender=_useAnimatedThreeDBar.initialRender,setInitialRender=_useAnimatedThreeDBar.setInitialRender;(0,_react.useEffect)(function(){if(isAnimated){if(initialRender){setTimeout(function(){layoutAppear();},20);}else{elevate();}}},[props.height]);var elevate=function elevate(){_reactNative.LayoutAnimation.configureNext({duration:animationDuration,update:{type:'linear',property:'scaleY'}});setHeight(props.height);};var layoutAppear=function layoutAppear(){_reactNative.LayoutAnimation.configureNext({duration:_reactNative.Platform.OS=='ios'?animationDuration:20,create:{type:'linear',property:'scaleY'}});setInitialRender(false);setTimeout(function(){return elevate();},_reactNative.Platform.OS=='ios'?10:100);};return(0,_jsxRuntime.jsx)(_reactNative.View,{style:_styles.styles.container,children:!initialRender&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_styles.styles.row,{opacity:opacity,position:'absolute',bottom:0},props.side==='right'&&{transform:[{rotateY:'180deg'}]}],children:[props.height?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',top:sideWidth/-2},children:(0,_jsxRuntime.jsx)(TriangleCorner,{color:topColor,width:sideWidth,style:{transform:[{rotate:'90deg'}],opacity:opacity}})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',top:sideWidth/-2},children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:barWidth,height:barWidth,backgroundColor:topColor,opacity:opacity}})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',top:sideWidth/-2,left:barWidth-1},children:(0,_jsxRuntime.jsx)(TriangleCorner,{color:topColor,width:sideWidth,style:{transform:[{rotate:'-90deg'}],opacity:opacity}})})]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{marginTop:sideWidth/-2-1},children:[(0,_jsxRuntime.jsx)(TriangleCorner,{color:height?sideColor:'transparent',width:sideWidth,style:{transform:[{rotate:'-90deg'}],opacity:opacity}}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:sideWidth/2+1,height:height-sideWidth/2,backgroundColor:sideColor,opacity:opacity}}),(0,_jsxRuntime.jsx)(TriangleCorner,{color:height?sideColor:'transparent',width:sideWidth+1,style:{transform:[{rotate:'90deg'}],opacity:opacity}})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{width:barWidth,height:height,backgroundColor:frontColor,borderLeftWidth:_reactNative.StyleSheet.hairlineWidth,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:'white',opacity:opacity},item.barStyle||barStyle],children:[showGradient&&(0,_jsxRuntime.jsx)(_LinearGradient.default,{style:{position:'absolute',width:'100%',height:'100%'},start:{x:0,y:0},end:{x:1,y:1},colors:[gradientColor,frontColor]}),barBackgroundPattern&&(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Defs,{children:barBackgroundPattern()}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{stroke:"transparent",x:"1",y:"1",width:barWidth||30,height:height,fill:`url(#${patternId})`})]}),barInnerComponent?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:'100%',width:'100%'},children:barInnerComponent(item,index)}):null]}),(item.topLabelComponent||showValuesAsTopLabel)&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{position:'absolute',top:barWidth*-2,height:barWidth*3/2,width:barWidth*3/2,justifyContent:'flex-end',alignItems:'center',opacity:opacity},props.horizontal&&!intactTopLabel&&{transform:[{rotate:'270deg'}]},props.side==='right'&&{transform:[{rotateY:'180deg'}]},topLabelContainerStyle!=null?topLabelContainerStyle:item.topLabelContainerStyle],children:showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:topLabelTextStyle,children:item.value}):item.topLabelComponent==null?void 0:item.topLabelComponent()})]})});};var _default=exports.default=AnimatedThreeDBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var styles=exports.styles=_reactNative.StyleSheet.create({container:{flex:1,justifyContent:'center',alignItems:'center'},row:{flexDirection:'row'}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _renderHorizSections=require("./renderHorizSections");var _renderLineInBarChart=_interopRequireDefault(require("./renderLineInBarChart"));var _renderVerticalLines=_interopRequireDefault(require("./renderVerticalLines"));var _giftedChartsCore=require("gifted-charts-core");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/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 BarAndLineChartsWrapper=function BarAndLineChartsWrapper(props){var _ref2,_data$barWidth,_data,_props$width,_props$width2;var chartType=props.chartType,containerHeight=props.containerHeight,noOfSectionsBelowXAxis=props.noOfSectionsBelowXAxis,stepHeight=props.stepHeight,labelsExtraHeight=props.labelsExtraHeight,yAxisLabelWidth=props.yAxisLabelWidth,horizontal=props.horizontal,scrollRef=props.scrollRef,initialSpacing=props.initialSpacing,data=props.data,barWidth=props.barWidth,xAxisThickness=props.xAxisThickness,totalWidth=props.totalWidth,disableScroll=props.disableScroll,showScrollIndicator=props.showScrollIndicator,scrollToEnd=props.scrollToEnd,scrollToIndex=props.scrollToIndex,scrollAnimation=props.scrollAnimation,indicatorColor=props.indicatorColor,spacing=props.spacing,showLine=props.showLine,points2=props.points2,renderChartContent=props.renderChartContent,remainingScrollViewProps=props.remainingScrollViewProps,endSpacing=props.endSpacing,hideAxesAndRules=props.hideAxesAndRules,showXAxisIndices=props.showXAxisIndices,xAxisIndicesHeight=props.xAxisIndicesHeight,xAxisIndicesWidth=props.xAxisIndicesWidth,xAxisIndicesColor=props.xAxisIndicesColor,pointerConfig=props.pointerConfig,getPointerProps=props.getPointerProps,pointerIndex=props.pointerIndex,pointerX=props.pointerX,pointerY=props.pointerY,onEndReached=props.onEndReached,onStartReached=props.onStartReached,_onMomentumScrollEnd=props.onMomentumScrollEnd,nestedScrollEnabled=props.nestedScrollEnabled,_props$extraWidthDueT=props.extraWidthDueToDataPoint,extraWidthDueToDataPoint=_props$extraWidthDueT===void 0?0:_props$extraWidthDueT;var _useBarAndLineChartsW=(0,_giftedChartsCore.useBarAndLineChartsWrapper)(Object.assign({},props,{isRTL:_reactNative.I18nManager.isRTL})),containerHeightIncludingBelowXAxis=_useBarAndLineChartsW.containerHeightIncludingBelowXAxis,xAxisLabelsVerticalShift=_useBarAndLineChartsW.xAxisLabelsVerticalShift,trimYAxisAtTop=_useBarAndLineChartsW.trimYAxisAtTop,yAxisExtraHeight=_useBarAndLineChartsW.yAxisExtraHeight,overflowTop=_useBarAndLineChartsW.overflowTop,xAxisLabelsHeight=_useBarAndLineChartsW.xAxisLabelsHeight,xAxisTextNumberOfLines=_useBarAndLineChartsW.xAxisTextNumberOfLines,actualContainerWidth=_useBarAndLineChartsW.actualContainerWidth,transformForHorizontal=_useBarAndLineChartsW.transformForHorizontal,horizSectionProps=_useBarAndLineChartsW.horizSectionProps,referenceLinesOverChartContent=_useBarAndLineChartsW.referenceLinesOverChartContent,setCanMomentum=_useBarAndLineChartsW.setCanMomentum,isCloseToStart=_useBarAndLineChartsW.isCloseToStart,isCloseToEnd=_useBarAndLineChartsW.isCloseToEnd,canMomentum=_useBarAndLineChartsW.canMomentum,yAxisAtTop=_useBarAndLineChartsW.yAxisAtTop,yAxisThickness=_useBarAndLineChartsW.yAxisThickness,yAxisSide=_useBarAndLineChartsW.yAxisSide,showVerticalLines=_useBarAndLineChartsW.showVerticalLines,verticalLinesProps=_useBarAndLineChartsW.verticalLinesProps,lineInBarChartProps=_useBarAndLineChartsW.lineInBarChartProps,lineInBarChartProps2=_useBarAndLineChartsW.lineInBarChartProps2;(0,_react.useEffect)(function(){if(pointerConfig&&getPointerProps){getPointerProps({pointerIndex:pointerIndex,pointerX:pointerX,pointerY:pointerY});}},[pointerIndex,pointerX,pointerY]);var styles=_reactNative.StyleSheet.create({container:{width:'100%',height:containerHeightIncludingBelowXAxis+labelsExtraHeight+xAxisLabelsVerticalShift+(trimYAxisAtTop?0:yAxisExtraHeight)+50-overflowTop,marginTop:trimYAxisAtTop?containerHeight/20:0,marginBottom:(xAxisLabelsHeight!=null?xAxisLabelsHeight:xAxisTextNumberOfLines*18)-55}});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,horizontal&&{width:actualContainerWidth,transform:transformForHorizontal}],children:[hideAxesAndRules!==true?(0,_renderHorizSections.renderHorizSections)(Object.assign({},horizSectionProps,{onlyReferenceLines:false,renderReferenceLines:!referenceLinesOverChartContent})):null,(0,_jsxRuntime.jsx)(_reactNative.ScrollView,Object.assign({onScrollBeginDrag:function onScrollBeginDrag(){setCanMomentum(true);},nestedScrollEnabled:nestedScrollEnabled,onMomentumScrollEnd:function onMomentumScrollEnd(_ref){var nativeEvent=_ref.nativeEvent;if(_onMomentumScrollEnd){_onMomentumScrollEnd();}if(isCloseToEnd(nativeEvent)&&canMomentum){onEndReached?onEndReached():null;setCanMomentum(false);}if(isCloseToStart(nativeEvent)&&canMomentum){onStartReached?onStartReached():null;setCanMomentum(false);}},scrollEventThrottle:props.scrollEventThrottle?props.scrollEventThrottle:16,horizontal:true,ref:scrollRef,style:[{marginLeft:horizontal&&!yAxisAtTop?-yAxisThickness-(props.width?20:0)-((_ref2=(_data$barWidth=(_data=data[data.length-1])==null?void 0:_data.barWidth)!=null?_data$barWidth:barWidth)!=null?_ref2:0)/2:yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?0:yAxisLabelWidth+yAxisThickness,position:'absolute',bottom:chartType===_giftedChartsCore.chartTypes.LINE_BI_COLOR?0:xAxisThickness},!!props.width&&{width:props.width+extraWidthDueToDataPoint},horizontal&&{width:((_props$width=props.width)!=null?_props$width:totalWidth)+(props.width?endSpacing:-20)}],contentContainerStyle:[{height:containerHeightIncludingBelowXAxis+yAxisExtraHeight+labelsExtraHeight+(50+xAxisLabelsVerticalShift),width:Math.max((_props$width2=props.width)!=null?_props$width2:0,totalWidth-spacing+endSpacing)+extraWidthDueToDataPoint,paddingLeft:initialSpacing,paddingBottom:noOfSectionsBelowXAxis*stepHeight+labelsExtraHeight,alignItems:'flex-end'},!props.width&&{width:totalWidth}],scrollEnabled:!disableScroll,showsHorizontalScrollIndicator:showScrollIndicator,indicatorStyle:indicatorColor,onContentSizeChange:function onContentSizeChange(){if(scrollRef.current&&scrollToEnd){scrollRef.current.scrollToEnd({animated:scrollAnimation});}else if(scrollRef.current&&scrollToIndex){scrollRef.current.scrollTo({x:initialSpacing+((barWidth!=null?barWidth:0)+spacing)*scrollToIndex-spacing});}}},remainingScrollViewProps,{children:(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[showVerticalLines?(0,_jsxRuntime.jsx)(_renderVerticalLines.default,Object.assign({},verticalLinesProps)):null,showLine?(0,_jsxRuntime.jsx)(_renderLineInBarChart.default,Object.assign({},lineInBarChartProps)):null,showLine&&points2!=null&&points2.length?(0,_jsxRuntime.jsx)(_renderLineInBarChart.default,Object.assign({},lineInBarChartProps2)):null,chartType===_giftedChartsCore.chartTypes.LINE&&data.map(function(item,index){return showXAxisIndices||item.showXAxisIndex?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',height:xAxisIndicesHeight,width:xAxisIndicesWidth,backgroundColor:xAxisIndicesColor,bottom:60-xAxisIndicesHeight/2,left:index*spacing+(initialSpacing-xAxisIndicesWidth/2)-3}},index+''+item.value):null;}),renderChartContent()]})})),referenceLinesOverChartContent?(0,_renderHorizSections.renderHorizSections)(Object.assign({},horizSectionProps,{onlyReferenceLines:true})):null]});};var _default=exports.default=BarAndLineChartsWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.renderHorizSections=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _lineSvg=_interopRequireDefault(require("../lineSvg"));var _styles=require("../../LineChart/styles");var _giftedChartsCore=require("gifted-charts-core");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx";var renderHorizSections=exports.renderHorizSections=function renderHorizSections(props){var chartType=props.chartType,width=props.width,noOfSectionsBelowXAxis=props.noOfSectionsBelowXAxis,totalWidth=props.totalWidth,endSpacing=props.endSpacing,yAxisSide=props.yAxisSide,horizontalRulesStyle=props.horizontalRulesStyle,noOfSections=props.noOfSections,sectionColors=props.sectionColors,stepHeight=props.stepHeight,negativeStepHeight=props.negativeStepHeight,yAxisLabelWidth=props.yAxisLabelWidth,yAxisLabelContainerStyle=props.yAxisLabelContainerStyle,yAxisThickness=props.yAxisThickness,yAxisColor=props.yAxisColor,xAxisThickness=props.xAxisThickness,xAxisColor=props.xAxisColor,xAxisLength=props.xAxisLength,xAxisType=props.xAxisType,dashWidth=props.dashWidth,dashGap=props.dashGap,backgroundColor=props.backgroundColor,hideRules=props.hideRules,rulesLength=props.rulesLength,rulesType=props.rulesType,rulesThickness=props.rulesThickness,rulesColor=props.rulesColor,rulesConfigArray=props.rulesConfigArray,spacing=props.spacing,showYAxisIndices=props.showYAxisIndices,yAxisIndicesHeight=props.yAxisIndicesHeight,yAxisIndicesWidth=props.yAxisIndicesWidth,yAxisIndicesColor=props.yAxisIndicesColor,hideOrigin=props.hideOrigin,hideYAxisText=props.hideYAxisText,yAxisTextNumberOfLines=props.yAxisTextNumberOfLines,yAxisTextStyle=props.yAxisTextStyle,rotateYAxisTexts=props.rotateYAxisTexts,rtl=props.rtl,containerHeight=props.containerHeight,maxValue=props.maxValue,yAxisOffset=props.yAxisOffset,horizontal=props.horizontal,yAxisAtTop=props.yAxisAtTop,secondaryYAxis=props.secondaryYAxis,onlyReferenceLines=props.onlyReferenceLines,renderReferenceLines=props.renderReferenceLines,secondaryXAxis=props.secondaryXAxis;var _getHorizSectionVals=(0,_giftedChartsCore.getHorizSectionVals)(props),secondaryYAxisConfig=_getHorizSectionVals.secondaryYAxisConfig,horizSections=_getHorizSectionVals.horizSections,yAxisExtraHeightAtTop=_getHorizSectionVals.yAxisExtraHeightAtTop,secondaryHorizSections=_getHorizSectionVals.secondaryHorizSections,showReferenceLine1=_getHorizSectionVals.showReferenceLine1,referenceLine1Config=_getHorizSectionVals.referenceLine1Config,referenceLine1Position=_getHorizSectionVals.referenceLine1Position,showReferenceLine2=_getHorizSectionVals.showReferenceLine2,referenceLine2Config=_getHorizSectionVals.referenceLine2Config,referenceLine2Position=_getHorizSectionVals.referenceLine2Position,showReferenceLine3=_getHorizSectionVals.showReferenceLine3,referenceLine3Config=_getHorizSectionVals.referenceLine3Config,referenceLine3Position=_getHorizSectionVals.referenceLine3Position,horizSectionsBelow=_getHorizSectionVals.horizSectionsBelow,secondaryHorizSectionsBelow=_getHorizSectionVals.secondaryHorizSectionsBelow,getLabelTexts=_getHorizSectionVals.getLabelTexts,getLabelTextsForSecondaryYAxis=_getHorizSectionVals.getLabelTextsForSecondaryYAxis;var renderAxesAndRules=function renderAxesAndRules(index){var _sectionColors$invert,_rulesConfigArray$inv,_rulesConfigArray$inv2,_rulesConfigArray$inv3,_rulesConfigArray$inv4,_ref,_rulesConfigArray$inv5,_rulesConfigArray$inv6,_rulesConfigArray$inv7,_rulesConfigArray$inv8,_rulesConfigArray$inv9,_rulesConfigArray$inv10,_rulesConfigArray$inv11,_rulesConfigArray$inv12;var invertedIndex=horizSections.length-index-1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[index===noOfSections?_styles.styles.lastLeftPart:!index?{justifyContent:'flex-start'}:_styles.styles.leftPart,{borderColor:yAxisColor,backgroundColor:(_sectionColors$invert=sectionColors==null?void 0:sectionColors[invertedIndex])!=null?_sectionColors$invert:backgroundColor,width:(props.width||totalWidth-spacing)+endSpacing},!index?{height:stepHeight/2,marginTop:stepHeight/2}:null,yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?{borderRightWidth:yAxisThickness}:{borderLeftWidth:yAxisThickness}],children:[index===noOfSections?(0,_jsxRuntime.jsx)(_lineSvg.default,{config:{thickness:xAxisThickness,color:xAxisColor,width:xAxisLength||(props.width||totalWidth-spacing)+endSpacing,dashWidth:dashWidth,dashGap:dashGap,type:xAxisType}}):hideRules?null:(0,_jsxRuntime.jsx)(_lineSvg.default,{config:{thickness:(_rulesConfigArray$inv=(_rulesConfigArray$inv2=rulesConfigArray[invertedIndex])==null?void 0:_rulesConfigArray$inv2.rulesThickness)!=null?_rulesConfigArray$inv:rulesThickness,color:(_rulesConfigArray$inv3=(_rulesConfigArray$inv4=rulesConfigArray[invertedIndex])==null?void 0:_rulesConfigArray$inv4.rulesColor)!=null?_rulesConfigArray$inv3:rulesColor,width:(_ref=(_rulesConfigArray$inv5=(_rulesConfigArray$inv6=rulesConfigArray[invertedIndex])==null?void 0:_rulesConfigArray$inv6.rulesLength)!=null?_rulesConfigArray$inv5:rulesLength)!=null?_ref:(props.width||totalWidth-spacing)+endSpacing,dashWidth:(_rulesConfigArray$inv7=(_rulesConfigArray$inv8=rulesConfigArray[invertedIndex])==null?void 0:_rulesConfigArray$inv8.dashWidth)!=null?_rulesConfigArray$inv7:dashWidth,dashGap:(_rulesConfigArray$inv9=(_rulesConfigArray$inv10=rulesConfigArray[invertedIndex])==null?void 0:_rulesConfigArray$inv10.dashGap)!=null?_rulesConfigArray$inv9:dashGap,type:(_rulesConfigArray$inv11=(_rulesConfigArray$inv12=rulesConfigArray[invertedIndex])==null?void 0:_rulesConfigArray$inv12.rulesType)!=null?_rulesConfigArray$inv11:rulesType}}),showYAxisIndices&&index!==noOfSections?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',height:yAxisIndicesHeight,width:yAxisIndicesWidth,left:yAxisIndicesWidth/-2+(yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?(width!=null?width:totalWidth)+yAxisLabelWidth/2+yAxisIndicesWidth/4:0),backgroundColor:yAxisIndicesColor}}):null]});};var renderExtraHeightOfYAxisAtTop=function renderExtraHeightOfYAxisAtTop(){var _secondaryXAxis$color,_secondaryXAxis$thick;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_styles.styles.horizBar,{width:(width!=null?width:totalWidth)+endSpacing,top:stepHeight/2},horizontal&&!yAxisAtTop&&{transform:[{rotateY:'180deg'}]},horizontalRulesStyle],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.leftLabel,{height:yAxisExtraHeightAtTop,width:yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?0:yAxisLabelWidth},yAxisLabelContainerStyle]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.leftPart,{borderLeftColor:yAxisColor,borderRightColor:yAxisColor,borderTopColor:(_secondaryXAxis$color=secondaryXAxis==null?void 0:secondaryXAxis.color)!=null?_secondaryXAxis$color:xAxisColor,borderTopWidth:secondaryXAxis?(_secondaryXAxis$thick=secondaryXAxis.thickness)!=null?_secondaryXAxis$thick:xAxisThickness:0,backgroundColor:backgroundColor,width:(props.width||totalWidth-spacing)+endSpacing},yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?{borderRightWidth:yAxisThickness}:{borderLeftWidth:yAxisThickness}]})]});};var renderSecondaryYaxisLabels=function renderSecondaryYaxisLabels(horizSections,isBelow){return horizSections.map(function(sectionItems,index){var _secondaryYAxisConfig,_secondaryYAxisConfig2,_secondaryYAxisConfig3;var label=getLabelTextsForSecondaryYAxis(sectionItems.value,index);if(secondaryYAxisConfig.hideOrigin&&index===0){label='';}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_styles.styles.horizBar,_styles.styles.leftLabel,{position:'absolute',zIndex:1,bottom:((_secondaryYAxisConfig=secondaryYAxisConfig.stepHeight)!=null?_secondaryYAxisConfig:0)*((isBelow?0:noOfSectionsBelowXAxis)+index-(noOfSectionsBelowXAxis?0:0.5)),width:secondaryYAxisConfig.yAxisLabelWidth,height:(_secondaryYAxisConfig2=secondaryYAxisConfig.stepHeight)!=null?_secondaryYAxisConfig2:0},yAxisLabelContainerStyle],children:[secondaryYAxisConfig.showYAxisIndices&&index!==0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:secondaryYAxisConfig.yAxisIndicesHeight,width:secondaryYAxisConfig.yAxisIndicesWidth,position:'absolute',left:((_secondaryYAxisConfig3=secondaryYAxisConfig.yAxisIndicesWidth)!=null?_secondaryYAxisConfig3:0)/-2,backgroundColor:secondaryYAxisConfig.yAxisIndicesColor}}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{numberOfLines:secondaryYAxisConfig.yAxisTextNumberOfLines,ellipsizeMode:'clip',style:[secondaryYAxisConfig.yAxisTextStyle],children:label})]},index);});};var referenceLines=function referenceLines(){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[showReferenceLine1?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:'absolute',zIndex:referenceLine1Config.zIndex,bottom:(referenceLine1Position-(yAxisOffset!=null?yAxisOffset:0))*containerHeight/maxValue,left:yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?0:yAxisLabelWidth+yAxisThickness},children:[(0,_jsxRuntime.jsx)(_lineSvg.default,{config:referenceLine1Config}),referenceLine1Config.labelText?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{position:'absolute'},referenceLine1Config.labelTextStyle],children:referenceLine1Config.labelText}):null]}):null,showReferenceLine2?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:'absolute',zIndex:referenceLine2Config.zIndex,bottom:(referenceLine2Position-(yAxisOffset!=null?yAxisOffset:0))*containerHeight/maxValue,left:yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?0:yAxisLabelWidth+yAxisThickness},children:[(0,_jsxRuntime.jsx)(_lineSvg.default,{config:referenceLine2Config}),referenceLine2Config.labelText?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{position:'absolute'},referenceLine2Config.labelTextStyle],children:referenceLine2Config.labelText}):null]}):null,showReferenceLine3?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:'absolute',zIndex:referenceLine3Config.zIndex,bottom:(referenceLine3Position-(yAxisOffset!=null?yAxisOffset:0))*containerHeight/maxValue,left:yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?0:yAxisLabelWidth+yAxisThickness},children:[(0,_jsxRuntime.jsx)(_lineSvg.default,{config:referenceLine3Config}),referenceLine3Config.labelText?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{position:'absolute'},referenceLine3Config.labelTextStyle],children:referenceLine3Config.labelText}):null]}):null]});};var leftShiftForRIghtYaxis=(width?width+20:totalWidth)+yAxisLabelWidth/2+endSpacing-(chartType===_giftedChartsCore.chartTypes.BAR?40:60);return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:onlyReferenceLines?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:'row',backgroundColor:'green'},children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:(width!=null?width:totalWidth)+endSpacing},children:referenceLines()})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"none",style:{flexDirection:'row',marginTop:stepHeight/-2},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{width:(width!=null?width:totalWidth)+endSpacing},children:[yAxisExtraHeightAtTop?renderExtraHeightOfYAxisAtTop():null,horizSections.map(function(sectionItems,index){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_styles.styles.horizBar,{width:(width!=null?width:totalWidth)+endSpacing},horizontal&&!yAxisAtTop&&{transform:[{rotateY:'180deg'}]},horizontalRulesStyle],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.leftLabel,{height:index===noOfSections?stepHeight/2:stepHeight,width:yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?0:yAxisLabelWidth},yAxisLabelContainerStyle]}),renderAxesAndRules(index)]},index);}),!hideYAxisText&&horizSections.map(function(sectionItems,index){var label=getLabelTexts(sectionItems.value,index);if(hideOrigin&&index===horizSections.length-1){label='';}return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.horizBar,_styles.styles.leftLabel,{position:'absolute',zIndex:1,top:stepHeight*index+yAxisExtraHeightAtTop,width:yAxisLabelWidth,height:index===noOfSections?stepHeight/2:stepHeight},yAxisSide===_giftedChartsCore.yAxisSides.RIGHT&&{left:leftShiftForRIghtYaxis},horizontal&&!yAxisAtTop&&{transform:[{translateX:(width!=null?width:totalWidth)-30+endSpacing}]},yAxisLabelContainerStyle],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{numberOfLines:yAxisTextNumberOfLines,ellipsizeMode:'clip',style:[yAxisTextStyle,horizontal&&{transform:[{rotate:`${rotateYAxisTexts!=null?rotateYAxisTexts:rtl?90:-90}deg`}]},index===noOfSections&&{marginBottom:stepHeight/-2}],children:label})},index);}),horizSectionsBelow.map(function(sectionItems,index){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_styles.styles.horizBar,{width:(width!=null?width:totalWidth)+15},index===0&&{marginTop:negativeStepHeight/2}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.leftLabel,{borderRightWidth:yAxisThickness,borderColor:yAxisColor,marginLeft:yAxisThickness},{height:index===0?negativeStepHeight*1.5:negativeStepHeight,width:yAxisSide===_giftedChartsCore.yAxisSides.RIGHT?0:yAxisLabelWidth},index===0&&{marginTop:-negativeStepHeight/2}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.leftPart,{backgroundColor:backgroundColor}],children:hideRules?null:(0,_jsxRuntime.jsx)(_lineSvg.default,{config:{thickness:rulesThickness,color:rulesColor,width:rulesLength||(props.width||totalWidth-spacing)+endSpacing,dashWidth:dashWidth,dashGap:dashGap,type:rulesType}})})]},index);}),!hideYAxisText&&horizSectionsBelow.map(function(sectionItems,index){var label=getLabelTexts(horizSectionsBelow[horizSectionsBelow.length-1-index].value,index);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.horizBar,_styles.styles.leftLabel,{position:'absolute',zIndex:1,bottom:negativeStepHeight*index,width:yAxisLabelWidth,height:index===noOfSectionsBelowXAxis?negativeStepHeight/2:negativeStepHeight},yAxisSide===_giftedChartsCore.yAxisSides.RIGHT&&{left:(width!=null?width:totalWidth)+yAxisLabelWidth},yAxisLabelContainerStyle],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{numberOfLines:yAxisTextNumberOfLines,ellipsizeMode:'clip',style:[yAxisTextStyle,index===noOfSectionsBelowXAxis&&{marginBottom:negativeStepHeight/-2}],children:label})},index);}),renderReferenceLines?referenceLines():null]}),secondaryYAxis?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{width:secondaryYAxisConfig.yAxisLabelWidth,left:width?yAxisLabelWidth:yAxisLabelWidth-spacing,borderColor:secondaryYAxisConfig.yAxisColor,borderLeftWidth:secondaryYAxisConfig.yAxisThickness,height:containerHeight+yAxisExtraHeightAtTop,bottom:stepHeight/-2},children:[!secondaryYAxisConfig.hideYAxisText?renderSecondaryYaxisLabels(secondaryHorizSections,false):null,noOfSectionsBelowXAxis&&!secondaryYAxisConfig.hideYAxisText?renderSecondaryYaxisLabels(secondaryHorizSectionsBelow,true):null]}):null]})});};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _renderSpecificVerticalLines=require("./renderSpecificVerticalLines");var _renderDataPoints=require("./renderDataPoints");var _renderSpecificDataPoints=require("./renderSpecificDataPoints");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/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 RenderLineInBarChart=function RenderLineInBarChart(props){var _data$0$barWidth;var yAxisLabelWidth=props.yAxisLabelWidth,initialSpacing=props.initialSpacing,spacing=props.spacing,containerHeight=props.containerHeight,lineConfig=props.lineConfig,maxValue=props.maxValue,animatedWidth=props.animatedWidth,lineBehindBars=props.lineBehindBars,points=props.points,arrowPoints=props.arrowPoints,data=props.data,totalWidth=props.totalWidth,barWidth=props.barWidth,labelsExtraHeight=props.labelsExtraHeight,xAxisLabelsVerticalShift=props.xAxisLabelsVerticalShift,selectedIndex=props.selectedIndex;var firstBarWidth=(_data$0$barWidth=data[0].barWidth)!=null?_data$0$barWidth:barWidth;var dataPointsProps={data:data,lineConfig:lineConfig,barWidth:barWidth,containerHeight:containerHeight,maxValue:maxValue,firstBarWidth:firstBarWidth,yAxisLabelWidth:yAxisLabelWidth,spacing:spacing,selectedIndex:selectedIndex};var specificVerticalLinesProps={data:data,barWidth:barWidth,yAxisLabelWidth:yAxisLabelWidth,initialSpacing:initialSpacing,spacing:spacing,containerHeight:containerHeight,lineConfig:lineConfig,maxValue:maxValue};var specificDataPointsProps={data:data,barWidth:barWidth,firstBarWidth:firstBarWidth,yAxisLabelWidth:yAxisLabelWidth,lineConfig:lineConfig,spacing:spacing,containerHeight:containerHeight,maxValue:maxValue};var renderAnimatedLine=function renderAnimatedLine(){var _lineConfig$arrowConf,_lineConfig$arrowConf2,_lineConfig$arrowConf3;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:{position:'absolute',height:containerHeight+10,left:6-yAxisLabelWidth,bottom:50+xAxisLabelsVerticalShift,width:animatedWidth,zIndex:lineBehindBars?-1:100000},children:(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:points,fill:"none",stroke:lineConfig.color,strokeWidth:lineConfig.thickness}),(0,_renderSpecificVerticalLines.renderSpecificVerticalLines)(specificVerticalLinesProps),!lineConfig.hideDataPoints?(0,_renderDataPoints.renderDataPoints)(dataPointsProps):(0,_renderSpecificDataPoints.renderSpecificDataPoints)(specificDataPointsProps),lineConfig.showArrow&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:arrowPoints,fill:(_lineConfig$arrowConf=lineConfig.arrowConfig)==null?void 0:_lineConfig$arrowConf.fillColor,stroke:(_lineConfig$arrowConf2=lineConfig.arrowConfig)==null?void 0:_lineConfig$arrowConf2.strokeColor,strokeWidth:(_lineConfig$arrowConf3=lineConfig.arrowConfig)==null?void 0:_lineConfig$arrowConf3.strokeWidth})]})});};var renderLine=function renderLine(){var _lineConfig$arrowConf4,_lineConfig$arrowConf5,_lineConfig$arrowConf6;return(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:{position:'absolute',height:containerHeight+10+labelsExtraHeight,left:6-yAxisLabelWidth,bottom:50+xAxisLabelsVerticalShift,width:totalWidth,zIndex:lineBehindBars?-1:100000},children:(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:points,fill:"none",stroke:lineConfig.color,strokeWidth:lineConfig.thickness}),(0,_renderSpecificVerticalLines.renderSpecificVerticalLines)(specificVerticalLinesProps),!lineConfig.hideDataPoints?(0,_renderDataPoints.renderDataPoints)(dataPointsProps):(0,_renderSpecificDataPoints.renderSpecificDataPoints)(specificDataPointsProps),lineConfig.showArrow&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:arrowPoints,fill:(_lineConfig$arrowConf4=lineConfig.arrowConfig)==null?void 0:_lineConfig$arrowConf4.fillColor,stroke:(_lineConfig$arrowConf5=lineConfig.arrowConfig)==null?void 0:_lineConfig$arrowConf5.strokeColor,strokeWidth:(_lineConfig$arrowConf6=lineConfig.arrowConfig)==null?void 0:_lineConfig$arrowConf6.strokeWidth})]})});};if(lineConfig.isAnimated){return renderAnimatedLine();}return renderLine();};var _default=exports.default=RenderLineInBarChart;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.renderDataPoints=void 0;var _react=_interopRequireWildcard(require("react"));var _styles=require("../../../BarChart/styles");var _reactNative=require("react-native");var _giftedChartsCore=require("gifted-charts-core");var _reactNativeSvg=require("react-native-svg");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.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 renderDataPoints=exports.renderDataPoints=function renderDataPoints(props){var data=props.data,lineConfig=props.lineConfig,barWidth=props.barWidth,containerHeight=props.containerHeight,maxValue=props.maxValue,firstBarWidth=props.firstBarWidth,yAxisLabelWidth=props.yAxisLabelWidth,spacing=props.spacing,selectedIndex=props.selectedIndex;return data.map(function(item,index){var _lineConfig$focusedDa,_lineConfig$focusedDa2,_item$value;if(index<lineConfig.startIndex||index>lineConfig.endIndex||item.hideDataPoint){return null;}var currentBarWidth=item.barWidth||barWidth||30;var customDataPoint=item.customDataPoint||lineConfig.customDataPoint;var dataPointColor=lineConfig.focusEnabled&&index===((_lineConfig$focusedDa=lineConfig.focusedDataPointIndex)!=null?_lineConfig$focusedDa:selectedIndex)?lineConfig.focusedDataPointColor:lineConfig.dataPointsColor;var dataPointRadius=lineConfig.focusEnabled&&index===((_lineConfig$focusedDa2=lineConfig.focusedDataPointIndex)!=null?_lineConfig$focusedDa2:selectedIndex)?lineConfig.focusedDataPointRadius:lineConfig.dataPointsRadius;var value=(_item$value=item.value)!=null?_item$value:item.stacks.reduce(function(total,item){return total+item.value;},0);if(customDataPoint){var _ref,_item$shiftY;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.customDataPointContainer,{height:lineConfig.dataPointsHeight,width:lineConfig.dataPointsWidth,top:containerHeight-value*containerHeight/maxValue-((_ref=(_item$shiftY=item.shiftY)!=null?_item$shiftY:lineConfig.shiftY)!=null?_ref:0),left:(0,_giftedChartsCore.getXForLineInBar)(index,firstBarWidth,currentBarWidth,yAxisLabelWidth,lineConfig,spacing)}],children:customDataPoint(item,index)});}if(lineConfig.dataPointsShape==='rectangular'){return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{x:(0,_giftedChartsCore.getXForLineInBar)(index,firstBarWidth,currentBarWidth,yAxisLabelWidth,lineConfig,spacing),y:(0,_giftedChartsCore.getYForLineInBar)(value,lineConfig.shiftY,containerHeight,maxValue)-lineConfig.dataPointsHeight/2,width:lineConfig.dataPointsWidth,height:lineConfig.dataPointsHeight,fill:dataPointColor}),item.dataPointText&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{fill:item.textColor||lineConfig.textColor,fontSize:item.textFontSize||lineConfig.textFontSize,x:(0,_giftedChartsCore.getXForLineInBar)(index,firstBarWidth,currentBarWidth,yAxisLabelWidth,lineConfig,spacing)+(item.textShiftX||lineConfig.textShiftX||0),y:(0,_giftedChartsCore.getYForLineInBar)(value,lineConfig.shiftY,containerHeight,maxValue)-lineConfig.dataPointsHeight/2+(item.textShiftY||lineConfig.textShiftY||0),children:item.dataPointText})]},index);}return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Circle,{cx:(0,_giftedChartsCore.getXForLineInBar)(index,firstBarWidth,currentBarWidth,yAxisLabelWidth,lineConfig,spacing),cy:(0,_giftedChartsCore.getYForLineInBar)(value,lineConfig.shiftY,containerHeight,maxValue),r:dataPointRadius,fill:dataPointColor}),item.dataPointText&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{fill:item.textColor||lineConfig.textColor,fontSize:item.textFontSize||lineConfig.textFontSize,x:(0,_giftedChartsCore.getXForLineInBar)(index,firstBarWidth,currentBarWidth,yAxisLabelWidth,lineConfig,spacing)+(item.textShiftX||lineConfig.textShiftX||0),y:(0,_giftedChartsCore.getYForLineInBar)(value,lineConfig.shiftY,containerHeight,maxValue)-lineConfig.dataPointsHeight/2+(item.textShiftY||lineConfig.textShiftY||0),children:item.dataPointText})]},index);});};
|
package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.renderSpecificDataPoints=void 0;var _react=_interopRequireWildcard(require("react"));var _giftedChartsCore=require("gifted-charts-core");var _reactNativeSvg=require("react-native-svg");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.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 renderSpecificDataPoints=exports.renderSpecificDataPoints=function renderSpecificDataPoints(props){var data=props.data,barWidth=props.barWidth,firstBarWidth=props.firstBarWidth,yAxisLabelWidth=props.yAxisLabelWidth,lineConfig=props.lineConfig,spacing=props.spacing,containerHeight=props.containerHeight,maxValue=props.maxValue;return data.map(function(item,index){var currentBarWidth=item.barWidth||barWidth||30;var x=(0,_giftedChartsCore.getXForLineInBar)(index,firstBarWidth,currentBarWidth,yAxisLabelWidth,lineConfig,spacing);var y=(0,_giftedChartsCore.getYForLineInBar)(item.value,lineConfig.shiftY,containerHeight,maxValue);if(item.showDataPoint){if(item.dataPointShape==='rectangular'){return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{x:x,y:y-item.dataPointsHeight/2,width:item.dataPointWidth||lineConfig.dataPointsWidth,height:item.dataPointHeight||2,fill:item.dataPointColor||'black'}),item.dataPointText&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{fill:item.textColor||'black',fontSize:item.textFontSize||10,x:x+(item.textShiftX||lineConfig.textShiftX||0),y:y-(item.dataPointHeight||lineConfig.dataPointsHeight)/2+(item.textShiftY||lineConfig.textShiftY||0),children:item.dataPointText})]},index);}else{return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Circle,{cx:x,cy:y,r:item.dataPointRadius||3,fill:item.dataPointColor||'black'}),item.dataPointText&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{fill:item.textColor||'black',fontSize:item.textFontSize||10,x:x+(item.textShiftX||lineConfig.textShiftX||0),y:y-(item.dataPointHeight||lineConfig.dataPointsHeight)/2+(item.textShiftY||lineConfig.textShiftY||0),children:item.dataPointText})]},index);}}return null;});};
|
package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.renderSpecificVerticalLines=void 0;var _react=_interopRequireDefault(require("react"));var _reactNativeSvg=require("react-native-svg");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx";var renderSpecificVerticalLines=exports.renderSpecificVerticalLines=function renderSpecificVerticalLines(props){var data=props.data,barWidth=props.barWidth,yAxisLabelWidth=props.yAxisLabelWidth,initialSpacing=props.initialSpacing,spacing=props.spacing,containerHeight=props.containerHeight,lineConfig=props.lineConfig,maxValue=props.maxValue;return data.map(function(item,index){if(item.showVerticalLine){var currentBarWidth=item.barWidth||barWidth||30;return(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{x:yAxisLabelWidth+6-(item.verticalLineThickness||1)/2-1-(initialSpacing-currentBarWidth/2)+(currentBarWidth+spacing)*index,y:containerHeight-lineConfig.shiftY-item.value*containerHeight/maxValue+9,width:item.verticalLineThickness||1,height:item.value*containerHeight/maxValue+lineConfig.shiftY,fill:item.verticalLineColor||'lightgray'});}return null;});};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _giftedChartsCore=require("gifted-charts-core");var _reactNativeSvg=require("react-native-svg");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx";var RenderVerticalLines=function RenderVerticalLines(props){var verticalLinesAr=props.verticalLinesAr,verticalLinesSpacing=props.verticalLinesSpacing,spacing=props.spacing,initialSpacing=props.initialSpacing,verticalLinesZIndex=props.verticalLinesZIndex,verticalLinesHeight=props.verticalLinesHeight,verticalLinesThickness=props.verticalLinesThickness,verticalLinesColor=props.verticalLinesColor,verticalLinesStrokeDashArray=props.verticalLinesStrokeDashArray,verticalLinesShift=props.verticalLinesShift,verticalLinesUptoDataPoint=props.verticalLinesUptoDataPoint,verticalLinesStrokeLinecap=props.verticalLinesStrokeLinecap,xAxisThickness=props.xAxisThickness,labelsExtraHeight=props.labelsExtraHeight,containerHeight=props.containerHeight,data=props.data,stackData=props.stackData,barWidth=props.barWidth,maxValue=props.maxValue,chartType=props.chartType,containerHeightIncludingBelowXAxis=props.containerHeightIncludingBelowXAxis,totalWidth=props.totalWidth,xAxisLabelsVerticalShift=props.xAxisLabelsVerticalShift;var getHeightOfVerticalLine=function getHeightOfVerticalLine(index){if(verticalLinesUptoDataPoint){if(index<data.length){return data[index].value*containerHeight/maxValue-xAxisThickness;}else{return verticalLinesHeight!=null?verticalLinesHeight:0;}}else{return verticalLinesHeight||containerHeightIncludingBelowXAxis-xAxisThickness;}};var extendedContainerHeight=containerHeight+10+labelsExtraHeight;var thickness=verticalLinesThickness||2;var heightAdjustmentDueToStrokeLinecap=verticalLinesStrokeLinecap==='round'||verticalLinesStrokeLinecap==='square'?thickness/2:0;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',height:extendedContainerHeight,bottom:60+xAxisLabelsVerticalShift,width:totalWidth,zIndex:verticalLinesZIndex||-1},children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Svg,{children:verticalLinesAr.map(function(item,index){var totalSpacing=initialSpacing;if(verticalLinesSpacing){totalSpacing=verticalLinesSpacing*(index+1);}else{if(stackData){totalSpacing+=(stackData[0].barWidth||barWidth||30)/2;}else{totalSpacing+=(data[0].barWidth||barWidth||30)/2;}for(var i=0;i<index;i++){var actualSpacing=spacing;if(stackData){if(i>=stackData.length-1){actualSpacing+=(barWidth||30)/2;}else{if(stackData[i].spacing||stackData[i].spacing===0){actualSpacing=stackData[i].spacing;}if(stackData[i+1].barWidth){actualSpacing+=stackData[i+1].barWidth;}else{actualSpacing+=barWidth||30;}}}else{if(i>=data.length-1){actualSpacing+=(barWidth||30)/2;}else{if(data[i].spacing||data[i].spacing===0){actualSpacing=data[i].spacing;}if(data[i+1].barWidth){actualSpacing+=data[i+1].barWidth;}else{actualSpacing+=barWidth||30;}}}totalSpacing+=actualSpacing;}}var x=verticalLinesShift+1+(chartType===_giftedChartsCore.chartTypes.BAR?totalSpacing-1:verticalLinesSpacing?verticalLinesSpacing*(index+1):index*spacing+(initialSpacing-2));return(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{x1:x,y1:extendedContainerHeight-getHeightOfVerticalLine(index)+heightAdjustmentDueToStrokeLinecap,x2:x,y2:extendedContainerHeight-heightAdjustmentDueToStrokeLinecap,stroke:verticalLinesColor||'lightgray',strokeWidth:verticalLinesThickness||2,strokeDasharray:verticalLinesStrokeDashArray!=null?verticalLinesStrokeDashArray:'',strokeLinecap:verticalLinesStrokeLinecap},index);})})});};var _default=exports.default=RenderVerticalLines;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarSpecificComponents/barBackgroundPattern.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 BarBackgroundPattern=function BarBackgroundPattern(props){var barBackgroundPatternFromItem=props.barBackgroundPatternFromItem,barBackgroundPatternFromProps=props.barBackgroundPatternFromProps,patternIdFromItem=props.patternIdFromItem,patternIdFromProps=props.patternIdFromProps;return(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Defs,{children:barBackgroundPatternFromItem?barBackgroundPatternFromItem():barBackgroundPatternFromProps()}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{stroke:"transparent",x:"1",y:"1",width:"100%",height:"100%",fill:`url(#${patternIdFromItem!=null?patternIdFromItem:patternIdFromProps})`})]});};var _default=exports.default=BarBackgroundPattern;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _giftedChartsCore=require("gifted-charts-core");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarSpecificComponents/cap.tsx";var Cap=function Cap(props){var _ref,_ref2,_ref3,_ref4;var capThicknessFromItem=props.capThicknessFromItem,capThicknessFromProps=props.capThicknessFromProps,capColorFromItem=props.capColorFromItem,capColorFromProps=props.capColorFromProps,capRadiusFromItem=props.capRadiusFromItem,capRadiusFromProps=props.capRadiusFromProps;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',width:'100%',height:(_ref=capThicknessFromItem!=null?capThicknessFromItem:capThicknessFromProps)!=null?_ref:_giftedChartsCore.BarDefaults.capThickness,backgroundColor:(_ref2=capColorFromItem!=null?capColorFromItem:capColorFromProps)!=null?_ref2:_giftedChartsCore.BarDefaults.capColor,borderTopLeftRadius:(_ref3=capRadiusFromItem!=null?capRadiusFromItem:capRadiusFromProps)!=null?_ref3:_giftedChartsCore.BarDefaults.capRadius,borderTopRightRadius:(_ref4=capRadiusFromItem!=null?capRadiusFromItem:capRadiusFromProps)!=null?_ref4:_giftedChartsCore.BarDefaults.capRadius}});};var _default=exports.default=Cap;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/BarSpecificComponents/tooltip.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 Tooltip=function Tooltip(props){var barHeight=props.barHeight,barWidth=props.barWidth,item=props.item,index=props.index,isLast=props.isLast,leftSpacing=props.leftSpacing,leftShiftForLastIndexTooltip=props.leftShiftForLastIndexTooltip,leftShiftForTooltip=props.leftShiftForTooltip,renderTooltip=props.renderTooltip,autoCenterTooltip=props.autoCenterTooltip,horizontal=props.horizontal;var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2.default)(_useState,2),leftShiftTooltipForCentering=_useState2[0],setLeftShiftTooltipForCentering=_useState2[1];return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',bottom:barHeight+60,left:leftSpacing-(isLast?leftShiftForLastIndexTooltip:leftShiftForTooltip)-leftShiftTooltipForCentering,zIndex:1000,transform:[{rotate:horizontal?'-90deg':'0deg'}]},onLayout:function onLayout(event){if(!autoCenterTooltip)return;var width=event.nativeEvent.layout.width;var shift=(width-barWidth)/2;if(shift>0)setLeftShiftTooltipForCentering(shift);},children:renderTooltip==null?void 0:renderTooltip(item,index)});};var _default=exports.default=Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var LinearGradient;try{LinearGradient=require('react-native-linear-gradient').LinearGradient;}catch(e){try{LinearGradient=require('expo-linear-gradient').LinearGradient;}catch(e){throw new Error('Gradient package was not found. Make sure "react-native-linear-gradient" or "expo-linear-gradient" is installed');}}var _default=exports.default=LinearGradient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Pointer=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/common/Pointer.tsx";var Pointer=exports.Pointer=function Pointer(props){var pointerX=props.pointerX,pointerYLocal=props.pointerYLocal,pointerComponent=props.pointerComponent,pointerHeight=props.pointerHeight,pointerRadius=props.pointerRadius,pointerWidth=props.pointerWidth,pointerItemLocal=props.pointerItemLocal,pointerColorLocal=props.pointerColorLocal;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',left:pointerX+(pointerX.pointerShiftX||0),top:pointerYLocal-2},children:pointerComponent?pointerComponent():(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:pointerHeight||pointerRadius*2,width:pointerWidth||pointerRadius*2,marginTop:(pointerItemLocal==null?void 0:pointerItemLocal.pointerShiftY)||0,backgroundColor:pointerColorLocal,borderRadius:pointerRadius||0}})});};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.StripAndLabel=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _giftedChartsCore=require("gifted-charts-core");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/common/StripAndLabel.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 StripAndLabel=exports.StripAndLabel=function StripAndLabel(props){var _pointerItemLocal$;var pointerX=props.pointerX,pointerLabelWidth=props.pointerLabelWidth,pointerRadius=props.pointerRadius,pointerWidth=props.pointerWidth,pointerYLocal=props.pointerYLocal,pointerStripUptoDataPoint=props.pointerStripUptoDataPoint,pointerStripHeight=props.pointerStripHeight,pointerItemLocal=props.pointerItemLocal,showPointerStrip=props.showPointerStrip,pointerStripWidth=props.pointerStripWidth,containerHeight=props.containerHeight,xAxisThickness=props.xAxisThickness,pointerStripColor=props.pointerStripColor,pointerConfig=props.pointerConfig,pointerLabelComponent=props.pointerLabelComponent,secondaryPointerItem=props.secondaryPointerItem,pointerEvents=props.pointerEvents,isBarChart=props.isBarChart;var _getTopAndLeftForStri=(0,_giftedChartsCore.getTopAndLeftForStripAndLabel)(props),top=_getTopAndLeftForStri.top,left=_getTopAndLeftForStri.left;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:'absolute',left:pointerX+(((_pointerItemLocal$=pointerItemLocal[0])==null?void 0:_pointerItemLocal$.pointerShiftX)||0),top:pointerYLocal},children:[(isBarChart?showPointerStrip&&!pointerLabelComponent:showPointerStrip)?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',left:(pointerRadius||pointerWidth)-pointerStripWidth/4,top:pointerStripUptoDataPoint?pointerRadius||pointerStripHeight/2:-pointerYLocal+8,width:pointerStripWidth,height:pointerStripUptoDataPoint?containerHeight-pointerYLocal+5-xAxisThickness:pointerStripHeight,marginTop:pointerStripUptoDataPoint?0:containerHeight-pointerStripHeight},children:(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{stroke:pointerStripColor,strokeWidth:pointerStripWidth,strokeDasharray:pointerConfig!=null&&pointerConfig.strokeDashArray?pointerConfig==null?void 0:pointerConfig.strokeDashArray:'',x1:0,y1:0,x2:0,y2:pointerStripUptoDataPoint?containerHeight-pointerYLocal+5-xAxisThickness:pointerStripHeight})})}):null,pointerLabelComponent?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:pointerEvents!=null?pointerEvents:'none',style:[{position:'absolute',left:left,top:top,marginTop:pointerStripUptoDataPoint?0:containerHeight-pointerStripHeight,width:pointerLabelWidth}],children:pointerLabelComponent==null?void 0:pointerLabelComponent(pointerItemLocal,secondaryPointerItem)}):null]});};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var React=_interopRequireWildcard(require("react"));var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _giftedChartsCore=require("gifted-charts-core");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/Components/lineSvg.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;}function Rule(props){var _props$config=props.config,thickness=_props$config.thickness,width=_props$config.width,color=_props$config.color,type=_props$config.type,dashWidth=_props$config.dashWidth,dashGap=_props$config.dashGap;if(type===_giftedChartsCore.ruleTypes.SOLID){return(0,_jsxRuntime.jsx)(_reactNativeSvg.default,Object.assign({height:thickness,width:width},props,{children:(0,_jsxRuntime.jsx)(_reactNativeSvg.G,{fill:"lightgray",stroke:color,strokeWidth:thickness,children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:`M0 ${thickness/2}h${width}`})})}));}return(0,_jsxRuntime.jsx)(_reactNativeSvg.default,Object.assign({height:thickness,width:width},props,{children:(0,_jsxRuntime.jsx)(_reactNativeSvg.G,{fill:"lightgray",stroke:color,strokeWidth:thickness,children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{strokeDasharray:`${dashWidth},${dashGap}`,d:`M0 ${thickness/2}h${width}`})})}));}var _default=exports.default=Rule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.LineChartBicolor=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _styles=require("./styles");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _BarAndLineChartsWrapper=_interopRequireDefault(require("../Components/BarAndLineChartsWrapper"));var _giftedChartsCore=require("gifted-charts-core");var _utils=require("../utils");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/LineChart/LineChartBicolor.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 LineChartBicolor=exports.LineChartBicolor=function LineChartBicolor(props){var _props$parentWidth;var scrollRef=(0,_react.useRef)();var widthValue=(0,_react.useMemo)(function(){return new _reactNative.Animated.Value(0);},[]);var opacValue=(0,_react.useMemo)(function(){return new _reactNative.Animated.Value(0);},[]);var _useLineChartBiColor=(0,_giftedChartsCore.useLineChartBiColor)(Object.assign({},props,{parentWidth:(_props$parentWidth=props.parentWidth)!=null?_props$parentWidth:_utils.screenWidth})),pointsArray=_useLineChartBiColor.pointsArray,fillPointsArray=_useLineChartBiColor.fillPointsArray,selectedIndex=_useLineChartBiColor.selectedIndex,setSelectedIndex=_useLineChartBiColor.setSelectedIndex,containerHeight=_useLineChartBiColor.containerHeight,data=_useLineChartBiColor.data,labelsExtraHeight=_useLineChartBiColor.labelsExtraHeight,animationDuration=_useLineChartBiColor.animationDuration,startIndex1=_useLineChartBiColor.startIndex1,endIndex1=_useLineChartBiColor.endIndex1,initialSpacing=_useLineChartBiColor.initialSpacing,thickness=_useLineChartBiColor.thickness,spacing=_useLineChartBiColor.spacing,xAxisThickness=_useLineChartBiColor.xAxisThickness,dataPointsHeight1=_useLineChartBiColor.dataPointsHeight1,dataPointsWidth1=_useLineChartBiColor.dataPointsWidth1,dataPointsRadius1=_useLineChartBiColor.dataPointsRadius1,dataPointsColor1=_useLineChartBiColor.dataPointsColor1,dataPointsShape1=_useLineChartBiColor.dataPointsShape1,areaChart=_useLineChartBiColor.areaChart,textFontSize1=_useLineChartBiColor.textFontSize1,textColor1=_useLineChartBiColor.textColor1,totalWidth=_useLineChartBiColor.totalWidth,maxValue=_useLineChartBiColor.maxValue,extendedContainerHeight=_useLineChartBiColor.extendedContainerHeight,getX=_useLineChartBiColor.getX,getY=_useLineChartBiColor.getY,stepHeight=_useLineChartBiColor.stepHeight,noOfSectionsBelowXAxis=_useLineChartBiColor.noOfSectionsBelowXAxis,thickness1=_useLineChartBiColor.thickness1,zIndex=_useLineChartBiColor.zIndex,strokeDashArray1=_useLineChartBiColor.strokeDashArray1,rotateLabel=_useLineChartBiColor.rotateLabel,isAnimated=_useLineChartBiColor.isAnimated,hideDataPoints1=_useLineChartBiColor.hideDataPoints1,color=_useLineChartBiColor.color,colorNegative=_useLineChartBiColor.colorNegative,startFillColor=_useLineChartBiColor.startFillColor,endFillColor=_useLineChartBiColor.endFillColor,startOpacity=_useLineChartBiColor.startOpacity,endOpacity=_useLineChartBiColor.endOpacity,startFillColorNegative=_useLineChartBiColor.startFillColorNegative,endFillColorNegative=_useLineChartBiColor.endFillColorNegative,startOpacityNegative=_useLineChartBiColor.startOpacityNegative,endOpacityNegative=_useLineChartBiColor.endOpacityNegative,gradientDirection=_useLineChartBiColor.gradientDirection,xAxisTextNumberOfLines=_useLineChartBiColor.xAxisTextNumberOfLines,focusEnabled=_useLineChartBiColor.focusEnabled,showDataPointOnFocus=_useLineChartBiColor.showDataPointOnFocus,showStripOnFocus=_useLineChartBiColor.showStripOnFocus,showTextOnFocus=_useLineChartBiColor.showTextOnFocus,stripHeight=_useLineChartBiColor.stripHeight,stripWidth=_useLineChartBiColor.stripWidth,stripColor=_useLineChartBiColor.stripColor,stripOpacity=_useLineChartBiColor.stripOpacity,unFocusOnPressOut=_useLineChartBiColor.unFocusOnPressOut,delayBeforeUnFocus=_useLineChartBiColor.delayBeforeUnFocus,barAndLineChartsWrapperProps=_useLineChartBiColor.barAndLineChartsWrapperProps;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]);(0,_react.useEffect)(function(){decreaseWidth();labelsAppear();},[animationDuration,decreaseWidth,labelsAppear]);var renderLabel=function renderLabel(index,label,labelTextStyle,labelComponent){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{position:'absolute',bottom:30,zIndex:10,width:spacing+labelsExtraHeight,left:index===0&&initialSpacing<10?getX(index)-spacing/2+8:getX(index)-spacing/2,justifyContent:'center'},rotateLabel&&{transform:[{rotate:'60deg'}]}],children:labelComponent?labelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:labelTextStyle||{textAlign:'center'},numberOfLines:xAxisTextNumberOfLines,children:label||''})});};var renderAnimatedLabel=function renderAnimatedLabel(index,label,labelTextStyle,labelComponent){return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[{height:rotateLabel?40:20,position:'absolute',bottom:rotateLabel?10:30,zIndex:10,width:spacing,left:index===0&&initialSpacing<10?getX(index)-spacing/2+8:getX(index)-spacing/2,opacity:appearingOpacity},rotateLabel&&{transform:[{rotate:'60deg'}]}],children:labelComponent?labelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:labelTextStyle||{textAlign:'center'},numberOfLines:xAxisTextNumberOfLines,children:label||''})});};var animatedWidth=widthValue.interpolate({inputRange:[0,1],outputRange:[0,totalWidth]});var onStripPress=function onStripPress(item,index){setSelectedIndex(index);if(props.onFocus){props.onFocus(item,index);}};var renderDataPoints=function renderDataPoints(dataForRender,dataPtsShape,dataPtsWidth,dataPtsHeight,dataPtsColor,dataPtsRadius,textColor,textFontSize,startIndex,endIndex){return dataForRender.map(function(item,index){var _item$stripHeight,_item$stripWidth,_item$stripOpacity;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||'orange';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;}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 currentStripColor=item.stripColor||stripColor;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,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.Rect,{x:initialSpacing+(spacing*index-dataPointsWidth/2),y:currentStripHeight?containerHeight-currentStripHeight+8:containerHeight-dataPointsHeight/2+20-item.value*containerHeight/maxValue,width:currentStripWidth,height:currentStripHeight||containerHeight-dataPointsHeight/2+20,opacity:currentStripOpacity,fill:currentStripColor}):null,customDataPoint?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_styles.styles.customDataPointContainer,{height:dataPointsHeight,width:dataPointsWidth,top:containerHeight-item.value*containerHeight/maxValue,left:getX(index)-dataPointsWidth}],children:customDataPoint()}):null,dataPointsShape==='rectangular'?(0,_jsxRuntime.jsx)(_react.Fragment,{children:customDataPoint?null:(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{x:getX(index)-dataPointsWidth,y:extendedContainerHeight+dataPointsHeight/2-item.value*containerHeight/maxValue,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:getY(index),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,{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:dataPointLabelComponent()}):null:text||item.dataPointText?!showTextOnFocus||index===selectedIndex?(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{fill:item.textColor||textColor,fontSize:item.textFontSize||textFontSize,x:initialSpacing-dataPointsWidth+spacing*index+(item.textShiftX||props.textShiftX||0),y:extendedContainerHeight-dataPointsHeight/2-item.value*containerHeight/maxValue+(item.textShiftY||props.textShiftY||0),children:!showTextOnFocus?item.dataPointText:text}):null:null]},index);});};var renderSpecificVerticalLines=function renderSpecificVerticalLines(dataForRender){return dataForRender.map(function(item,index){if(item.showVerticalLine){return(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{x:initialSpacing-(item.verticalLineThickness||1)/2-1+spacing*index,y:item.verticalLineUptoDataPoint?containerHeight-item.value*containerHeight/maxValue+10:-xAxisThickness,width:item.verticalLineThickness||1,height:item.verticalLineUptoDataPoint?item.value*containerHeight/maxValue-xAxisThickness:containerHeight+10-xAxisThickness,fill:item.verticalLineColor||'lightgray'},index);}return null;});};var lineSvgComponent=function lineSvgComponent(pointsArray,currentLineThickness,color,startFillColor,endFillColor,startOpacity,endOpacity,strokeDashArray){return(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[strokeDashArray&&strokeDashArray.length===2&&typeof strokeDashArray[0]==='number'&&typeof strokeDashArray[1]==='number'?pointsArray.map(function(points,index){return(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:points.points,fill:"none",stroke:points.color==='green'?color:colorNegative,strokeWidth:currentLineThickness||thickness,strokeDasharray:strokeDashArray},index);}):pointsArray.map(function(points,index){return(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:points.points,fill:"none",stroke:points.color==='green'?color:colorNegative,strokeWidth:currentLineThickness||thickness},index);}),areaChart&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(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()})]}),(0,_jsxRuntime.jsxs)(_reactNativeSvg.LinearGradient,{id:"GradientNegative",x1:"0",y1:"0",x2:gradientDirection==='horizontal'?'1':'0',y2:gradientDirection==='vertical'?'1':'0',children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Stop,{offset:"1",stopColor:startFillColorNegative,stopOpacity:startOpacityNegative.toString()}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Stop,{offset:"0",stopColor:endFillColorNegative,stopOpacity:endOpacityNegative.toString()})]})]}),areaChart?fillPointsArray.map(function(item,index){return(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:item.points,fill:item.color==='green'?'url(#Gradient)':'url(#GradientNegative)',stroke:'transparent',strokeWidth:currentLineThickness||thickness},index);}):null,renderSpecificVerticalLines(data),!hideDataPoints1?renderDataPoints(data,dataPointsShape1,dataPointsWidth1,dataPointsHeight1,dataPointsColor1,dataPointsRadius1,textColor1,textFontSize1,startIndex1,endIndex1):null]});};var renderLine=function renderLine(zIndex,pointsArray,currentLineThickness,color,startFillColor,endFillColor,startOpacity,endOpacity,strokeDashArray){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',height:extendedContainerHeight+noOfSectionsBelowXAxis*stepHeight,bottom:60+labelsExtraHeight,width:totalWidth,zIndex:zIndex},children:pointsArray.length?lineSvgComponent(pointsArray,currentLineThickness,color,startFillColor,endFillColor,startOpacity,endOpacity,strokeDashArray):null});};var renderAnimatedLine=function renderAnimatedLine(zIndex,points,animatedWidth,currentLineThickness,color,startFillColor,endFillColor,startOpacity,endOpacity,strokeDashArray){return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{position:'absolute',height:extendedContainerHeight+noOfSectionsBelowXAxis*stepHeight,bottom:60,width:animatedWidth,zIndex:zIndex},children:lineSvgComponent(points,currentLineThickness,color,startFillColor,endFillColor,startOpacity,endOpacity,strokeDashArray)});};var renderChartContent=function renderChartContent(){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[isAnimated?renderAnimatedLine(zIndex,pointsArray,animatedWidth,thickness1,color,startFillColor,endFillColor,startOpacity,endOpacity,strokeDashArray1):renderLine(zIndex,pointsArray,thickness1,color,startFillColor,endFillColor,startOpacity,endOpacity,strokeDashArray1),data.map(function(item,index){return(0,_jsxRuntime.jsx)(_reactNative.View,{children:isAnimated?renderAnimatedLabel(index,item.label||(props.xAxisLabelTexts&&props.xAxisLabelTexts[index]?props.xAxisLabelTexts[index]:''),item.labelTextStyle||props.xAxisLabelTextStyle,item.labelComponent):renderLabel(index,item.label||(props.xAxisLabelTexts&&props.xAxisLabelTexts[index]?props.xAxisLabelTexts[index]:''),item.labelTextStyle||props.xAxisLabelTextStyle,item.labelComponent)},index);})]});};return(0,_jsxRuntime.jsx)(_BarAndLineChartsWrapper.default,Object.assign({},barAndLineChartsWrapperProps,{scrollRef:scrollRef,animatedWidth:animatedWidth,renderChartContent:renderChartContent,remainingScrollViewProps:{onScroll:function onScroll(ev){return props.onScroll==null?void 0:props.onScroll(ev);}}}));};
|
|
@@ -0,0 +1 @@
|
|
|
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}));};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var styles=exports.styles=_reactNative.StyleSheet.create({container:{width:'100%',marginBottom:40,marginRight:40},horizBar:{flexDirection:'row'},leftLabel:{justifyContent:'center',alignItems:'center'},lastLeftLabel:{justifyContent:'center',alignItems:'center'},leftPart:{justifyContent:'center'},lastLeftPart:{justifyContent:'flex-end'},line:{width:'100%',height:1,backgroundColor:'gray',opacity:0.5},lastLine:{width:'100%',height:1,backgroundColor:'black'},bottomLabel:{width:'100%'},customDataPointContainer:{position:'absolute',justifyContent:'center',alignItems:'center'}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.PieChart=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _main=require("./main");var _giftedChartsCore=require("gifted-charts-core");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/PieChart/index.tsx";var PieChart=exports.PieChart=function PieChart(props){var _usePieChart=(0,_giftedChartsCore.usePieChart)(props),radius=_usePieChart.radius,extraRadiusForFocused=_usePieChart.extraRadiusForFocused,selectedIndex=_usePieChart.selectedIndex,setSelectedIndex=_usePieChart.setSelectedIndex,startAngle=_usePieChart.startAngle,total=_usePieChart.total,donut=_usePieChart.donut,isThreeD=_usePieChart.isThreeD,semiCircle=_usePieChart.semiCircle,inwardExtraLengthForFocused=_usePieChart.inwardExtraLengthForFocused,canvasWidth=_usePieChart.canvasWidth,canvasHeight=_usePieChart.canvasHeight,innerRadius=_usePieChart.innerRadius,innerCircleColor=_usePieChart.innerCircleColor,innerCircleBorderWidth=_usePieChart.innerCircleBorderWidth,innerCircleBorderColor=_usePieChart.innerCircleBorderColor,shiftInnerCenterX=_usePieChart.shiftInnerCenterX,shiftInnerCenterY=_usePieChart.shiftInnerCenterY,tiltAngle=_usePieChart.tiltAngle,isDataShifted=_usePieChart.isDataShifted,paddingHorizontal=_usePieChart.paddingHorizontal,paddingVertical=_usePieChart.paddingVertical;var renderInnerCircle=function renderInnerCircle(innerRadius,innerCircleBorderWidth){if(props.centerLabelComponent||donut&&!isDataShifted){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{height:innerRadius*2,width:innerRadius*2,borderRadius:innerRadius,position:'absolute',alignSelf:'center',backgroundColor:innerCircleColor,left:canvasWidth/2-innerRadius+shiftInnerCenterX+extraRadiusForFocused+paddingHorizontal/2,top:canvasHeight/2-innerRadius+shiftInnerCenterY+extraRadiusForFocused+paddingVertical/2,borderWidth:innerCircleBorderWidth,borderColor:innerCircleBorderColor,justifyContent:'center',alignItems:'center'},isThreeD&&{borderTopWidth:innerCircleBorderWidth*5,borderLeftWidth:shiftInnerCenterX?innerCircleBorderWidth*2:innerCircleBorderWidth,transform:[{rotateX:tiltAngle}]},semiCircle&&isThreeD&&{borderTopWidth:isThreeD?innerCircleBorderWidth*5:innerCircleBorderWidth,borderLeftWidth:0.5,borderLeftColor:innerCircleColor,borderBottomWidth:0,borderRightWidth:0.5,borderRightColor:innerCircleColor}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:semiCircle?-0.5*innerRadius:0},children:props.centerLabelComponent?props.centerLabelComponent():null})});}return null;};if(!total)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{height:(radius+extraRadiusForFocused+paddingVertical/2)*(props.semiCircle?1:2),width:(radius+extraRadiusForFocused+paddingHorizontal/2)*2,overflow:'hidden'},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute'},children:(0,_jsxRuntime.jsx)(_main.PieChartMain,Object.assign({},props,{selectedIndex:selectedIndex,setSelectedIndex:setSelectedIndex,paddingHorizontal:paddingHorizontal,paddingVertical:paddingVertical,extraRadiusForFocused:extraRadiusForFocused}))}),renderInnerCircle(innerRadius,innerCircleBorderWidth),props.data.length>1&&props.data[selectedIndex]&&(props.focusOnPress||props.sectionAutoFocus)&&selectedIndex!==-1&&(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"box-none",style:{position:'absolute',top:-extraRadiusForFocused,left:-extraRadiusForFocused},children:(0,_jsxRuntime.jsx)(_main.PieChartMain,Object.assign({},props,{data:[{value:props.data[selectedIndex].value,text:props.data[selectedIndex].text,color:props.data[selectedIndex].color||_giftedChartsCore.pieColors[selectedIndex%9],strokeColor:props.data[selectedIndex].strokeColor||undefined,strokeWidth:props.data[selectedIndex].strokeWidth||undefined,gradientCenterColor:props.data[selectedIndex].gradientCenterColor||undefined,shiftTextX:props.data[selectedIndex].shiftTextX||undefined,shiftTextY:props.data[selectedIndex].shiftTextY||undefined},{value:total-props.data[selectedIndex].value,onPress:function onPress(){return alert('black');},peripheral:true,strokeWidth:0}],radius:radius+extraRadiusForFocused,initialAngle:startAngle,innerRadius:props.innerRadius||radius/2.5,isBiggerPie:true,setSelectedIndex:setSelectedIndex,paddingHorizontal:paddingHorizontal,paddingVertical:paddingVertical,extraRadiusForFocused:extraRadiusForFocused}))}),renderInnerCircle(innerRadius-inwardExtraLengthForFocused,inwardExtraLengthForFocused?0:innerCircleBorderWidth)]});};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.PieChartMain=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _giftedChartsCore=require("gifted-charts-core");var _utils=require("../utils");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/PieChart/main.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 PieChartMain=exports.PieChartMain=function PieChartMain(props){var _getPieChartMainProps=(0,_giftedChartsCore.getPieChartMainProps)(props),isThreeD=_getPieChartMainProps.isThreeD,isBiggerPie=_getPieChartMainProps.isBiggerPie,data=_getPieChartMainProps.data,showInnerComponent=_getPieChartMainProps.showInnerComponent,radius=_getPieChartMainProps.radius,canvasWidth=_getPieChartMainProps.canvasWidth,canvasHeight=_getPieChartMainProps.canvasHeight,shadowWidth=_getPieChartMainProps.shadowWidth,backgroundColor=_getPieChartMainProps.backgroundColor,shadowColor=_getPieChartMainProps.shadowColor,semiCircle=_getPieChartMainProps.semiCircle,pi=_getPieChartMainProps.pi,initialAngle=_getPieChartMainProps.initialAngle,shadow=_getPieChartMainProps.shadow,donut=_getPieChartMainProps.donut,strokeWidth=_getPieChartMainProps.strokeWidth,strokeColor=_getPieChartMainProps.strokeColor,innerRadius=_getPieChartMainProps.innerRadius,showText=_getPieChartMainProps.showText,textColor=_getPieChartMainProps.textColor,textSize=_getPieChartMainProps.textSize,tiltAngle=_getPieChartMainProps.tiltAngle,labelsPosition=_getPieChartMainProps.labelsPosition,showTextBackground=_getPieChartMainProps.showTextBackground,textBackgroundColor=_getPieChartMainProps.textBackgroundColor,showValuesAsLabels=_getPieChartMainProps.showValuesAsLabels,showGradient=_getPieChartMainProps.showGradient,gradientCenterColor=_getPieChartMainProps.gradientCenterColor,toggleFocusOnPress=_getPieChartMainProps.toggleFocusOnPress,minShiftX=_getPieChartMainProps.minShiftX,minShiftY=_getPieChartMainProps.minShiftY,total=_getPieChartMainProps.total,horizAdjustment=_getPieChartMainProps.horizAdjustment,vertAdjustment=_getPieChartMainProps.vertAdjustment,cx=_getPieChartMainProps.cx,cy=_getPieChartMainProps.cy,pData=_getPieChartMainProps.pData,mData=_getPieChartMainProps.mData,paddingHorizontal=_getPieChartMainProps.paddingHorizontal,paddingVertical=_getPieChartMainProps.paddingVertical,extraRadiusForFocused=_getPieChartMainProps.extraRadiusForFocused;return(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"box-none",style:[{backgroundColor:backgroundColor,height:semiCircle?(canvasHeight+paddingVertical)/2+extraRadiusForFocused:canvasHeight+paddingVertical+extraRadiusForFocused*2,width:canvasWidth+paddingHorizontal+extraRadiusForFocused*2,overflow:'hidden'},isThreeD&&{transform:[{rotateX:tiltAngle}]}],children:[(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{pointerEvents:_utils.rnVersion>=720000?'box-none':'auto',viewBox:`${strokeWidth/-2+minShiftX-extraRadiusForFocused-paddingHorizontal/2} ${strokeWidth/-2+minShiftY-extraRadiusForFocused-paddingVertical/2} ${(radius+extraRadiusForFocused+strokeWidth)*2+paddingHorizontal+horizAdjustment+(horizAdjustment?strokeWidth:0)} ${(radius+extraRadiusForFocused+strokeWidth)*2+paddingVertical+vertAdjustment+(vertAdjustment?strokeWidth:0)}`,height:(radius+extraRadiusForFocused)*2+strokeWidth+paddingVertical,width:(radius+extraRadiusForFocused)*2+strokeWidth+paddingHorizontal,children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Defs,{children:data.map(function(item,index){return(0,_jsxRuntime.jsxs)(_reactNativeSvg.RadialGradient,{id:'grad'+index,cx:"50%",cy:"50%",rx:"50%",ry:"50%",fx:"50%",fy:"50%",gradientUnits:"userSpaceOnUse",children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Stop,{offset:"0%",stopColor:item.gradientCenterColor||gradientCenterColor,stopOpacity:"1"}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Stop,{offset:"100%",stopColor:item.color||_giftedChartsCore.pieColors[index%9],stopOpacity:"1"})]},index+'');})}),data.length===1?(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Circle,{cx:cx,cy:cy,r:radius,fill:showGradient?`url(#grad${0})`:data[0].color||_giftedChartsCore.pieColors[0%9],onPress:function onPress(){data[0].onPress?data[0].onPress():props.onPress?props.onPress(data[0],0):null;}})}):data.map(function(item,index){var nextItem;if(index===pData.length-1)nextItem=pData[0];else nextItem=pData[index+1];var sx=cx*(1+Math.sin(2*pi*pData[index]+initialAngle))+(item.shiftX||0);var sy=cy*(1-Math.cos(2*pi*pData[index]+initialAngle))+(item.shiftY||0);var ax=cx*(1+Math.sin(2*pi*nextItem+initialAngle))+(item.shiftX||0);var ay=cy*(1-Math.cos(2*pi*nextItem+initialAngle))+(item.shiftY||0);if(isBiggerPie&&index)return null;return(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:`M ${cx+(item.shiftX||0)} ${cy+(item.shiftY||0)} L ${sx} ${sy} A ${radius} ${radius} 0 ${semiCircle?0:data[index].value>total/2?1:0} 1 ${ax} ${ay} L ${cx+(item.shiftX||0)} ${cy+(item.shiftY||0)}`,stroke:item.strokeColor||strokeColor,strokeWidth:props.focusOnPress&&props.selectedIndex===index?0:item.strokeWidth===0?0:item.strokeWidth||strokeWidth,fill:props.selectedIndex===index||item.peripheral?'transparent':showGradient?`url(#grad${index})`:item.color||_giftedChartsCore.pieColors[index%9],onPress:function onPress(){if(item.onPress){item.onPress();}else if(props.onPress){props.onPress(item,index);}if(props.focusOnPress){if(props.selectedIndex===index||props.isBiggerPie){if(toggleFocusOnPress){props.setSelectedIndex(-1);}}else{props.setSelectedIndex(index);}}}},index+'a');}),(showText||showInnerComponent)&&data.map(function(item,index){var _item$pieInnerCompone,_ref,_item$shiftTextBackgr,_ref2,_item$shiftTextBackgr2,_localPieInnerCompone;var localPieInnerComponent=(_item$pieInnerCompone=item.pieInnerComponent)!=null?_item$pieInnerCompone:props.pieInnerComponent;if(isBiggerPie&&index)return null;if(!props.data[index].value)return null;var mx=cx*(1+Math.sin(2*pi*mData[index]+initialAngle));var my=cy*(1-Math.cos(2*pi*mData[index]+initialAngle));var midx=(mx+cx)/2;var midy=(my+cy)/2;var x=midx,y=midy;var labelPosition=item.labelPosition||labelsPosition;if(labelPosition==='onBorder'){x=mx;y=my;}else if(labelPosition==='outward'){x=(midx+mx)/2;y=(midy+my)/2;}else if(labelPosition==='inward'){x=(midx+cx)/2;y=(midy+cy)/2;}x+=item.shiftX||0;y+=item.shiftY||0;if(data.length===1){if(donut){y=(radius-innerRadius+(item.textBackgroundRadius||props.textBackgroundRadius||item.textSize||textSize))/2;}else{y=cy;}}return(0,_jsxRuntime.jsxs)(_react.default.Fragment,{children:[showTextBackground?(0,_jsxRuntime.jsx)(_reactNativeSvg.Circle,{cx:x+((_ref=(_item$shiftTextBackgr=item.shiftTextBackgroundX)!=null?_item$shiftTextBackgr:item.shiftTextX)!=null?_ref:0),cy:y+((_ref2=(_item$shiftTextBackgr2=item.shiftTextBackgroundY)!=null?_item$shiftTextBackgr2:item.shiftTextY)!=null?_ref2:0)-(item.textSize||textSize)/4,r:item.textBackgroundRadius||props.textBackgroundRadius||item.textSize||textSize,fill:item.textBackgroundColor||textBackgroundColor,onPress:function onPress(){item.onLabelPress?item.onLabelPress():props.onLabelPress?props.onLabelPress(item,index):item.onPress?item.onPress():props.onPress?props.onPress(item,index):null;if(props.focusOnPress){if(props.selectedIndex===index){if(toggleFocusOnPress){props.setSelectedIndex(-1);}}else{props.setSelectedIndex(index);}}}}):null,(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{fill:item.textColor||textColor||_giftedChartsCore.pieColors[(index+2)%9],fontSize:item.textSize||textSize,fontFamily:item.font||props.font,fontWeight:item.fontWeight||props.fontWeight,fontStyle:item.fontStyle||props.fontStyle||'normal',x:x+(item.shiftTextX||0)-(item.textSize||textSize)/1.8,y:y+(item.shiftTextY||0),onPress:function onPress(){item.onLabelPress?item.onLabelPress():props.onLabelPress?props.onLabelPress(item,index):item.onPress?item.onPress():props.onPress?props.onPress(item,index):null;if(props.focusOnPress){if(props.selectedIndex===index){if(toggleFocusOnPress){props.setSelectedIndex(-1);}}else{props.setSelectedIndex(index);}}},children:item.text||(showValuesAsLabels?item.value+'':'')}),localPieInnerComponent?(0,_jsxRuntime.jsx)(_reactNativeSvg.G,{x:x,y:y,children:(_localPieInnerCompone=localPieInnerComponent==null?void 0:localPieInnerComponent(item,index))!=null?_localPieInnerCompone:null}):null]},index);})]}),isThreeD&&shadow&&!semiCircle?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:radius*2,height:radius*2,backgroundColor:shadowColor,borderRadius:radius,position:'absolute',top:shadowWidth+paddingVertical/2,left:paddingHorizontal/2,zIndex:-1}}):null]});};
|