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,129 @@
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;
1
+ var __read = (this && this.__read) || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o), r, ar = [], e;
5
+ try {
6
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
+ }
8
+ catch (error) { e = { error: error }; }
9
+ finally {
10
+ try {
11
+ if (r && !r.done && (m = i["return"])) m.call(i);
12
+ }
13
+ finally { if (e) throw e.error; }
14
+ }
15
+ return ar;
16
+ };
17
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { useEffect, useState } from 'react';
19
+ import { View, StyleSheet, LayoutAnimation, Platform, UIManager, Text, } from 'react-native';
20
+ import Svg, { Defs, Rect } from 'react-native-svg';
21
+ import { styles } from './styles';
22
+ import LinearGradient from "../common/LinearGradient";
23
+ import { useAnimatedThreeDBar, } from 'gifted-charts-core';
24
+ if (Platform.OS === 'android') {
25
+ UIManager.setLayoutAnimationEnabledExperimental &&
26
+ UIManager.setLayoutAnimationEnabledExperimental(true);
27
+ }
28
+ var TriangleCorner = function (props) {
29
+ return (_jsx(View, { style: [
30
+ triangleStyles.triangleCorner,
31
+ props.style,
32
+ {
33
+ borderRightWidth: props.width / 2,
34
+ borderTopWidth: props.width / 2,
35
+ borderTopColor: props.color,
36
+ },
37
+ ] }));
38
+ };
39
+ var triangleStyles = StyleSheet.create({
40
+ triangleCorner: {
41
+ width: 0,
42
+ height: 0,
43
+ backgroundColor: 'transparent',
44
+ borderStyle: 'solid',
45
+ borderRightColor: 'transparent',
46
+ transform: [{ rotate: '90deg' }],
47
+ },
48
+ });
49
+ var AnimatedThreeDBar = function (props) {
50
+ var _a;
51
+ var heightCopy = props.height;
52
+ var _b = __read(useState(props.isAnimated ? (Platform.OS === 'ios' ? 0 : 20) : heightCopy), 2), height = _b[0], setHeight = _b[1];
53
+ 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;
54
+ var _c = useAnimatedThreeDBar(props), showGradient = _c.showGradient, gradientColor = _c.gradientColor, frontColor = _c.frontColor, sideColor = _c.sideColor, topColor = _c.topColor, opacity = _c.opacity, initialRender = _c.initialRender, setInitialRender = _c.setInitialRender;
55
+ useEffect(function () {
56
+ if (isAnimated) {
57
+ if (initialRender) {
58
+ setTimeout(function () {
59
+ layoutAppear();
60
+ }, 20);
61
+ }
62
+ else {
63
+ elevate();
64
+ }
65
+ }
66
+ }, [props.height]);
67
+ var elevate = function () {
68
+ LayoutAnimation.configureNext({
69
+ duration: animationDuration,
70
+ update: { type: 'linear', property: 'scaleY' },
71
+ });
72
+ setHeight(props.height);
73
+ };
74
+ var layoutAppear = function () {
75
+ LayoutAnimation.configureNext({
76
+ duration: Platform.OS == 'ios' ? animationDuration : 20,
77
+ create: { type: 'linear', property: 'scaleY' },
78
+ // update: { type: 'linear' }
79
+ });
80
+ setInitialRender(false);
81
+ setTimeout(function () { return elevate(); }, Platform.OS == 'ios' ? 10 : 100);
82
+ };
83
+ return (_jsx(View, { style: styles.container, children: !initialRender && (_jsxs(View, { style: [
84
+ styles.row,
85
+ { opacity: opacity, position: 'absolute', bottom: 0 },
86
+ props.side === 'right' && { transform: [{ rotateY: '180deg' }] },
87
+ ], children: [props.height ? (_jsxs(_Fragment, { children: [_jsx(View, { style: { position: 'absolute', top: sideWidth / -2 }, children: _jsx(TriangleCorner, { color: topColor, width: sideWidth, style: { transform: [{ rotate: '90deg' }], opacity: opacity } }) }), _jsx(View, { style: { position: 'absolute', top: sideWidth / -2 }, children: _jsx(View, { style: {
88
+ width: barWidth,
89
+ height: barWidth,
90
+ // left: width / 2,
91
+ backgroundColor: topColor,
92
+ opacity: opacity,
93
+ } }) }), _jsx(View, { style: {
94
+ position: 'absolute',
95
+ top: sideWidth / -2,
96
+ left: barWidth - 1,
97
+ }, children: _jsx(TriangleCorner, { color: topColor, width: sideWidth, style: { transform: [{ rotate: '-90deg' }], opacity: opacity } }) })] })) : null, _jsxs(View, { style: { marginTop: sideWidth / -2 - 1 }, children: [_jsx(TriangleCorner, { color: height ? sideColor : 'transparent', width: sideWidth, style: { transform: [{ rotate: '-90deg' }], opacity: opacity } }), _jsx(View, { style: {
98
+ width: sideWidth / 2 + 1,
99
+ height: height - sideWidth / 2, //animatedSideHeight
100
+ backgroundColor: sideColor,
101
+ opacity: opacity,
102
+ } }), _jsx(TriangleCorner, { color: height ? sideColor : 'transparent', width: sideWidth + 1, style: { transform: [{ rotate: '90deg' }], opacity: opacity } })] }), _jsxs(View, { style: [
103
+ {
104
+ width: barWidth,
105
+ height: height, //animatedHeight
106
+ backgroundColor: frontColor,
107
+ borderLeftWidth: StyleSheet.hairlineWidth,
108
+ borderTopWidth: StyleSheet.hairlineWidth,
109
+ borderColor: 'white',
110
+ opacity: opacity,
111
+ },
112
+ item.barStyle || barStyle,
113
+ ], children: [showGradient && (_jsx(LinearGradient, { style: { position: 'absolute', width: '100%', height: '100%' }, start: { x: 0, y: 0 }, end: { x: 1, y: 1 }, colors: [gradientColor, frontColor] })), barBackgroundPattern && (_jsxs(Svg, { children: [_jsx(Defs, { children: barBackgroundPattern() }), _jsx(Rect, { stroke: "transparent", x: "1", y: "1", width: barWidth || 30, height: height, fill: "url(#".concat(patternId, ")") })] })), barInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: barInnerComponent(item, index) })) : null] }), (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
114
+ {
115
+ position: 'absolute',
116
+ top: barWidth * -2,
117
+ height: (barWidth * 3) / 2,
118
+ width: (barWidth * 3) / 2,
119
+ justifyContent: 'flex-end',
120
+ alignItems: 'center',
121
+ opacity: opacity,
122
+ },
123
+ props.horizontal &&
124
+ !intactTopLabel && { transform: [{ rotate: '270deg' }] },
125
+ props.side === 'right' && { transform: [{ rotateY: '180deg' }] },
126
+ topLabelContainerStyle !== null && topLabelContainerStyle !== void 0 ? topLabelContainerStyle : item.topLabelContainerStyle,
127
+ ], children: showValuesAsTopLabel ? (_jsx(Text, { style: topLabelTextStyle, children: item.value })) : ((_a = item.topLabelComponent) === null || _a === void 0 ? void 0 : _a.call(item)) }))] })) }));
128
+ };
129
+ export default AnimatedThreeDBar;
@@ -0,0 +1,10 @@
1
+ export declare const styles: {
2
+ container: {
3
+ flex: number;
4
+ justifyContent: "center";
5
+ alignItems: "center";
6
+ };
7
+ row: {
8
+ flexDirection: "row";
9
+ };
10
+ };
@@ -1 +1,13 @@
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'}});
1
+ import { StyleSheet } from 'react-native';
2
+ export var styles = StyleSheet.create({
3
+ container: {
4
+ flex: 1,
5
+ // width: '100%',
6
+ // height: '100%',
7
+ justifyContent: 'center',
8
+ alignItems: 'center',
9
+ },
10
+ row: {
11
+ flexDirection: 'row',
12
+ },
13
+ });
@@ -0,0 +1,3 @@
1
+ import { BarAndLineChartsWrapperTypes } from 'gifted-charts-core';
2
+ declare const BarAndLineChartsWrapper: (props: BarAndLineChartsWrapperTypes) => import("react/jsx-runtime").JSX.Element;
3
+ export default BarAndLineChartsWrapper;
@@ -1 +1,128 @@
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;
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 } from "react/jsx-runtime";
13
+ import { Fragment, useEffect } from 'react';
14
+ import { View, ScrollView, StyleSheet, I18nManager } from 'react-native';
15
+ import { renderHorizSections } from './renderHorizSections';
16
+ import RenderLineInBarChart from './renderLineInBarChart';
17
+ import RenderVerticalLines from './renderVerticalLines';
18
+ import { chartTypes, yAxisSides, useBarAndLineChartsWrapper, } from 'gifted-charts-core';
19
+ var BarAndLineChartsWrapper = function (props) {
20
+ var _a, _b, _c, _d, _e;
21
+ 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, _f = props.extraWidthDueToDataPoint, extraWidthDueToDataPoint = _f === void 0 ? 0 : _f;
22
+ var _g = useBarAndLineChartsWrapper(__assign(__assign({}, props), { isRTL: I18nManager.isRTL })), containerHeightIncludingBelowXAxis = _g.containerHeightIncludingBelowXAxis, xAxisLabelsVerticalShift = _g.xAxisLabelsVerticalShift, trimYAxisAtTop = _g.trimYAxisAtTop, yAxisExtraHeight = _g.yAxisExtraHeight, overflowTop = _g.overflowTop, xAxisLabelsHeight = _g.xAxisLabelsHeight, xAxisTextNumberOfLines = _g.xAxisTextNumberOfLines, actualContainerWidth = _g.actualContainerWidth, transformForHorizontal = _g.transformForHorizontal, horizSectionProps = _g.horizSectionProps, referenceLinesOverChartContent = _g.referenceLinesOverChartContent, setCanMomentum = _g.setCanMomentum, isCloseToStart = _g.isCloseToStart, isCloseToEnd = _g.isCloseToEnd, canMomentum = _g.canMomentum, yAxisAtTop = _g.yAxisAtTop, yAxisThickness = _g.yAxisThickness, yAxisSide = _g.yAxisSide, showVerticalLines = _g.showVerticalLines, verticalLinesProps = _g.verticalLinesProps, lineInBarChartProps = _g.lineInBarChartProps, lineInBarChartProps2 = _g.lineInBarChartProps2;
23
+ useEffect(function () {
24
+ if (pointerConfig && getPointerProps) {
25
+ getPointerProps({ pointerIndex: pointerIndex, pointerX: pointerX, pointerY: pointerY });
26
+ }
27
+ }, [pointerIndex, pointerX, pointerY]);
28
+ /*******************************************************************************************************************************************/
29
+ /*******************************************************************************************************************************************/
30
+ var styles = StyleSheet.create({
31
+ container: {
32
+ width: '100%',
33
+ height: containerHeightIncludingBelowXAxis +
34
+ labelsExtraHeight +
35
+ xAxisLabelsVerticalShift +
36
+ (trimYAxisAtTop ? 0 : yAxisExtraHeight) +
37
+ 50 -
38
+ overflowTop,
39
+ marginTop: trimYAxisAtTop ? containerHeight / 20 : 0,
40
+ marginBottom: (xAxisLabelsHeight !== null && xAxisLabelsHeight !== void 0 ? xAxisLabelsHeight : xAxisTextNumberOfLines * 18) - 55, //This is to not let the Things that should be rendered below the chart overlap with it
41
+ },
42
+ });
43
+ return (_jsxs(View, { style: [
44
+ styles.container,
45
+ horizontal && {
46
+ width: actualContainerWidth,
47
+ transform: transformForHorizontal,
48
+ },
49
+ ], children: [hideAxesAndRules !== true
50
+ ? renderHorizSections(__assign(__assign({}, horizSectionProps), { onlyReferenceLines: false, renderReferenceLines: !referenceLinesOverChartContent }))
51
+ : null, _jsx(ScrollView, __assign({ onScrollBeginDrag: function () {
52
+ setCanMomentum(true);
53
+ }, nestedScrollEnabled: nestedScrollEnabled, onMomentumScrollEnd: function (_a) {
54
+ var nativeEvent = _a.nativeEvent;
55
+ if (onMomentumScrollEnd) {
56
+ onMomentumScrollEnd();
57
+ }
58
+ if (isCloseToEnd(nativeEvent) && canMomentum) {
59
+ onEndReached ? onEndReached() : null;
60
+ setCanMomentum(false);
61
+ }
62
+ if (isCloseToStart(nativeEvent) && canMomentum) {
63
+ onStartReached ? onStartReached() : null;
64
+ setCanMomentum(false);
65
+ }
66
+ }, scrollEventThrottle: props.scrollEventThrottle ? props.scrollEventThrottle : 16, horizontal: true, ref: scrollRef, style: [
67
+ {
68
+ marginLeft: horizontal && !yAxisAtTop
69
+ ? -yAxisThickness -
70
+ (props.width ? 20 : 0) -
71
+ ((_c = (_b = (_a = data[data.length - 1]) === null || _a === void 0 ? void 0 : _a.barWidth) !== null && _b !== void 0 ? _b : barWidth) !== null && _c !== void 0 ? _c : 0) / 2
72
+ : yAxisSide === yAxisSides.RIGHT
73
+ ? 0
74
+ : yAxisLabelWidth + yAxisThickness,
75
+ position: 'absolute',
76
+ bottom: chartType === chartTypes.LINE_BI_COLOR ? 0 : xAxisThickness,
77
+ },
78
+ !!props.width && { width: props.width + extraWidthDueToDataPoint },
79
+ horizontal && {
80
+ width: ((_d = props.width) !== null && _d !== void 0 ? _d : totalWidth) + (props.width ? endSpacing : -20),
81
+ },
82
+ ], contentContainerStyle: [
83
+ {
84
+ height: containerHeightIncludingBelowXAxis +
85
+ yAxisExtraHeight +
86
+ labelsExtraHeight +
87
+ (50 + xAxisLabelsVerticalShift),
88
+ width: Math.max((_e = props.width) !== null && _e !== void 0 ? _e : 0, totalWidth - spacing + endSpacing) +
89
+ extraWidthDueToDataPoint,
90
+ paddingLeft: initialSpacing,
91
+ paddingBottom: noOfSectionsBelowXAxis * stepHeight + labelsExtraHeight,
92
+ alignItems: 'flex-end',
93
+ },
94
+ !props.width && { width: totalWidth },
95
+ ], scrollEnabled: !disableScroll, showsHorizontalScrollIndicator: showScrollIndicator, indicatorStyle: indicatorColor, onContentSizeChange: function () {
96
+ if (scrollRef.current && scrollToEnd) {
97
+ scrollRef.current.scrollToEnd({ animated: scrollAnimation });
98
+ }
99
+ else if (scrollRef.current && scrollToIndex) {
100
+ scrollRef.current.scrollTo({
101
+ x: initialSpacing +
102
+ ((barWidth !== null && barWidth !== void 0 ? barWidth : 0) + spacing) * scrollToIndex -
103
+ spacing,
104
+ });
105
+ }
106
+ } }, remainingScrollViewProps, { children: _jsxs(Fragment, { children: [showVerticalLines ? (_jsx(RenderVerticalLines, __assign({}, verticalLinesProps))) : null,
107
+ // Only For Bar Charts-
108
+ showLine ? _jsx(RenderLineInBarChart, __assign({}, lineInBarChartProps)) : null,
109
+ // Only For Bar Charts-
110
+ showLine && (points2 === null || points2 === void 0 ? void 0 : points2.length) ? (_jsx(RenderLineInBarChart, __assign({}, lineInBarChartProps2))) : null,
111
+ // Only For Line Charts-
112
+ chartType === chartTypes.LINE &&
113
+ data.map(function (item, index) {
114
+ return showXAxisIndices || item.showXAxisIndex ? (_jsx(View, { style: {
115
+ position: 'absolute',
116
+ height: xAxisIndicesHeight,
117
+ width: xAxisIndicesWidth,
118
+ backgroundColor: xAxisIndicesColor,
119
+ bottom: 60 - xAxisIndicesHeight / 2,
120
+ left: index * spacing +
121
+ (initialSpacing - xAxisIndicesWidth / 2) -
122
+ 3,
123
+ } }, index + '' + item.value)) : null;
124
+ }), renderChartContent()] }) })), referenceLinesOverChartContent
125
+ ? renderHorizSections(__assign(__assign({}, horizSectionProps), { onlyReferenceLines: true }))
126
+ : null] }));
127
+ };
128
+ export default BarAndLineChartsWrapper;
@@ -0,0 +1,2 @@
1
+ import { horizSectionPropTypes } from 'gifted-charts-core';
2
+ export declare const renderHorizSections: (props: horizSectionPropTypes) => import("react/jsx-runtime").JSX.Element;