react-native-gifted-charts 1.4.21 → 1.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/BarChart/Animated2DWithGradient.d.ts +3 -0
  2. package/dist/BarChart/Animated2DWithGradient.js +113 -1
  3. package/dist/BarChart/RenderBars.d.ts +3 -0
  4. package/dist/BarChart/RenderBars.js +264 -1
  5. package/dist/BarChart/RenderStackBars.d.ts +3 -0
  6. package/dist/BarChart/RenderStackBars.js +174 -1
  7. package/dist/BarChart/index.d.ts +2 -0
  8. package/dist/BarChart/index.js +236 -1
  9. package/dist/BarChart/styles.d.ts +45 -0
  10. package/dist/BarChart/styles.js +46 -1
  11. package/dist/Components/AnimatedThreeDBar/index.d.ts +3 -0
  12. package/dist/Components/AnimatedThreeDBar/index.js +129 -1
  13. package/dist/Components/AnimatedThreeDBar/styles.d.ts +10 -0
  14. package/dist/Components/AnimatedThreeDBar/styles.js +13 -1
  15. package/dist/Components/BarAndLineChartsWrapper/index.d.ts +3 -0
  16. package/dist/Components/BarAndLineChartsWrapper/index.js +128 -1
  17. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.d.ts +2 -0
  18. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +322 -1
  19. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.d.ts +3 -0
  20. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +76 -1
  21. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.d.ts +2 -0
  22. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +50 -1
  23. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.d.ts +1 -0
  24. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +25 -1
  25. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.d.ts +1 -0
  26. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +20 -1
  27. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.d.ts +2 -0
  28. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +94 -1
  29. package/dist/Components/BarSpecificComponents/barBackgroundPattern.d.ts +2 -0
  30. package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +9 -1
  31. package/dist/Components/BarSpecificComponents/cap.d.ts +2 -0
  32. package/dist/Components/BarSpecificComponents/cap.js +16 -1
  33. package/dist/Components/BarSpecificComponents/tooltip.d.ts +15 -0
  34. package/dist/Components/BarSpecificComponents/tooltip.js +40 -1
  35. package/dist/Components/common/LinearGradient.d.ts +16 -0
  36. package/dist/Components/common/LinearGradient.js +15 -1
  37. package/dist/Components/common/Pointer.d.ts +1 -0
  38. package/dist/Components/common/Pointer.js +16 -1
  39. package/dist/Components/common/StripAndLabel.d.ts +2 -0
  40. package/dist/Components/common/StripAndLabel.js +43 -1
  41. package/dist/Components/lineSvg.d.ts +14 -0
  42. package/dist/Components/lineSvg.js +22 -1
  43. package/dist/LineChart/LineChartBicolor.d.ts +2 -0
  44. package/dist/LineChart/LineChartBicolor.js +294 -1
  45. package/dist/LineChart/index.d.ts +2 -0
  46. package/dist/LineChart/index.js +1110 -1
  47. package/dist/LineChart/previous.d.ts +2 -0
  48. package/dist/LineChart/previous.js +9 -0
  49. package/dist/LineChart/styles.d.ts +43 -0
  50. package/dist/LineChart/styles.js +46 -1
  51. package/dist/PieChart/index.d.ts +2 -0
  52. package/dist/PieChart/index.js +99 -1
  53. package/dist/PieChart/main.d.ts +2 -0
  54. package/dist/PieChart/main.js +182 -1
  55. package/dist/PieChartPro/index.d.ts +2 -0
  56. package/dist/PieChartPro/index.js +124 -1
  57. package/dist/PopulationPyramid/index.d.ts +2 -0
  58. package/dist/PopulationPyramid/index.js +130 -1
  59. package/dist/index.d.ts +7 -0
  60. package/dist/index.js +7 -1
  61. package/dist/utils/index.d.ts +3 -0
  62. package/dist/utils/index.js +20 -1
  63. package/package.json +3 -3
