6bf05c7f067d609b48eef4a49b31ea82.json
19.8 KB
{"ast":null,"code":"var _interopRequireWildcard=require(\"@babel/runtime/helpers/interopRequireWildcard\");var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=void 0;var _extends2=_interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));var _toConsumableArray2=_interopRequireDefault(require(\"@babel/runtime/helpers/toConsumableArray\"));var _classCallCheck2=_interopRequireDefault(require(\"@babel/runtime/helpers/classCallCheck\"));var _createClass2=_interopRequireDefault(require(\"@babel/runtime/helpers/createClass\"));var _possibleConstructorReturn2=_interopRequireDefault(require(\"@babel/runtime/helpers/possibleConstructorReturn\"));var _getPrototypeOf3=_interopRequireDefault(require(\"@babel/runtime/helpers/getPrototypeOf\"));var _inherits2=_interopRequireDefault(require(\"@babel/runtime/helpers/inherits\"));var _propTypes=_interopRequireDefault(require(\"prop-types\"));var array=_interopRequireWildcard(require(\"d3-array\"));var scale=_interopRequireWildcard(require(\"d3-scale\"));var shape=_interopRequireWildcard(require(\"d3-shape\"));var _react=_interopRequireWildcard(require(\"react\"));var _View=_interopRequireDefault(require(\"react-native-web/dist/exports/View\"));var _reactNativeSvg=require(\"react-native-svg\");var _animatedPath=_interopRequireDefault(require(\"./animated-path\"));var AreaStack=function(_PureComponent){(0,_inherits2.default)(AreaStack,_PureComponent);function AreaStack(){var _getPrototypeOf2;var _this;(0,_classCallCheck2.default)(this,AreaStack);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf2=(0,_getPrototypeOf3.default)(AreaStack)).call.apply(_getPrototypeOf2,[this].concat(args)));_this.state={height:0,width:0};return _this;}(0,_createClass2.default)(AreaStack,[{key:\"_onLayout\",value:function _onLayout(event){var _event$nativeEvent$la=event.nativeEvent.layout,height=_event$nativeEvent$la.height,width=_event$nativeEvent$la.width;this.setState({height:height,width:width});}},{key:\"render\",value:function render(){var _this2=this;var _this$props=this.props,data=_this$props.data,keys=_this$props.keys,colors=_this$props.colors,animate=_this$props.animate,animationDuration=_this$props.animationDuration,style=_this$props.style,curve=_this$props.curve,numberOfTicks=_this$props.numberOfTicks,_this$props$contentIn=_this$props.contentInset,_this$props$contentIn2=_this$props$contentIn.top,top=_this$props$contentIn2===void 0?0:_this$props$contentIn2,_this$props$contentIn3=_this$props$contentIn.bottom,bottom=_this$props$contentIn3===void 0?0:_this$props$contentIn3,_this$props$contentIn4=_this$props$contentIn.left,left=_this$props$contentIn4===void 0?0:_this$props$contentIn4,_this$props$contentIn5=_this$props$contentIn.right,right=_this$props$contentIn5===void 0?0:_this$props$contentIn5,gridMin=_this$props.gridMin,gridMax=_this$props.gridMax,children=_this$props.children,offset=_this$props.offset,order=_this$props.order,svgs=_this$props.svgs,xAccessor=_this$props.xAccessor,xScale=_this$props.xScale,clampY=_this$props.clampY,clampX=_this$props.clampX;var _this$state=this.state,height=_this$state.height,width=_this$state.width;if(data.length===0){return _react.default.createElement(_View.default,{style:style});}var series=shape.stack().keys(keys).order(order).offset(offset)(data);var yValues=array.merge(array.merge(series));var xValues=data.map(function(item,index){return xAccessor({item:item,index:index});});var yExtent=array.extent([].concat((0,_toConsumableArray2.default)(yValues),[gridMin,gridMax]));var xExtent=array.extent(xValues);var _this$props2=this.props,_this$props2$yMin=_this$props2.yMin,yMin=_this$props2$yMin===void 0?yExtent[0]:_this$props2$yMin,_this$props2$yMax=_this$props2.yMax,yMax=_this$props2$yMax===void 0?yExtent[1]:_this$props2$yMax,_this$props2$xMin=_this$props2.xMin,xMin=_this$props2$xMin===void 0?xExtent[0]:_this$props2$xMin,_this$props2$xMax=_this$props2.xMax,xMax=_this$props2$xMax===void 0?xExtent[1]:_this$props2$xMax;var y=scale.scaleLinear().domain([yMin,yMax]).range([height-bottom,top]).clamp(clampY);var x=xScale().domain([xMin,xMax]).range([left,width-right]).clamp(clampX);var ticks=y.ticks(numberOfTicks);var areas=series.map(function(serie,index){var path=shape.area().x(function(d,index){return x(xAccessor({item:d.data,index:index}));}).y0(function(d){return y(d[0]);}).y1(function(d){return y(d[1]);}).curve(curve)(data.map(function(_,index){return serie[index];}));return{path:path,key:keys[index],color:colors[index]};});var extraProps={x:x,y:y,width:width,height:height,ticks:ticks,areas:areas};return _react.default.createElement(_View.default,{style:style},_react.default.createElement(_View.default,{style:{flex:1},onLayout:function onLayout(event){return _this2._onLayout(event);}},height>0&&width>0&&_react.default.createElement(_reactNativeSvg.Svg,{style:{height:height,width:width}},_react.default.Children.map(children,function(child){if(child&&child.props.belowChart){return _react.default.cloneElement(child,extraProps);}return null;}),areas.map(function(area,index){return _react.default.createElement(_animatedPath.default,(0,_extends2.default)({key:area.key,fill:area.color},svgs[index],{animate:animate,animationDuration:animationDuration,d:area.path}));}),_react.default.Children.map(children,function(child){if(child&&!child.props.belowChart){return _react.default.cloneElement(child,extraProps);}return null;}))));}}],[{key:\"extractDataPoints\",value:function extractDataPoints(data,keys){var order=arguments.length>2&&arguments[2]!==undefined?arguments[2]:shape.stackOrderNone;var offset=arguments.length>3&&arguments[3]!==undefined?arguments[3]:shape.stackOffsetNone;var series=shape.stack().keys(keys).order(order).offset(offset)(data);return array.merge(array.merge(series));}}]);return AreaStack;}(_react.PureComponent);AreaStack.propTypes={data:_propTypes.default.arrayOf(_propTypes.default.object).isRequired,keys:_propTypes.default.arrayOf(_propTypes.default.string).isRequired,colors:_propTypes.default.arrayOf(_propTypes.default.string).isRequired,svgs:_propTypes.default.arrayOf(_propTypes.default.object),offset:_propTypes.default.func,order:_propTypes.default.func,style:_propTypes.default.any,animate:_propTypes.default.bool,animationDuration:_propTypes.default.number,contentInset:_propTypes.default.shape({top:_propTypes.default.number,left:_propTypes.default.number,right:_propTypes.default.number,bottom:_propTypes.default.number}),numberOfTicks:_propTypes.default.number,showGrid:_propTypes.default.bool,xScale:_propTypes.default.func,xAccessor:_propTypes.default.func,yMin:_propTypes.default.any,yMax:_propTypes.default.any,xMin:_propTypes.default.any,xMax:_propTypes.default.any,clampX:_propTypes.default.bool,clampY:_propTypes.default.bool};AreaStack.defaultProps={curve:shape.curveLinear,offset:shape.stackOffsetNone,order:shape.stackOrderNone,svgs:[],strokeWidth:2,contentInset:{},numberOfTicks:10,showGrid:true,xScale:scale.scaleLinear,xAccessor:function xAccessor(_ref){var index=_ref.index;return index;}};var _default=AreaStack;exports.default=_default;","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-svg-charts/src/stacked-area-chart.js"],"names":["AreaStack","state","height","width","event","nativeEvent","layout","setState","props","data","keys","colors","animate","animationDuration","style","curve","numberOfTicks","contentInset","top","bottom","left","right","gridMin","gridMax","children","offset","order","svgs","xAccessor","xScale","clampY","clampX","length","series","shape","stack","yValues","array","merge","xValues","map","item","index","yExtent","extent","xExtent","yMin","yMax","xMin","xMax","y","scale","scaleLinear","domain","range","clamp","x","ticks","areas","serie","path","area","d","y0","y1","_","key","color","extraProps","flex","_onLayout","React","Children","child","belowChart","cloneElement","stackOrderNone","stackOffsetNone","PureComponent","propTypes","PropTypes","arrayOf","object","isRequired","string","func","any","bool","number","showGrid","defaultProps","curveLinear","strokeWidth"],"mappings":"s4BAAA,6DACA,uDACA,uDACA,uDACA,qD,gFAEA,gDACA,qE,GAEMA,CAAAA,S,0bAYFC,K,CAAQ,CACJC,MAAM,CAAE,CADJ,CAEJC,KAAK,CAAE,CAFH,C,8FAKEC,K,CAAO,2BAKTA,KALS,CAETC,WAFS,CAGLC,MAHK,CAGKJ,MAHL,uBAGKA,MAHL,CAGaC,KAHb,uBAGaA,KAHb,CAMb,KAAKI,QAAL,CAAc,CAAEL,MAAM,CAANA,MAAF,CAAUC,KAAK,CAALA,KAAV,CAAd,EACH,C,uCAEQ,iCAqBD,KAAKK,KArBJ,CAEDC,IAFC,aAEDA,IAFC,CAGDC,IAHC,aAGDA,IAHC,CAIDC,MAJC,aAIDA,MAJC,CA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CAAC0C,cAHQ,CAIrBjD,IAAI,CAAE,EAJe,CAKrBiE,WAAW,CAAE,CALQ,CAMrB3E,YAAY,CAAE,EANO,CAOrBD,aAAa,CAAE,EAPM,CAQrByE,QAAQ,CAAE,IARW,CASrB5D,MAAM,CAAEsB,KAAK,CAACC,WATO,CAUrBxB,SAAS,CAAE,4BAAGc,CAAAA,KAAH,MAAGA,KAAH,OAAeA,CAAAA,KAAf,EAVU,CAAzB,C,aAae1C,S","sourcesContent":["import PropTypes from 'prop-types'\nimport * as array from 'd3-array'\nimport * as scale from 'd3-scale'\nimport * as shape from 'd3-shape'\nimport React, { PureComponent } from 'react'\nimport { View } from 'react-native'\nimport { Svg } from 'react-native-svg'\nimport Path from './animated-path'\n\nclass AreaStack extends PureComponent {\n static extractDataPoints(data, keys, order = shape.stackOrderNone, offset = shape.stackOffsetNone) {\n const series = shape\n .stack()\n .keys(keys)\n .order(order)\n .offset(offset)(data)\n\n //double merge arrays to extract just the values\n return array.merge(array.merge(series))\n }\n\n state = {\n height: 0,\n width: 0,\n }\n\n _onLayout(event) {\n const {\n nativeEvent: {\n layout: { height, width },\n },\n } = event\n this.setState({ height, width })\n }\n\n render() {\n const {\n data,\n keys,\n colors,\n animate,\n animationDuration,\n style,\n curve,\n numberOfTicks,\n contentInset: { top = 0, bottom = 0, left = 0, right = 0 },\n gridMin,\n gridMax,\n children,\n offset,\n order,\n svgs,\n xAccessor,\n xScale,\n clampY,\n clampX,\n } = this.props\n\n const { height, width } = this.state\n\n if (data.length === 0) {\n return <View style={style} />\n }\n\n const series = shape\n .stack()\n .keys(keys)\n .order(order)\n .offset(offset)(data)\n\n //double merge arrays to extract just the yValues\n const yValues = array.merge(array.merge(series))\n const xValues = data.map((item, index) => xAccessor({ item, index }))\n\n const yExtent = array.extent([...yValues, gridMin, gridMax])\n const xExtent = array.extent(xValues)\n\n const { yMin = yExtent[0], yMax = yExtent[1], xMin = xExtent[0], xMax = xExtent[1] } = this.props\n\n //invert range to support svg coordinate system\n const y = scale\n .scaleLinear()\n .domain([yMin, yMax])\n .range([height - bottom, top])\n .clamp(clampY)\n\n const x = xScale()\n .domain([xMin, xMax])\n .range([left, width - right])\n .clamp(clampX)\n\n const ticks = y.ticks(numberOfTicks)\n\n const areas = series.map((serie, index) => {\n const path = shape\n .area()\n .x((d, index) => x(xAccessor({ item: d.data, index })))\n .y0((d) => y(d[0]))\n .y1((d) => y(d[1]))\n .curve(curve)(data.map((_, index) => serie[index]))\n\n return {\n path,\n key: keys[index],\n color: colors[index],\n }\n })\n\n const extraProps = {\n x,\n y,\n width,\n height,\n ticks,\n areas,\n }\n\n return (\n <View style={style}>\n <View style={{ flex: 1 }} onLayout={(event) => this._onLayout(event)}>\n {height > 0 && width > 0 && (\n <Svg style={{ height, width }}>\n {React.Children.map(children, (child) => {\n if (child && child.props.belowChart) {\n return React.cloneElement(child, extraProps)\n }\n return null\n })}\n {areas.map((area, index) => (\n <Path\n key={area.key}\n fill={area.color}\n {...svgs[index]}\n animate={animate}\n animationDuration={animationDuration}\n d={area.path}\n />\n ))}\n {React.Children.map(children, (child) => {\n if (child && !child.props.belowChart) {\n return React.cloneElement(child, extraProps)\n }\n return null\n })}\n </Svg>\n )}\n </View>\n </View>\n )\n }\n}\n\nAreaStack.propTypes = {\n data: PropTypes.arrayOf(PropTypes.object).isRequired,\n keys: PropTypes.arrayOf(PropTypes.string).isRequired,\n colors: PropTypes.arrayOf(PropTypes.string).isRequired,\n svgs: PropTypes.arrayOf(PropTypes.object),\n offset: PropTypes.func,\n order: PropTypes.func,\n style: PropTypes.any,\n animate: PropTypes.bool,\n animationDuration: PropTypes.number,\n contentInset: PropTypes.shape({\n top: PropTypes.number,\n left: PropTypes.number,\n right: PropTypes.number,\n bottom: PropTypes.number,\n }),\n numberOfTicks: PropTypes.number,\n showGrid: PropTypes.bool,\n xScale: PropTypes.func,\n xAccessor: PropTypes.func,\n\n yMin: PropTypes.any,\n yMax: PropTypes.any,\n xMin: PropTypes.any,\n xMax: PropTypes.any,\n clampX: PropTypes.bool,\n clampY: PropTypes.bool,\n}\n\nAreaStack.defaultProps = {\n curve: shape.curveLinear,\n offset: shape.stackOffsetNone,\n order: shape.stackOrderNone,\n svgs: [],\n strokeWidth: 2,\n contentInset: {},\n numberOfTicks: 10,\n showGrid: true,\n xScale: scale.scaleLinear,\n xAccessor: ({ index }) => index,\n}\n\nexport default AreaStack\n"]},"metadata":{},"sourceType":"script"}