react-native-gifted-charts 1.4.11 → 1.4.12

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.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/dist/BarChart/Animated2DWithGradient.js +1 -0
  3. package/dist/BarChart/RenderBars.js +1 -0
  4. package/dist/BarChart/RenderStackBars.js +1 -0
  5. package/dist/BarChart/index.js +1 -0
  6. package/dist/BarChart/styles.js +1 -0
  7. package/dist/Components/AnimatedThreeDBar/index.js +1 -0
  8. package/dist/Components/AnimatedThreeDBar/styles.js +1 -0
  9. package/dist/Components/BarAndLineChartsWrapper/index.js +1 -0
  10. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +1 -0
  11. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +1 -0
  12. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +1 -0
  13. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +1 -0
  14. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +1 -0
  15. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +1 -0
  16. package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +1 -0
  17. package/dist/Components/BarSpecificComponents/cap.js +1 -0
  18. package/dist/Components/common/LinearGradient.js +1 -0
  19. package/dist/Components/common/Pointer.js +1 -0
  20. package/dist/Components/common/StripAndLabel.js +1 -0
  21. package/dist/Components/lineSvg.js +1 -0
  22. package/dist/LineChart/LineChartBicolor.js +1 -0
  23. package/dist/LineChart/index.js +1 -0
  24. package/dist/LineChart/styles.js +1 -0
  25. package/dist/PieChart/index.js +1 -0
  26. package/dist/PieChart/main.js +1 -0
  27. package/dist/PieChartPro/index.js +1 -0
  28. package/dist/PopulationPyramid/index.js +1 -0
  29. package/dist/index.js +1 -0
  30. package/dist/utils/index.js +1 -0
  31. package/package.json +10 -5
  32. package/src/BarChart/Animated2DWithGradient.tsx +0 -197
  33. package/src/BarChart/RenderBars.tsx +0 -454
  34. package/src/BarChart/RenderStackBars.tsx +0 -383
  35. package/src/BarChart/index.tsx +0 -373
  36. package/src/BarChart/styles.tsx +0 -47
  37. package/src/Components/AnimatedThreeDBar/index.tsx +0 -258
  38. package/src/Components/AnimatedThreeDBar/styles.tsx +0 -14
  39. package/src/Components/BarAndLineChartsWrapper/index.tsx +0 -244
  40. package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +0 -590
  41. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.tsx +0 -147
  42. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.tsx +0 -157
  43. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.tsx +0 -86
  44. package/src/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.tsx +0 -42
  45. package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +0 -131
  46. package/src/Components/BarSpecificComponents/barBackgroundPattern.tsx +0 -30
  47. package/src/Components/BarSpecificComponents/cap.tsx +0 -34
  48. package/src/Components/common/LinearGradient.tsx +0 -27
  49. package/src/Components/common/Pointer.tsx +0 -37
  50. package/src/Components/common/StripAndLabel.tsx +0 -98
  51. package/src/Components/lineSvg.tsx +0 -42
  52. package/src/LineChart/LineChartBicolor.tsx +0 -740
  53. package/src/LineChart/index.tsx +0 -2156
  54. package/src/LineChart/styles.tsx +0 -47
  55. package/src/PieChart/index.tsx +0 -165
  56. package/src/PieChart/main.tsx +0 -363
  57. package/src/PieChartPro/index.tsx +0 -267
  58. package/src/PopulationPyramid/index.tsx +0 -603
  59. package/src/index.tsx +0 -25
  60. package/src/todos.md +0 -23
  61. package/src/utils/index.ts +0 -16
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.PopulationPyramid=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _giftedChartsCore=require("gifted-charts-core");var _reactNativeSvg=require("react-native-svg");var _utils=require("../utils");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/PopulationPyramid/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 PopulationPyramid=exports.PopulationPyramid=function PopulationPyramid(props){var _ref8,_props$midAxisLeftCol,_ref9,_props$midAxisRightCo;var _usePopulationPyramid=(0,_giftedChartsCore.usePopulationPyramid)(Object.assign({},props,{screenWidth:_utils.screenWidth})),width=_usePopulationPyramid.width,verticalMarginBetweenBars=_usePopulationPyramid.verticalMarginBetweenBars,barsMapToYAxisSections=_usePopulationPyramid.barsMapToYAxisSections,data=_usePopulationPyramid.data,hideRules=_usePopulationPyramid.hideRules,yAxisColor=_usePopulationPyramid.yAxisColor,xAxisColor=_usePopulationPyramid.xAxisColor,xAxisThickness=_usePopulationPyramid.xAxisThickness,xAxisType=_usePopulationPyramid.xAxisType,xAxisNoOfSections=_usePopulationPyramid.xAxisNoOfSections,showXAxisIndices=_usePopulationPyramid.showXAxisIndices,showXAxisLabelTexts=_usePopulationPyramid.showXAxisLabelTexts,xAxisLabelShiftX=_usePopulationPyramid.xAxisLabelShiftX,xAxisLabelPrefix=_usePopulationPyramid.xAxisLabelPrefix,xAxisLabelSuffix=_usePopulationPyramid.xAxisLabelSuffix,formatXAxisLabels=_usePopulationPyramid.formatXAxisLabels,showVerticalLines=_usePopulationPyramid.showVerticalLines,showYAxisIndices=_usePopulationPyramid.showYAxisIndices,yAxisIndicesWidth=_usePopulationPyramid.yAxisIndicesWidth,yAxisIndicesHeight=_usePopulationPyramid.yAxisIndicesHeight,yAxisIndicesColor=_usePopulationPyramid.yAxisIndicesColor,yAxisLabelFontSize=_usePopulationPyramid.yAxisLabelFontSize,yAxisLabelFontStyle=_usePopulationPyramid.yAxisLabelFontStyle,yAxisLabelFontWeight=_usePopulationPyramid.yAxisLabelFontWeight,yAxisLabelFontFamily=_usePopulationPyramid.yAxisLabelFontFamily,yAxisLabelColor=_usePopulationPyramid.yAxisLabelColor,yAxisLabelTextMarginRight=_usePopulationPyramid.yAxisLabelTextMarginRight,yAxisLabelTexts=_usePopulationPyramid.yAxisLabelTexts,showValuesAsBarLabels=_usePopulationPyramid.showValuesAsBarLabels,rulesThickness=_usePopulationPyramid.rulesThickness,rulesColor=_usePopulationPyramid.rulesColor,rulesType=_usePopulationPyramid.rulesType,dashWidth=_usePopulationPyramid.dashWidth,dashGap=_usePopulationPyramid.dashGap,leftBarLabelWidth=_usePopulationPyramid.leftBarLabelWidth,leftBarLabelFontSize=_usePopulationPyramid.leftBarLabelFontSize,leftBarLabelColor=_usePopulationPyramid.leftBarLabelColor,leftBarLabelFontStyle=_usePopulationPyramid.leftBarLabelFontStyle,leftBarLabelFontWeight=_usePopulationPyramid.leftBarLabelFontWeight,leftBarLabelFontFamily=_usePopulationPyramid.leftBarLabelFontFamily,leftBarLabelPrefix=_usePopulationPyramid.leftBarLabelPrefix,leftBarLabelSuffix=_usePopulationPyramid.leftBarLabelSuffix,rightBarLabelFontSize=_usePopulationPyramid.rightBarLabelFontSize,rightBarLabelColor=_usePopulationPyramid.rightBarLabelColor,rightBarLabelFontStyle=_usePopulationPyramid.rightBarLabelFontStyle,rightBarLabelFontWeight=_usePopulationPyramid.rightBarLabelFontWeight,rightBarLabelFontFamily=_usePopulationPyramid.rightBarLabelFontFamily,rightBarLabelPrefix=_usePopulationPyramid.rightBarLabelPrefix,rightBarLabelSuffix=_usePopulationPyramid.rightBarLabelSuffix,formatBarLabels=_usePopulationPyramid.formatBarLabels,showMidAxis=_usePopulationPyramid.showMidAxis,midAxisLabelFontSize=_usePopulationPyramid.midAxisLabelFontSize,midAxisLabelColor=_usePopulationPyramid.midAxisLabelColor,midAxisLabelFontStyle=_usePopulationPyramid.midAxisLabelFontStyle,midAxisLabelFontWeight=_usePopulationPyramid.midAxisLabelFontWeight,midAxisLabelFontFamily=_usePopulationPyramid.midAxisLabelFontFamily,leftBarColor=_usePopulationPyramid.leftBarColor,rightBarColor=_usePopulationPyramid.rightBarColor,leftBarBorderColor=_usePopulationPyramid.leftBarBorderColor,rightBarBorderColor=_usePopulationPyramid.rightBarBorderColor,leftBarBorderWidth=_usePopulationPyramid.leftBarBorderWidth,rightBarBorderWidth=_usePopulationPyramid.rightBarBorderWidth,leftBarBorderRadius=_usePopulationPyramid.leftBarBorderRadius,rightBarBorderRadius=_usePopulationPyramid.rightBarBorderRadius,allCornersRounded=_usePopulationPyramid.allCornersRounded,showSurplus=_usePopulationPyramid.showSurplus,showSurplusLeft=_usePopulationPyramid.showSurplusLeft,showSurplusRight=_usePopulationPyramid.showSurplusRight,leftSurplusColor=_usePopulationPyramid.leftSurplusColor,leftSurplusBorderColor=_usePopulationPyramid.leftSurplusBorderColor,rightSurplusColor=_usePopulationPyramid.rightSurplusColor,rightSurplusBorderColor=_usePopulationPyramid.rightSurplusBorderColor,leftSurplusBorderWidth=_usePopulationPyramid.leftSurplusBorderWidth,rightSurplusBorderWidth=_usePopulationPyramid.rightSurplusBorderWidth,yAxisLabelWidth=_usePopulationPyramid.yAxisLabelWidth,noOfSections=_usePopulationPyramid.noOfSections,stepHeight=_usePopulationPyramid.stepHeight,containerHeightWithXaxisLabels=_usePopulationPyramid.containerHeightWithXaxisLabels,mid=_usePopulationPyramid.mid,barWidthFactor=_usePopulationPyramid.barWidthFactor,leftXAfterMid=_usePopulationPyramid.leftXAfterMid,rightXAfterMid=_usePopulationPyramid.rightXAfterMid,yAxisLineProps=_usePopulationPyramid.yAxisLineProps,midAxisLineCommonProps=_usePopulationPyramid.midAxisLineCommonProps,xAxisIndicesCommonProps=_usePopulationPyramid.xAxisIndicesCommonProps,verticalLinesCommonProps=_usePopulationPyramid.verticalLinesCommonProps,xAxisLabelsCommonProps=_usePopulationPyramid.xAxisLabelsCommonProps,getXLabel=_usePopulationPyramid.getXLabel;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:containerHeightWithXaxisLabels,width:width},children:(0,_jsxRuntime.jsxs)(_reactNativeSvg.Svg,{fill:'none',children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},yAxisLineProps)),Array.from(Array(noOfSections)).map(function(item,index){var _yAxisLabelTexts$inde;var isLast=index===noOfSections-1;var y=stepHeight*(index+1);var rulesProps={x1:yAxisLabelWidth,y1:y,x2:width,y2:y,stroke:isLast?xAxisColor:rulesColor,strokeWidth:isLast?xAxisThickness:rulesThickness};if(isLast&&xAxisType!==_giftedChartsCore.ruleTypes.SOLID||!isLast&&rulesType!==_giftedChartsCore.ruleTypes.SOLID){rulesProps.strokeDasharray=[dashWidth,dashGap];}else{delete rulesProps.strokeDasharray;}return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[!hideRules||isLast?(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},rulesProps)):null,showYAxisIndices?(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{x1:yAxisLabelWidth-yAxisIndicesWidth/2,y1:y,x2:yAxisLabelWidth+yAxisIndicesWidth/2,y2:y,stroke:yAxisIndicesColor,strokeWidth:yAxisIndicesHeight}):null,!barsMapToYAxisSections?(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{x:yAxisLabelWidth-yAxisLabelTextMarginRight,y:stepHeight*(index+0.5)+yAxisLabelFontSize/2-2,stroke:yAxisLabelColor,fontSize:yAxisLabelFontSize,fontStyle:yAxisLabelFontStyle,fontWeight:yAxisLabelFontWeight,fontFamily:yAxisLabelFontFamily,textAnchor:"end",children:(_yAxisLabelTexts$inde=yAxisLabelTexts[index])!=null?_yAxisLabelTexts$inde:''}):null]},'rule'+index);}),Array.from(Array(xAxisNoOfSections)).map(function(item,index){var x=leftXAfterMid-leftXAfterMid*index/xAxisNoOfSections;var unformattedXLabel=getXLabel(index);var xLabel=formatXAxisLabels?formatXAxisLabels(unformattedXLabel):unformattedXLabel;return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[showVerticalLines?(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},verticalLinesCommonProps,{x1:x,x2:x})):null,showXAxisIndices?(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},xAxisIndicesCommonProps,{x1:x,x2:x})):null,showXAxisLabelTexts?(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,Object.assign({},xAxisLabelsCommonProps,{x:x+xAxisLabelShiftX,textAnchor:"middle",children:xAxisLabelPrefix+xLabel+xAxisLabelSuffix})):null]},'x-axis'+index);}),Array.from(Array(xAxisNoOfSections)).map(function(item,index){if(!index&&!showMidAxis)return null;var x=leftXAfterMid+leftXAfterMid*index/xAxisNoOfSections;var unformattedXLabel=getXLabel(index);var xLabel=formatXAxisLabels?formatXAxisLabels(unformattedXLabel):unformattedXLabel;return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[showVerticalLines?(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},verticalLinesCommonProps,{x1:x,x2:x})):null,showXAxisIndices?(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},xAxisIndicesCommonProps,{x1:x,x2:x})):null,showXAxisLabelTexts?(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,Object.assign({},xAxisLabelsCommonProps,{x:x+xAxisLabelShiftX,textAnchor:"middle",children:xAxisLabelPrefix+xLabel+xAxisLabelSuffix})):null]},'x-axis'+index);}),data.map(function(item,index){var _ref,_item$leftBarBorderRa,_ref2,_item$rightBarBorderR,_ref3,_item$leftBarBorderWi,_ref4,_item$rightBarBorderW,_item$leftBarLabel,_item$rightBarLabel,_item$leftBarLabelFon,_ref5,_item$leftBarLabelShi,_ref6,_item$rightBarLabelSh,_ref7,_item$yAxisLabel,_item$leftBarColor,_item$leftBarBorderCo,_item$leftBarColor2,_item$leftBarBorderCo2,_item$leftBarBorderCo3,_item$leftBarLabelCol,_item$leftBarLabelFon2,_item$leftBarLabelFon3,_item$leftBarLabelFon4,_item$rightBarColor,_item$rightBarBorderC,_item$rightBarColor2,_item$rightBarBorderC2,_item$rightBarBorderC3,_item$rightBarLabelCo,_item$rightBarLabelFo,_item$rightBarLabelFo2,_item$rightBarLabelFo3,_item$rightBarLabelFo4,_item$leftSurplusBord,_item$leftSurplusBord2,_item$leftSurplusColo,_item$leftSurplusColo2,_item$rightSurplusBor,_item$rightSurplusBor2,_item$rightSurplusCol,_item$rightSurplusCol2;var leftWidth=item.left*barWidthFactor;var rightWidth=item.right*barWidthFactor;var y=stepHeight*index+verticalMarginBetweenBars;var leftSurplusWidth=leftWidth-rightWidth;var rightSurplusWidth=rightWidth-leftWidth;var leftRadius=(_ref=(_item$leftBarBorderRa=item.leftBarBorderRadius)!=null?_item$leftBarBorderRa:item.barBorderRadius)!=null?_ref:leftBarBorderRadius;var rightRadius=(_ref2=(_item$rightBarBorderR=item.rightBarBorderRadius)!=null?_item$rightBarBorderR:item.barBorderRadius)!=null?_ref2:rightBarBorderRadius;var leftBorderWidth=(_ref3=(_item$leftBarBorderWi=item.leftBarBorderWidth)!=null?_item$leftBarBorderWi:item.barBorderWidth)!=null?_ref3:leftBarBorderWidth;var rightBorderWidth=(_ref4=(_item$rightBarBorderW=item.rightBarBorderWidth)!=null?_item$rightBarBorderW:item.barBorderWidth)!=null?_ref4:rightBarBorderWidth;var unFormattedLeftBarLabel=(_item$leftBarLabel=item.leftBarLabel)!=null?_item$leftBarLabel:showValuesAsBarLabels?item.left.toString():'';var leftBarLabel=formatBarLabels?formatBarLabels(unFormattedLeftBarLabel):unFormattedLeftBarLabel;var unFormattedRightBarLabel=(_item$rightBarLabel=item.rightBarLabel)!=null?_item$rightBarLabel:showValuesAsBarLabels?item.right.toString():'';var rightBarLabel=formatBarLabels?formatBarLabels(unFormattedRightBarLabel):unFormattedRightBarLabel;var leftLabelFontSize=(_item$leftBarLabelFon=item.leftBarLabelFontSize)!=null?_item$leftBarLabelFon:leftBarLabelFontSize;var leftLabelX=leftXAfterMid-leftWidth-leftBarBorderWidth/2-yAxisLabelWidth/2-leftBarLabelWidth/2+28-leftBarLabel.length*leftLabelFontSize/2+((_ref5=(_item$leftBarLabelShi=item.leftBarLabelShift)!=null?_item$leftBarLabelShi:props.leftBarLabelShift)!=null?_ref5:0);var rightLabelX=rightXAfterMid+rightBarBorderWidth/2+rightWidth+3+((_ref6=(_item$rightBarLabelSh=item.rightBarLabelShift)!=null?_item$rightBarLabelSh:props.rightBarLabelShift)!=null?_ref6:0);var leftBarCommonProps={x:leftXAfterMid-leftWidth-leftBarBorderWidth/2,y:y,width:leftWidth,height:stepHeight-verticalMarginBetweenBars*2,rx:leftRadius,ry:leftRadius};var rightBarCommonProps={x:rightXAfterMid+rightBarBorderWidth/2,y:y,width:rightWidth,height:stepHeight-verticalMarginBetweenBars*2,rx:rightRadius,ry:rightRadius};return(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[barsMapToYAxisSections?(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{x:yAxisLabelWidth-yAxisLabelTextMarginRight,y:stepHeight*(index+0.5)+yAxisLabelFontSize/2-2,stroke:yAxisLabelColor,fontSize:yAxisLabelFontSize,fontStyle:yAxisLabelFontStyle,fontWeight:yAxisLabelFontWeight,fontFamily:yAxisLabelFontFamily,textAnchor:"end",children:(_ref7=(_item$yAxisLabel=item.yAxisLabel)!=null?_item$yAxisLabel:yAxisLabelTexts[index])!=null?_ref7:''}):null,(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,Object.assign({},leftBarCommonProps,{fill:(_item$leftBarColor=item.leftBarColor)!=null?_item$leftBarColor:leftBarColor,stroke:(_item$leftBarBorderCo=item.leftBarBorderColor)!=null?_item$leftBarBorderCo:leftBarBorderColor,strokeWidth:leftBorderWidth})),(0,_jsxRuntime.jsx)(_reactNativeSvg.ClipPath,{id:'cp-left'+index,children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,Object.assign({},leftBarCommonProps))}),!allCornersRounded&&leftWidth>=leftRadius?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{x:leftXAfterMid-leftRadius,y:y,width:leftRadius,height:stepHeight-verticalMarginBetweenBars*2,fill:(_item$leftBarColor2=item.leftBarColor)!=null?_item$leftBarColor2:leftBarColor}),leftBorderWidth?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{x1:leftXAfterMid-leftRadius,y1:y,x2:leftXAfterMid,y2:y,stroke:(_item$leftBarBorderCo2=item.leftBarBorderColor)!=null?_item$leftBarBorderCo2:leftBarBorderColor,strokeWidth:leftBorderWidth}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{x1:leftXAfterMid-leftRadius,y1:y+stepHeight-verticalMarginBetweenBars*2,x2:leftXAfterMid,y2:y+stepHeight-verticalMarginBetweenBars*2,stroke:(_item$leftBarBorderCo3=item.leftBarBorderColor)!=null?_item$leftBarBorderCo3:leftBarBorderColor,strokeWidth:leftBorderWidth})]}):null]}):null,leftBarLabel!==''?(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{x:leftLabelX,y:stepHeight*(index+0.5)+yAxisLabelFontSize/2-2,stroke:(_item$leftBarLabelCol=item.leftBarLabelColor)!=null?_item$leftBarLabelCol:leftBarLabelColor,fontSize:leftLabelFontSize,fontStyle:(_item$leftBarLabelFon2=item.leftBarLabelFontStyle)!=null?_item$leftBarLabelFon2:leftBarLabelFontStyle,fontWeight:(_item$leftBarLabelFon3=item.leftBarLabelFontWeight)!=null?_item$leftBarLabelFon3:leftBarLabelFontWeight,fontFamily:(_item$leftBarLabelFon4=item.leftBarLabelFontFamily)!=null?_item$leftBarLabelFon4:leftBarLabelFontFamily,textAnchor:"start",children:leftBarLabelPrefix+leftBarLabel+leftBarLabelSuffix}):null,(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,Object.assign({},rightBarCommonProps,{fill:(_item$rightBarColor=item.rightBarColor)!=null?_item$rightBarColor:rightBarColor,stroke:(_item$rightBarBorderC=item.rightBarBorderColor)!=null?_item$rightBarBorderC:rightBarBorderColor,strokeWidth:rightBorderWidth})),(0,_jsxRuntime.jsx)(_reactNativeSvg.ClipPath,{id:'cp-right'+index,children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,Object.assign({},rightBarCommonProps))}),!allCornersRounded&&rightWidth>=rightRadius?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{x:rightXAfterMid,y:y,width:rightRadius,height:stepHeight-verticalMarginBetweenBars*2,fill:(_item$rightBarColor2=item.rightBarColor)!=null?_item$rightBarColor2:rightBarColor}),rightBorderWidth?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{x1:rightXAfterMid,y1:y,x2:rightXAfterMid+rightRadius,y2:y,stroke:(_item$rightBarBorderC2=item.rightBarBorderColor)!=null?_item$rightBarBorderC2:rightBarBorderColor,strokeWidth:rightBorderWidth}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{x1:rightXAfterMid,y1:y+stepHeight-verticalMarginBetweenBars*2,x2:rightXAfterMid+rightRadius,y2:y+stepHeight-verticalMarginBetweenBars*2,stroke:(_item$rightBarBorderC3=item.rightBarBorderColor)!=null?_item$rightBarBorderC3:rightBarBorderColor,strokeWidth:rightBorderWidth})]}):null]}):null,rightBarLabel!==''?(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{x:rightLabelX,y:stepHeight*(index+0.5)+yAxisLabelFontSize/2-2,stroke:(_item$rightBarLabelCo=item.rightBarLabelColor)!=null?_item$rightBarLabelCo:rightBarLabelColor,fontSize:(_item$rightBarLabelFo=item.rightBarLabelFontSize)!=null?_item$rightBarLabelFo:rightBarLabelFontSize,fontStyle:(_item$rightBarLabelFo2=item.rightBarLabelFontStyle)!=null?_item$rightBarLabelFo2:rightBarLabelFontStyle,fontWeight:(_item$rightBarLabelFo3=item.rightBarLabelFontWeight)!=null?_item$rightBarLabelFo3:rightBarLabelFontWeight,fontFamily:(_item$rightBarLabelFo4=item.rightBarLabelFontFamily)!=null?_item$rightBarLabelFo4:rightBarLabelFontFamily,textAnchor:"start",children:rightBarLabelPrefix+rightBarLabel+rightBarLabelSuffix}):null,(showSurplus||showSurplusLeft||item.showSurplus||item.showSurplusLeft)&&leftSurplusWidth>0?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{id:'l-spls'+index,x:leftXAfterMid-leftWidth-leftBarBorderWidth/2,y:y,width:leftSurplusWidth,height:stepHeight-verticalMarginBetweenBars*2,stroke:(_item$leftSurplusBord=item.leftSurplusBorderColor)!=null?_item$leftSurplusBord:leftSurplusBorderColor,strokeWidth:(_item$leftSurplusBord2=item.leftSurplusBorderWidth)!=null?_item$leftSurplusBord2:leftSurplusBorderWidth}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Use,{fill:(_item$leftSurplusColo=item.leftSurplusColor)!=null?_item$leftSurplusColo:leftSurplusColor,clipPath:'#cp-left'+index,href:'#l-spls'+index}),leftSurplusWidth>=leftRadius?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{id:'hide-in-left'+index,x:leftXAfterMid-leftWidth-leftBarBorderWidth+leftSurplusWidth-leftRadius,y:y,width:leftRadius,height:stepHeight-verticalMarginBetweenBars*2}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Use,{fill:(_item$leftSurplusColo2=item.leftSurplusColor)!=null?_item$leftSurplusColo2:leftSurplusColor,clipPath:`url(#cp-left${index})`,href:'#hide-in-left'+index})]}):null]}):null,(showSurplus||showSurplusRight||item.showSurplus||item.showSurplusRight)&&rightSurplusWidth>0?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{id:'r-spls'+index,x:rightXAfterMid+rightBarBorderWidth/2+rightWidth-rightSurplusWidth,y:y,width:rightSurplusWidth,height:stepHeight-verticalMarginBetweenBars*2,stroke:(_item$rightSurplusBor=item.rightSurplusBorderColor)!=null?_item$rightSurplusBor:rightSurplusBorderColor,strokeWidth:(_item$rightSurplusBor2=item.rightSurplusBorderWidth)!=null?_item$rightSurplusBor2:rightSurplusBorderWidth}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Use,{fill:(_item$rightSurplusCol=item.rightSurplusColor)!=null?_item$rightSurplusCol:rightSurplusColor,clipPath:'#cp-right'+index,href:'#r-spls'+index}),rightSurplusWidth>=rightRadius?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{id:'hide-in-right'+index,x:rightXAfterMid+rightBarBorderWidth/2+rightWidth-rightSurplusWidth,y:y,width:rightRadius,height:stepHeight-verticalMarginBetweenBars*2}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Use,{fill:(_item$rightSurplusCol2=item.rightSurplusColor)!=null?_item$rightSurplusCol2:rightSurplusColor,clipPath:`url(#cp-right${index})`,href:'#hide-in-right'+index})]}):null]}):null]},'bars'+index);}),showMidAxis?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},midAxisLineCommonProps,{stroke:(_ref8=(_props$midAxisLeftCol=props.midAxisLeftColor)!=null?_props$midAxisLeftCol:props.midAxisColor)!=null?_ref8:yAxisColor,x1:leftXAfterMid,x2:leftXAfterMid})),(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,Object.assign({},midAxisLineCommonProps,{stroke:(_ref9=(_props$midAxisRightCo=props.midAxisRightColor)!=null?_props$midAxisRightCo:props.midAxisColor)!=null?_ref9:yAxisColor,x1:rightXAfterMid,x2:rightXAfterMid})),data.map(function(item,index){var _item$midAxisLabelCol,_item$midAxisLabelFon,_item$midAxisLabelFon2,_item$midAxisLabelFon3,_item$midAxisLabelFon4,_item$midAxisLabel;var y=stepHeight*(index+0.5);return(0,_jsxRuntime.jsx)(_reactNativeSvg.Text,{x:mid,y:y+midAxisLabelFontSize/2,stroke:(_item$midAxisLabelCol=item.midAxisLabelColor)!=null?_item$midAxisLabelCol:midAxisLabelColor,fontSize:(_item$midAxisLabelFon=item.midAxisLabelFontSize)!=null?_item$midAxisLabelFon:midAxisLabelFontSize,fontStyle:(_item$midAxisLabelFon2=item.midAxisLabelFontStyle)!=null?_item$midAxisLabelFon2:midAxisLabelFontStyle,fontWeight:(_item$midAxisLabelFon3=item.midAxisLabelFontWeight)!=null?_item$midAxisLabelFon3:midAxisLabelFontWeight,fontFamily:(_item$midAxisLabelFon4=item.midAxisLabelFontFamily)!=null?_item$midAxisLabelFon4:midAxisLabelFontFamily,textAnchor:"middle",children:(_item$midAxisLabel=item.midAxisLabel)!=null?_item$midAxisLabel:''},'ml'+index);})]}):null]})});};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BarChart",{enumerable:true,get:function get(){return _BarChart.BarChart;}});Object.defineProperty(exports,"BarChartPropsType",{enumerable:true,get:function get(){return _giftedChartsCore.BarChartPropsType;}});Object.defineProperty(exports,"EdgePosition",{enumerable:true,get:function get(){return _giftedChartsCore.EdgePosition;}});Object.defineProperty(exports,"LineChart",{enumerable:true,get:function get(){return _LineChart.LineChart;}});Object.defineProperty(exports,"LineChartBicolor",{enumerable:true,get:function get(){return _LineChartBicolor.LineChartBicolor;}});Object.defineProperty(exports,"LineChartBicolorPropsType",{enumerable:true,get:function get(){return _giftedChartsCore.LineChartBicolorPropsType;}});Object.defineProperty(exports,"LineChartPropsType",{enumerable:true,get:function get(){return _giftedChartsCore.LineChartPropsType;}});Object.defineProperty(exports,"PieChart",{enumerable:true,get:function get(){return _PieChart.PieChart;}});Object.defineProperty(exports,"PieChartPro",{enumerable:true,get:function get(){return _PieChartPro.PieChartPro;}});Object.defineProperty(exports,"PieChartPropsType",{enumerable:true,get:function get(){return _giftedChartsCore.PieChartPropsType;}});Object.defineProperty(exports,"PopulationPyramid",{enumerable:true,get:function get(){return _PopulationPyramid.PopulationPyramid;}});Object.defineProperty(exports,"PopulationPyramidPropsType",{enumerable:true,get:function get(){return _giftedChartsCore.PopulationPyramidPropsType;}});Object.defineProperty(exports,"StackedBarChartPropsType",{enumerable:true,get:function get(){return _giftedChartsCore.StackedBarChartPropsType;}});Object.defineProperty(exports,"barDataItem",{enumerable:true,get:function get(){return _giftedChartsCore.barDataItem;}});Object.defineProperty(exports,"bicolorLineDataItem",{enumerable:true,get:function get(){return _giftedChartsCore.bicolorLineDataItem;}});Object.defineProperty(exports,"chartTypes",{enumerable:true,get:function get(){return _giftedChartsCore.chartTypes;}});Object.defineProperty(exports,"lineDataItem",{enumerable:true,get:function get(){return _giftedChartsCore.lineDataItem;}});Object.defineProperty(exports,"pieDataItem",{enumerable:true,get:function get(){return _giftedChartsCore.pieDataItem;}});Object.defineProperty(exports,"popnPyramidDataItem",{enumerable:true,get:function get(){return _giftedChartsCore.popnPyramidDataItem;}});Object.defineProperty(exports,"ruleTypes",{enumerable:true,get:function get(){return _giftedChartsCore.ruleTypes;}});Object.defineProperty(exports,"stackDataItem",{enumerable:true,get:function get(){return _giftedChartsCore.stackDataItem;}});Object.defineProperty(exports,"yAxisSides",{enumerable:true,get:function get(){return _giftedChartsCore.yAxisSides;}});var _BarChart=require("./BarChart");var _PieChart=require("./PieChart");var _PieChartPro=require("./PieChartPro");var _LineChart=require("./LineChart");var _LineChartBicolor=require("./LineChart/LineChartBicolor");var _PopulationPyramid=require("./PopulationPyramid");var _giftedChartsCore=require("gifted-charts-core");
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.screenWidth=exports.rnVersion=void 0;var _reactNative=require("react-native");var _versionString$split;var versionString=require('react-native/package.json').version;var versionAr=(_versionString$split=versionString==null?void 0:versionString.split==null?void 0:versionString.split('.'))!=null?_versionString$split:'';var msb=Number(versionAr[0]);var mid=Number(versionAr[1]);var lsb=Number(versionAr[2]);var rnVersion=exports.rnVersion=(!isNaN(msb)?msb:0)*1000000+(!isNaN(mid)?mid:0)*10000+(!isNaN(lsb)?lsb:0);var screenWidth=exports.screenWidth=_reactNative.Dimensions.get('window').width;
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
- "main": "src/index.tsx",
5
+ "main": "dist/index.tsx",
6
6
  "files": [
7
- "src"
7
+ "dist"
8
8
  ],