@@ -1 +1,130 @@
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]})});};
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { Fragment } from 'react';
14
+ import { View } from 'react-native';
15
+ import { ruleTypes, usePopulationPyramid, } from 'gifted-charts-core';
16
+ import { ClipPath, Line, Rect, Svg, Text as SvgText, Use, } from 'react-native-svg';
17
+ import { screenWidth } from '../utils';
18
+ export var PopulationPyramid = function (props) {
19
+ var _a, _b, _c, _d;
20
+ var _e = usePopulationPyramid(__assign(__assign({}, props), { screenWidth: screenWidth })), width = _e.width, verticalMarginBetweenBars = _e.verticalMarginBetweenBars, barsMapToYAxisSections = _e.barsMapToYAxisSections, data = _e.data, hideRules = _e.hideRules, yAxisColor = _e.yAxisColor, xAxisColor = _e.xAxisColor, xAxisThickness = _e.xAxisThickness, xAxisType = _e.xAxisType, xAxisNoOfSections = _e.xAxisNoOfSections, showXAxisIndices = _e.showXAxisIndices, showXAxisLabelTexts = _e.showXAxisLabelTexts, xAxisLabelShiftX = _e.xAxisLabelShiftX, xAxisLabelPrefix = _e.xAxisLabelPrefix, xAxisLabelSuffix = _e.xAxisLabelSuffix, formatXAxisLabels = _e.formatXAxisLabels, showVerticalLines = _e.showVerticalLines, showYAxisIndices = _e.showYAxisIndices, yAxisIndicesWidth = _e.yAxisIndicesWidth, yAxisIndicesHeight = _e.yAxisIndicesHeight, yAxisIndicesColor = _e.yAxisIndicesColor, yAxisLabelFontSize = _e.yAxisLabelFontSize, yAxisLabelFontStyle = _e.yAxisLabelFontStyle, yAxisLabelFontWeight = _e.yAxisLabelFontWeight, yAxisLabelFontFamily = _e.yAxisLabelFontFamily, yAxisLabelColor = _e.yAxisLabelColor, yAxisLabelTextMarginRight = _e.yAxisLabelTextMarginRight, yAxisLabelTexts = _e.yAxisLabelTexts, showValuesAsBarLabels = _e.showValuesAsBarLabels, rulesThickness = _e.rulesThickness, rulesColor = _e.rulesColor, rulesType = _e.rulesType, dashWidth = _e.dashWidth, dashGap = _e.dashGap, leftBarLabelWidth = _e.leftBarLabelWidth, leftBarLabelFontSize = _e.leftBarLabelFontSize, leftBarLabelColor = _e.leftBarLabelColor, leftBarLabelFontStyle = _e.leftBarLabelFontStyle, leftBarLabelFontWeight = _e.leftBarLabelFontWeight, leftBarLabelFontFamily = _e.leftBarLabelFontFamily, leftBarLabelPrefix = _e.leftBarLabelPrefix, leftBarLabelSuffix = _e.leftBarLabelSuffix, rightBarLabelFontSize = _e.rightBarLabelFontSize, rightBarLabelColor = _e.rightBarLabelColor, rightBarLabelFontStyle = _e.rightBarLabelFontStyle, rightBarLabelFontWeight = _e.rightBarLabelFontWeight, rightBarLabelFontFamily = _e.rightBarLabelFontFamily, rightBarLabelPrefix = _e.rightBarLabelPrefix, rightBarLabelSuffix = _e.rightBarLabelSuffix, formatBarLabels = _e.formatBarLabels, showMidAxis = _e.showMidAxis, midAxisLabelFontSize = _e.midAxisLabelFontSize, midAxisLabelColor = _e.midAxisLabelColor, midAxisLabelFontStyle = _e.midAxisLabelFontStyle, midAxisLabelFontWeight = _e.midAxisLabelFontWeight, midAxisLabelFontFamily = _e.midAxisLabelFontFamily, leftBarColor = _e.leftBarColor, rightBarColor = _e.rightBarColor, leftBarBorderColor = _e.leftBarBorderColor, rightBarBorderColor = _e.rightBarBorderColor, leftBarBorderWidth = _e.leftBarBorderWidth, rightBarBorderWidth = _e.rightBarBorderWidth, leftBarBorderRadius = _e.leftBarBorderRadius, rightBarBorderRadius = _e.rightBarBorderRadius, allCornersRounded = _e.allCornersRounded, showSurplus = _e.showSurplus, showSurplusLeft = _e.showSurplusLeft, showSurplusRight = _e.showSurplusRight, leftSurplusColor = _e.leftSurplusColor, leftSurplusBorderColor = _e.leftSurplusBorderColor, rightSurplusColor = _e.rightSurplusColor, rightSurplusBorderColor = _e.rightSurplusBorderColor, leftSurplusBorderWidth = _e.leftSurplusBorderWidth, rightSurplusBorderWidth = _e.rightSurplusBorderWidth, yAxisLabelWidth = _e.yAxisLabelWidth, noOfSections = _e.noOfSections, stepHeight = _e.stepHeight, containerHeightWithXaxisLabels = _e.containerHeightWithXaxisLabels, mid = _e.mid, barWidthFactor = _e.barWidthFactor, leftXAfterMid = _e.leftXAfterMid, rightXAfterMid = _e.rightXAfterMid, yAxisLineProps = _e.yAxisLineProps, midAxisLineCommonProps = _e.midAxisLineCommonProps, xAxisIndicesCommonProps = _e.xAxisIndicesCommonProps, verticalLinesCommonProps = _e.verticalLinesCommonProps, xAxisLabelsCommonProps = _e.xAxisLabelsCommonProps, getXLabel = _e.getXLabel;
21
+ return (_jsx(View, { style: { height: containerHeightWithXaxisLabels, width: width }, children: _jsxs(Svg, { fill: 'none', children: [_jsx(Line, __assign({}, yAxisLineProps)), Array.from(Array(noOfSections)).map(function (item, index) {
22
+ var _a;
23
+ var isLast = index === noOfSections - 1;
24
+ var y = stepHeight * (index + 1);
25
+ var rulesProps = {
26
+ x1: yAxisLabelWidth,
27
+ y1: y,
28
+ x2: width,
29
+ y2: y,
30
+ stroke: isLast ? xAxisColor : rulesColor,
31
+ strokeWidth: isLast ? xAxisThickness : rulesThickness,
32
+ };
33
+ if ((isLast && xAxisType !== ruleTypes.SOLID) ||
34
+ (!isLast && rulesType !== ruleTypes.SOLID)) {
35
+ rulesProps.strokeDasharray = [dashWidth, dashGap];
36
+ }
37
+ else {
38
+ delete rulesProps.strokeDasharray;
39
+ }
40
+ return (_jsxs(Fragment, { children: [!hideRules || isLast ? _jsx(Line, __assign({}, rulesProps)) : null, showYAxisIndices ? (_jsx(Line, { x1: yAxisLabelWidth - yAxisIndicesWidth / 2, y1: y, x2: yAxisLabelWidth + yAxisIndicesWidth / 2, y2: y, stroke: yAxisIndicesColor, strokeWidth: yAxisIndicesHeight })) : null, !barsMapToYAxisSections ? (_jsx(SvgText, { x: yAxisLabelWidth - yAxisLabelTextMarginRight, y: stepHeight * (index + 0.5) + yAxisLabelFontSize / 2 - 2, stroke: yAxisLabelColor, fontSize: yAxisLabelFontSize, fontStyle: yAxisLabelFontStyle, fontWeight: yAxisLabelFontWeight, fontFamily: yAxisLabelFontFamily, textAnchor: "end", children: (_a = yAxisLabelTexts[index]) !== null && _a !== void 0 ? _a : '' })) : null] }, 'rule' + index));
41
+ }), Array.from(Array(xAxisNoOfSections)).map(function (item, index) {
42
+ var x = leftXAfterMid - (leftXAfterMid * index) / xAxisNoOfSections;
43
+ var unformattedXLabel = getXLabel(index);
44
+ var xLabel = formatXAxisLabels
45
+ ? formatXAxisLabels(unformattedXLabel)
46
+ : unformattedXLabel;
47
+ return (_jsxs(Fragment, { children: [showVerticalLines ? (_jsx(Line, __assign({}, verticalLinesCommonProps, { x1: x, x2: x }))) : null, showXAxisIndices ? (_jsx(Line, __assign({}, xAxisIndicesCommonProps, { x1: x, x2: x }))) : null, showXAxisLabelTexts ? (_jsx(SvgText, __assign({}, xAxisLabelsCommonProps, { x: x + xAxisLabelShiftX, textAnchor: "middle", children: xAxisLabelPrefix + xLabel + xAxisLabelSuffix }))) : null] }, 'x-axis' + index));
48
+ }), Array.from(Array(xAxisNoOfSections)).map(function (item, index) {
49
+ if (!index && !showMidAxis)
50
+ return null;
51
+ var x = leftXAfterMid + (leftXAfterMid * index) / xAxisNoOfSections;
52
+ var unformattedXLabel = getXLabel(index);
53
+ var xLabel = formatXAxisLabels
54
+ ? formatXAxisLabels(unformattedXLabel)
55
+ : unformattedXLabel;
56
+ return (_jsxs(Fragment, { children: [showVerticalLines ? (_jsx(Line, __assign({}, verticalLinesCommonProps, { x1: x, x2: x }))) : null, showXAxisIndices ? (_jsx(Line, __assign({}, xAxisIndicesCommonProps, { x1: x, x2: x }))) : null, showXAxisLabelTexts ? (_jsx(SvgText, __assign({}, xAxisLabelsCommonProps, { x: x + xAxisLabelShiftX, textAnchor: "middle", children: xAxisLabelPrefix + xLabel + xAxisLabelSuffix }))) : null] }, 'x-axis' + index));
57
+ }), data.map(function (item, index) {
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
59
+ var leftWidth = item.left * barWidthFactor;
60
+ var rightWidth = item.right * barWidthFactor;
61
+ var y = stepHeight * index + verticalMarginBetweenBars;
62
+ var leftSurplusWidth = leftWidth - rightWidth;
63
+ var rightSurplusWidth = rightWidth - leftWidth;
64
+ var leftRadius = (_b = (_a = item.leftBarBorderRadius) !== null && _a !== void 0 ? _a : item.barBorderRadius) !== null && _b !== void 0 ? _b : leftBarBorderRadius;
65
+ var rightRadius = (_d = (_c = item.rightBarBorderRadius) !== null && _c !== void 0 ? _c : item.barBorderRadius) !== null && _d !== void 0 ? _d : rightBarBorderRadius;
66
+ var leftBorderWidth = (_f = (_e = item.leftBarBorderWidth) !== null && _e !== void 0 ? _e : item.barBorderWidth) !== null && _f !== void 0 ? _f : leftBarBorderWidth;
67
+ var rightBorderWidth = (_h = (_g = item.rightBarBorderWidth) !== null && _g !== void 0 ? _g : item.barBorderWidth) !== null && _h !== void 0 ? _h : rightBarBorderWidth;
68
+ var unFormattedLeftBarLabel = (_j = item.leftBarLabel) !== null && _j !== void 0 ? _j : (showValuesAsBarLabels ? item.left.toString() : '');
69
+ var leftBarLabel = formatBarLabels
70
+ ? formatBarLabels(unFormattedLeftBarLabel)
71
+ : unFormattedLeftBarLabel;
72
+ var unFormattedRightBarLabel = (_k = item.rightBarLabel) !== null && _k !== void 0 ? _k : (showValuesAsBarLabels ? item.right.toString() : '');
73
+ var rightBarLabel = formatBarLabels
74
+ ? formatBarLabels(unFormattedRightBarLabel)
75
+ : unFormattedRightBarLabel;
76
+ var leftLabelFontSize = (_l = item.leftBarLabelFontSize) !== null && _l !== void 0 ? _l : leftBarLabelFontSize;
77
+ var leftLabelX = leftXAfterMid -
78
+ leftWidth -
79
+ leftBarBorderWidth / 2 -
80
+ yAxisLabelWidth / 2 -
81
+ leftBarLabelWidth / 2 +
82
+ 28 -
83
+ (leftBarLabel.length * leftLabelFontSize) / 2 +
84
+ ((_o = (_m = item.leftBarLabelShift) !== null && _m !== void 0 ? _m : props.leftBarLabelShift) !== null && _o !== void 0 ? _o : 0);
85
+ var rightLabelX = rightXAfterMid +
86
+ rightBarBorderWidth / 2 +
87
+ rightWidth +
88
+ 3 +
89
+ ((_q = (_p = item.rightBarLabelShift) !== null && _p !== void 0 ? _p : props.rightBarLabelShift) !== null && _q !== void 0 ? _q : 0);
90
+ var leftBarCommonProps = {
91
+ x: leftXAfterMid - leftWidth - leftBarBorderWidth / 2,
92
+ y: y,
93
+ width: leftWidth,
94
+ height: stepHeight - verticalMarginBetweenBars * 2,
95
+ rx: leftRadius,
96
+ ry: leftRadius,
97
+ };
98
+ var rightBarCommonProps = {
99
+ x: rightXAfterMid + rightBarBorderWidth / 2,
100
+ y: y,
101
+ width: rightWidth,
102
+ height: stepHeight - verticalMarginBetweenBars * 2,
103
+ rx: rightRadius,
104
+ ry: rightRadius,
105
+ };
106
+ return (_jsxs(Fragment, { children: [barsMapToYAxisSections ? (_jsx(SvgText, { x: yAxisLabelWidth - yAxisLabelTextMarginRight, y: stepHeight * (index + 0.5) + yAxisLabelFontSize / 2 - 2, stroke: yAxisLabelColor, fontSize: yAxisLabelFontSize, fontStyle: yAxisLabelFontStyle, fontWeight: yAxisLabelFontWeight, fontFamily: yAxisLabelFontFamily, textAnchor: "end", children: (_s = (_r = item.yAxisLabel) !== null && _r !== void 0 ? _r : yAxisLabelTexts[index]) !== null && _s !== void 0 ? _s : '' })) : null, _jsx(Rect, __assign({}, leftBarCommonProps, { fill: (_t = item.leftBarColor) !== null && _t !== void 0 ? _t : leftBarColor, stroke: (_u = item.leftBarBorderColor) !== null && _u !== void 0 ? _u : leftBarBorderColor, strokeWidth: leftBorderWidth })), _jsx(ClipPath, { id: 'cp-left' + index, children: _jsx(Rect, __assign({}, leftBarCommonProps)) }), !allCornersRounded && leftWidth >= leftRadius ? (_jsxs(_Fragment, { children: [_jsx(Rect, { x: leftXAfterMid - leftRadius, y: y, width: leftRadius, height: stepHeight - verticalMarginBetweenBars * 2, fill: (_v = item.leftBarColor) !== null && _v !== void 0 ? _v : leftBarColor }), leftBorderWidth ? (_jsxs(_Fragment, { children: [_jsx(Line, { x1: leftXAfterMid - leftRadius, y1: y, x2: leftXAfterMid, y2: y, stroke: (_w = item.leftBarBorderColor) !== null && _w !== void 0 ? _w : leftBarBorderColor, strokeWidth: leftBorderWidth }), _jsx(Line, { x1: leftXAfterMid - leftRadius, y1: y + stepHeight - verticalMarginBetweenBars * 2, x2: leftXAfterMid, y2: y + stepHeight - verticalMarginBetweenBars * 2, stroke: (_x = item.leftBarBorderColor) !== null && _x !== void 0 ? _x : leftBarBorderColor, strokeWidth: leftBorderWidth })] })) : null] })) : null, leftBarLabel !== '' ? (_jsx(SvgText, { x: leftLabelX, y: stepHeight * (index + 0.5) + yAxisLabelFontSize / 2 - 2, stroke: (_y = item.leftBarLabelColor) !== null && _y !== void 0 ? _y : leftBarLabelColor, fontSize: leftLabelFontSize, fontStyle: (_z = item.leftBarLabelFontStyle) !== null && _z !== void 0 ? _z : leftBarLabelFontStyle, fontWeight: (_0 = item.leftBarLabelFontWeight) !== null && _0 !== void 0 ? _0 : leftBarLabelFontWeight, fontFamily: (_1 = item.leftBarLabelFontFamily) !== null && _1 !== void 0 ? _1 : leftBarLabelFontFamily, textAnchor: "start", children: leftBarLabelPrefix + leftBarLabel + leftBarLabelSuffix })) : null, _jsx(Rect, __assign({}, rightBarCommonProps, { fill: (_2 = item.rightBarColor) !== null && _2 !== void 0 ? _2 : rightBarColor, stroke: (_3 = item.rightBarBorderColor) !== null && _3 !== void 0 ? _3 : rightBarBorderColor, strokeWidth: rightBorderWidth })), _jsx(ClipPath, { id: 'cp-right' + index, children: _jsx(Rect, __assign({}, rightBarCommonProps)) }), !allCornersRounded && rightWidth >= rightRadius ? (_jsxs(_Fragment, { children: [_jsx(Rect, { x: rightXAfterMid, y: y, width: rightRadius, height: stepHeight - verticalMarginBetweenBars * 2, fill: (_4 = item.rightBarColor) !== null && _4 !== void 0 ? _4 : rightBarColor }), rightBorderWidth ? (_jsxs(_Fragment, { children: [_jsx(Line, { x1: rightXAfterMid, y1: y, x2: rightXAfterMid + rightRadius, y2: y, stroke: (_5 = item.rightBarBorderColor) !== null && _5 !== void 0 ? _5 : rightBarBorderColor, strokeWidth: rightBorderWidth }), _jsx(Line, { x1: rightXAfterMid, y1: y + stepHeight - verticalMarginBetweenBars * 2, x2: rightXAfterMid + rightRadius, y2: y + stepHeight - verticalMarginBetweenBars * 2, stroke: (_6 = item.rightBarBorderColor) !== null && _6 !== void 0 ? _6 : rightBarBorderColor, strokeWidth: rightBorderWidth })] })) : null] })) : null, rightBarLabel !== '' ? (_jsx(SvgText, { x: rightLabelX, y: stepHeight * (index + 0.5) + yAxisLabelFontSize / 2 - 2, stroke: (_7 = item.rightBarLabelColor) !== null && _7 !== void 0 ? _7 : rightBarLabelColor, fontSize: (_8 = item.rightBarLabelFontSize) !== null && _8 !== void 0 ? _8 : rightBarLabelFontSize, fontStyle: (_9 = item.rightBarLabelFontStyle) !== null && _9 !== void 0 ? _9 : rightBarLabelFontStyle, fontWeight: (_10 = item.rightBarLabelFontWeight) !== null && _10 !== void 0 ? _10 : rightBarLabelFontWeight, fontFamily: (_11 = item.rightBarLabelFontFamily) !== null && _11 !== void 0 ? _11 : rightBarLabelFontFamily, textAnchor: "start", children: rightBarLabelPrefix + rightBarLabel + rightBarLabelSuffix })) : null, (showSurplus ||
107
+ showSurplusLeft ||
108
+ item.showSurplus ||
109
+ item.showSurplusLeft) &&
110
+ leftSurplusWidth > 0 ? (_jsxs(_Fragment, { children: [_jsx(Rect, { id: 'l-spls' + index, x: leftXAfterMid - leftWidth - leftBarBorderWidth / 2, y: y, width: leftSurplusWidth, height: stepHeight - verticalMarginBetweenBars * 2, stroke: (_12 = item.leftSurplusBorderColor) !== null && _12 !== void 0 ? _12 : leftSurplusBorderColor, strokeWidth: (_13 = item.leftSurplusBorderWidth) !== null && _13 !== void 0 ? _13 : leftSurplusBorderWidth }), _jsx(Use, { fill: (_14 = item.leftSurplusColor) !== null && _14 !== void 0 ? _14 : leftSurplusColor, clipPath: '#cp-left' + index, href: '#l-spls' + index }), leftSurplusWidth >= leftRadius ? (_jsxs(_Fragment, { children: [_jsx(Rect, { id: 'hide-in-left' + index, x: leftXAfterMid -
111
+ leftWidth -
112
+ leftBarBorderWidth +
113
+ leftSurplusWidth -
114
+ leftRadius, y: y, width: leftRadius, height: stepHeight - verticalMarginBetweenBars * 2 }), _jsx(Use, { fill: (_15 = item.leftSurplusColor) !== null && _15 !== void 0 ? _15 : leftSurplusColor, clipPath: "url(#cp-left".concat(index, ")"), href: '#hide-in-left' + index })] })) : null] })) : null, (showSurplus ||
115
+ showSurplusRight ||
116
+ item.showSurplus ||
117
+ item.showSurplusRight) &&
118
+ rightSurplusWidth > 0 ? (_jsxs(_Fragment, { children: [_jsx(Rect, { id: 'r-spls' + index, x: rightXAfterMid +
119
+ rightBarBorderWidth / 2 +
120
+ rightWidth -
121
+ rightSurplusWidth, y: y, width: rightSurplusWidth, height: stepHeight - verticalMarginBetweenBars * 2, stroke: (_16 = item.rightSurplusBorderColor) !== null && _16 !== void 0 ? _16 : rightSurplusBorderColor, strokeWidth: (_17 = item.rightSurplusBorderWidth) !== null && _17 !== void 0 ? _17 : rightSurplusBorderWidth }), _jsx(Use, { fill: (_18 = item.rightSurplusColor) !== null && _18 !== void 0 ? _18 : rightSurplusColor, clipPath: '#cp-right' + index, href: '#r-spls' + index }), rightSurplusWidth >= rightRadius ? (_jsxs(_Fragment, { children: [_jsx(Rect, { id: 'hide-in-right' + index, x: rightXAfterMid +
122
+ rightBarBorderWidth / 2 +
123
+ rightWidth -
124
+ rightSurplusWidth, y: y, width: rightRadius, height: stepHeight - verticalMarginBetweenBars * 2 }), _jsx(Use, { fill: (_19 = item.rightSurplusColor) !== null && _19 !== void 0 ? _19 : rightSurplusColor, clipPath: "url(#cp-right".concat(index, ")"), href: '#hide-in-right' + index })] })) : null] })) : null] }, 'bars' + index));
125
+ }), showMidAxis ? (_jsxs(_Fragment, { children: [_jsx(Line, __assign({}, midAxisLineCommonProps, { stroke: (_b = (_a = props.midAxisLeftColor) !== null && _a !== void 0 ? _a : props.midAxisColor) !== null && _b !== void 0 ? _b : yAxisColor, x1: leftXAfterMid, x2: leftXAfterMid })), _jsx(Line, __assign({}, midAxisLineCommonProps, { stroke: (_d = (_c = props.midAxisRightColor) !== null && _c !== void 0 ? _c : props.midAxisColor) !== null && _d !== void 0 ? _d : yAxisColor, x1: rightXAfterMid, x2: rightXAfterMid })), data.map(function (item, index) {
126
+ var _a, _b, _c, _d, _e, _f;
127
+ var y = stepHeight * (index + 0.5);
128
+ return (_jsx(SvgText, { x: mid, y: y + midAxisLabelFontSize / 2, stroke: (_a = item.midAxisLabelColor) !== null && _a !== void 0 ? _a : midAxisLabelColor, fontSize: (_b = item.midAxisLabelFontSize) !== null && _b !== void 0 ? _b : midAxisLabelFontSize, fontStyle: (_c = item.midAxisLabelFontStyle) !== null && _c !== void 0 ? _c : midAxisLabelFontStyle, fontWeight: (_d = item.midAxisLabelFontWeight) !== null && _d !== void 0 ? _d : midAxisLabelFontWeight, fontFamily: (_e = item.midAxisLabelFontFamily) !== null && _e !== void 0 ? _e : midAxisLabelFontFamily, textAnchor: "middle", children: (_f = item.midAxisLabel) !== null && _f !== void 0 ? _f : '' }, 'ml' + index));
129
+ })] })) : null] }) }));
130
+ };
@@ -0,0 +1,7 @@
1
+ export { BarChart } from './BarChart';
2
+ export { PieChart } from './PieChart';
3
+ export { PieChartPro } from './PieChartPro';
4
+ export { LineChart } from './LineChart';
5
+ export { LineChartBicolor } from './LineChart/LineChartBicolor';
6
+ export { PopulationPyramid } from './PopulationPyramid';
7
+ export { type barDataItem, type stackDataItem, type BarChartPropsType, type StackedBarChartPropsType, type pieDataItem, type PieChartPropsType, type lineDataItem, type bicolorLineDataItem, type LineChartPropsType, type LineChartBicolorPropsType, type popnPyramidDataItem, type PopulationPyramidPropsType, chartTypes, ruleTypes, yAxisSides, EdgePosition, type DataSet, type Linecap } from 'gifted-charts-core';
package/dist/index.js CHANGED
@@ -1 +1,7 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BarChart",{enumerable:true,get:function get(){return _BarChart.BarChart;}});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,"PieChart",{enumerable:true,get:function get(){return _PieChart.PieChart;}});Object.defineProperty(exports,"PieChartPro",{enumerable:true,get:function get(){return _PieChartPro.PieChartPro;}});Object.defineProperty(exports,"PopulationPyramid",{enumerable:true,get:function get(){return _PopulationPyramid.PopulationPyramid;}});Object.defineProperty(exports,"chartTypes",{enumerable:true,get:function get(){return _giftedChartsCore.chartTypes;}});Object.defineProperty(exports,"ruleTypes",{enumerable:true,get:function get(){return _giftedChartsCore.ruleTypes;}});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");
1
+ export { BarChart } from './BarChart';
2
+ export { PieChart } from './PieChart';
3
+ export { PieChartPro } from './PieChartPro';
4
+ export { LineChart } from './LineChart';
5
+ export { LineChartBicolor } from './LineChart/LineChartBicolor';
6
+ export { PopulationPyramid } from './PopulationPyramid';
7
+ export { chartTypes, ruleTypes, yAxisSides, EdgePosition } from 'gifted-charts-core';
@@ -0,0 +1,3 @@
1
+ export declare const rnVersion: number;
2
+ export declare const screenWidth: number;
3
+ export declare function usePrevious(value: string): string;
@@ -1 +1,20 @@
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;
1
+ var _a, _b;
2
+ import { useEffect, useRef } from 'react';
3
+ import { Dimensions } from 'react-native';
4
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
5
+ var versionString = require('react-native/package.json').version;
6
+ var versionAr = (_b = (_a = versionString === null || versionString === void 0 ? void 0 : versionString.split) === null || _a === void 0 ? void 0 : _a.call(versionString, '.')) !== null && _b !== void 0 ? _b : '';
7
+ var msb = Number(versionAr[0]);
8
+ var mid = Number(versionAr[1]);
9
+ var lsb = Number(versionAr[2]);
10
+ export var rnVersion = (!isNaN(msb) ? msb : 0) * 1000000 +
11
+ (!isNaN(mid) ? mid : 0) * 10000 +
12
+ (!isNaN(lsb) ? lsb : 0);
13
+ export var screenWidth = Dimensions.get('window').width;
14
+ export function usePrevious(value) {
15
+ var ref = useRef('');
16
+ useEffect(function () {
17
+ ref.current = value; //assign the value of ref to the argument
18
+ }, [value]); //this code will run when the value of 'value' changes
19
+ return ref.current; //in the end, return the current ref value.
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.4.21",
3
+ "version": "1.4.23",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "scripts": {
10
10
  "android": "react-native run-android",
11
- "build": "babel --extensions .ts,.tsx ./src -d ./dist",
11
+ "build": "tsc -p . && ./build.sh",
12
12
  "ios": "react-native run-ios",
13
13
  "start": "react-native start",
14
14
  "test": "jest",
@@ -25,7 +25,7 @@
25
25
  "registry": "https://registry.npmjs.org/"
26
26
  },
27
27
  "dependencies": {
28
- "gifted-charts-core": "^0.1.20"
28
+ "gifted-charts-core": "^0.1.25"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/cli": "^7.24.8",