9
9
  "scripts": {
10
10
  "android": "react-native run-android",
11
+ "build": "babel --extensions .ts,.tsx ./src -d ./dist",
11
12
  "ios": "react-native run-ios",
12
13
  "start": "react-native start",
13
14
  "test": "jest",
@@ -24,10 +25,14 @@
24
25
  "registry": "https://registry.npmjs.org/"
25
26
  },
26
27
  "dependencies": {
27
- "gifted-charts-core": "^0.1.7"
28
+ "gifted-charts-core": "^0.1.8"
28
29
  },
29
30
  "devDependencies": {
30
- "@babel/core": "^7.22.5",
31
+ "@babel/cli": "^7.24.7",
32
+ "@babel/core": "^7.24.7",
33
+ "@babel/preset-env": "^7.24.7",
34
+ "@babel/preset-react": "^7.24.7",
35
+ "@babel/preset-typescript": "^7.24.7",
31
36
  "@babel/runtime": "^7.22.5",
32
37
  "@react-native-community/eslint-config": "^3.2.0",
33
38
  "@types/jest": "^29.5.2",
@@ -1,197 +0,0 @@
1
- import React, {useEffect, useState} from 'react';
2
- import {View, LayoutAnimation, Platform, UIManager, Text} from 'react-native';
3
- import Svg, {Defs, Rect} from 'react-native-svg';
4
- import Cap from '../Components/BarSpecificComponents/cap';
5
- import LinearGradient from "../Components/common/LinearGradient";
6
- import {Animated2DWithGradientPropsType} from 'gifted-charts-core';
7
-
8
- if (Platform.OS === 'android') {
9
- UIManager.setLayoutAnimationEnabledExperimental &&
10
- UIManager.setLayoutAnimationEnabledExperimental(true);
11
- }
12
-
13
- const Animated2DWithGradient = (props: Animated2DWithGradientPropsType) => {
14
- const {
15
- barBackgroundPattern,
16
- patternId,
17
- barWidth,
18
- barStyle,
19
- item,
20
- index,
21
- opacity,
22
- animationDuration,
23
- noGradient,
24
- noAnimation,
25
- containerHeight,
26
- maxValue,
27
- barMarginBottom,
28
- barInnerComponent,
29
- intactTopLabel,
30
- showValuesAsTopLabel,
31
- topLabelContainerStyle,
32
- topLabelTextStyle,
33
- commonStyleForBar,
34
- barStyleWithBackground,
35
- yAxisOffset,
36
- } = props;
37
- const [height, setHeight] = useState(noAnimation ? props.height : 0.2);
38
- const [initialRender, setInitialRender] = useState(
39
- noAnimation ? false : true,
40
- );
41
-
42
- useEffect(() => {
43
- if (!noAnimation) {
44
- if (initialRender) {
45
- setTimeout(() => layoutAppear(), 20);
46
- } else {
47
- elevate();
48
- }
49
- }
50
- }, [props.height]);
51
-
52
- const elevate = () => {
53
- LayoutAnimation.configureNext({
54
- duration: animationDuration,
55
- update: {type: 'linear', property: 'scaleXY'},
56
- });
57
- setHeight(props.height);
58
- };
59
-
60
- const layoutAppear = () => {
61
- LayoutAnimation.configureNext({
62
- duration: Platform.OS == 'ios' ? animationDuration : 20,
63
- create: {type: 'linear', property: 'opacity'},
64
- update: {type: 'linear', property: 'scaleXY'},
65
- });
66
- setInitialRender(false);
67
- setTimeout(() => elevate(), Platform.OS == 'ios' ? 10 : 100);
68
- };
69
-
70
- return (
71
- <>
72
- {!initialRender && (
73
- <View
74
- style={{
75
- position: 'absolute',
76
- bottom: -0.5,
77
- width: '100%',
78
- overflow: 'hidden',
79
- height:
80
- (noAnimation
81
- ? Math.max(props.minHeight, Math.abs(height))
82
- : height) - (barMarginBottom || 0),
83
- }}>
84
- <View
85
- style={[
86
- {
87
- width: '100%',
88
- height:
89
- (noAnimation
90
- ? Math.max(props.minHeight, Math.abs(height))
91
- : height) - (barMarginBottom || 0),
92
- },
93
- item.barStyle || barStyle,
94
- ]}>
95
- {noGradient ? (
96
- <View style={barStyleWithBackground}>
97
- {props.cappedBars && item.value ? (
98
- <Cap
99
- capThicknessFromItem={item.capThickness}
100
- capThicknessFromProps={props.capThickness}
101
- capColorFromItem={item.capColor}
102
- capColorFromProps={props.capColor}
103
- capRadiusFromItem={item.capRadius}
104
- capRadiusFromProps={props.capRadius}
105
- />
106
- ) : null}
107
- </View>
108
- ) : (
109
- <LinearGradient
110
- style={commonStyleForBar}
111
- start={{x: 0, y: 0}}
112
- end={{x: 1, y: 1}}
113
- colors={[
114
- item.gradientColor || props.gradientColor || 'white',
115
- item.frontColor || props.frontColor || 'black',
116
- ]}>
117
- {props.cappedBars && (
118
- <View
119
- style={{
120
- position: 'absolute',
121
- width: '100%',
122
- height:
123
- item.capThickness === 0
124
- ? 0
125
- : item.capThickness || props.capThickness || 6,
126
- backgroundColor:
127
- item.capColor || props.capColor || 'black',
128
- borderTopLeftRadius:
129
- item.capRadius === 0
130
- ? 0
131
- : item.capRadius || props.capRadius || 0,
132
- borderTopRightRadius:
133
- item.capRadius === 0
134
- ? 0
135
- : item.capRadius || props.capRadius || 0,
136
- }}
137
- />
138
- )}
139
- </LinearGradient>
140
- )}
141
- {(item.barBackgroundPattern || barBackgroundPattern) && (
142
- <Svg>
143
- <Defs>
144
- {item.barBackgroundPattern
145
- ? item.barBackgroundPattern()
146
- : barBackgroundPattern?.()}
147
- </Defs>
148
- <Rect
149
- stroke="transparent"
150
- x="1"
151
- y="1"
152
- width={item.barWidth || props.barWidth || 30}
153
- height={noAnimation ? Math.abs(height) : height}
154
- fill={`url(#${item.patternId || patternId})`}
155
- />
156
- </Svg>
157
- )}
158
- {barInnerComponent ? (
159
- <View style={{height: '100%', width: '100%'}}>
160
- {barInnerComponent(item, index)}
161
- </View>
162
- ) : null}
163
- </View>
164
- </View>
165
- )}
166
- {item.topLabelComponent || showValuesAsTopLabel ? (
167
- <View
168
- style={[
169
- {
170
- position: 'absolute',
171
- top: (item.barWidth || barWidth || 30) * -1,
172
- height: item.barWidth || barWidth || 30,
173
- width: item.barWidth || barWidth || 30,
174
- justifyContent:
175
- (props.horizontal && !intactTopLabel) || item.value < 0
176
- ? 'center'
177
- : 'flex-end',
178
- alignItems: 'center',
179
- opacity: opacity,
180
- },
181
- item.value < 0 && {transform: [{rotate: '180deg'}]},
182
- props.horizontal &&
183
- !intactTopLabel && {transform: [{rotate: '270deg'}]},
184
- topLabelContainerStyle ?? item.topLabelContainerStyle,
185
- ]}>
186
- {showValuesAsTopLabel ? (
187
- <Text style={topLabelTextStyle}>{item.value + yAxisOffset}</Text>
188
- ) : (
189
- item.topLabelComponent?.()
190
- )}
191
- </View>
192
- ) : null}
193
- </>
194
- );
195
- };
196
-
197
- export default Animated2DWithGradient;