96b277c00b2c7ada90e3d2683c313dcc.json
36.7 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 _react=_interopRequireWildcard(require(\"react\"));var _View=_interopRequireDefault(require(\"react-native-web/dist/exports/View\"));var _propTypes=_interopRequireDefault(require(\"prop-types\"));var _reactNativeSvg=_interopRequireDefault(require(\"react-native-svg\"));var array=_interopRequireWildcard(require(\"d3-array\"));var scale=_interopRequireWildcard(require(\"d3-scale\"));var shape=_interopRequireWildcard(require(\"d3-shape\"));var _animatedPath=_interopRequireDefault(require(\"../animated-path\"));var StackedBarGrouped=function(_PureComponent){(0,_inherits2.default)(StackedBarGrouped,_PureComponent);function StackedBarGrouped(){var _getPrototypeOf2;var _this;(0,_classCallCheck2.default)(this,StackedBarGrouped);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)(StackedBarGrouped)).call.apply(_getPrototypeOf2,[this].concat(args)));_this.state={width:0,height:0};_this.coordinatesToPathCommands=function(x0,y0,x1,y1,borderRadius,showTopBorder,showBottomBorder){var commands=[];commands.push({marker:'M',values:[x0,y0]});if(showTopBorder){var topLeft1=[x0+borderRadius,y0];var topLeft2=[x0,y0+borderRadius];commands.push({marker:'L',values:topLeft1});commands.push({marker:'C',values:[].concat(topLeft1,[x0,y0],topLeft2)});commands.push({marker:'L',values:topLeft2});}else{commands.push({marker:'L',values:[x0,y0]});}if(showBottomBorder){var bottomLeft1=[x0,y1-borderRadius];var bottomLeft2=[x0+borderRadius,y1];commands.push({marker:'L',values:bottomLeft1});commands.push({marker:'C',values:[].concat(bottomLeft1,[x0,y1],bottomLeft2)});commands.push({marker:'L',values:bottomLeft2});var bottomRight1=[x1-borderRadius,y1];var bottomRight2=[x1,y1-borderRadius];commands.push({marker:'L',values:bottomRight1});commands.push({marker:'C',values:[].concat(bottomRight1,[x1,y1],bottomRight2)});commands.push({marker:'L',values:bottomRight2});}else{commands.push({marker:'L',values:[x0,y1]});commands.push({marker:'L',values:[x1,y1]});}if(showTopBorder){var topRight1=[x1,y0+borderRadius];var topRight2=[x1-borderRadius,y0];commands.push({marker:'L',values:topRight1});commands.push({marker:'C',values:[].concat(topRight1,[x1,y0],topRight2)});commands.push({marker:'L',values:topRight2});}else{commands.push({marker:'L',values:[x1,y0]});}commands.push({marker:'Z',values:[]});return commands;};_this.commandsToSvgPath=function(commands){return commands.map(function(command){return command.marker+\" \"+command.values.join(',');}).join(' ').trim();};return _this;}(0,_createClass2.default)(StackedBarGrouped,[{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:\"calcXScale\",value:function calcXScale(domain){var _this$props=this.props,horizontal=_this$props.horizontal,_this$props$contentIn=_this$props.contentInset,_this$props$contentIn2=_this$props$contentIn.left,left=_this$props$contentIn2===void 0?0:_this$props$contentIn2,_this$props$contentIn3=_this$props$contentIn.right,right=_this$props$contentIn3===void 0?0:_this$props$contentIn3,spacingInner=_this$props.spacingInner,spacingOuter=_this$props.spacingOuter;var width=this.state.width;if(horizontal){return scale.scaleLinear().domain(domain).range([left,width-right]);}return scale.scaleBand().domain(domain).range([left,width-right]).paddingInner([spacingInner]).paddingOuter([spacingOuter]);}},{key:\"calcYScale\",value:function calcYScale(domain){var _this$props2=this.props,horizontal=_this$props2.horizontal,_this$props2$contentI=_this$props2.contentInset,_this$props2$contentI2=_this$props2$contentI.top,top=_this$props2$contentI2===void 0?0:_this$props2$contentI2,_this$props2$contentI3=_this$props2$contentI.bottom,bottom=_this$props2$contentI3===void 0?0:_this$props2$contentI3,spacingInner=_this$props2.spacingInner,spacingOuter=_this$props2.spacingOuter;var height=this.state.height;if(horizontal){return scale.scaleBand().domain(domain).range([top,height-bottom]).paddingInner([spacingInner]).paddingOuter([spacingOuter]);}return scale.scaleLinear().domain(domain).range([height-bottom,top]);}},{key:\"calcAreas\",value:function calcAreas(x,y,series){var _this2=this;var _this$props3=this.props,horizontal=_this$props3.horizontal,colors=_this$props3.colors,keys=_this$props3.keys,data=_this$props3.data,initialBorderRadius=_this$props3.borderRadius,innerBarSpace=_this$props3.innerBarSpace;var areas;var barWidth;if(horizontal){barWidth=y.bandwidth()/data.length;areas=series.map(function(stack,stackIndex){return stack.map(function(serie,keyIndex){return serie.map(function(entry,entryIndex){var leftMargin=series.length>1?innerBarSpace/2:0;var path=shape.area().x0(function(d){return x(d[0]);}).x1(function(d){return x(d[1]);}).y(function(d,_index){return(_index===0?y(entryIndex)+barWidth*stackIndex+leftMargin:y(entryIndex)+barWidth+barWidth*stackIndex)-leftMargin;}).defined(function(d){return!isNaN(d[0])&&!isNaN(d[1]);})([entry,entry]);return{path:path,color:colors[stackIndex][keyIndex],key:keys[stackIndex][keyIndex]};});});});}else{barWidth=x.bandwidth()/data.length;areas=series.map(function(stack,stackIndex){return stack.map(function(serie,keyIndex){return serie.map(function(entry,entryIndex){var leftMargin=series.length>1?innerBarSpace/2:0;var x0=x(entryIndex)+barWidth*stackIndex+leftMargin;var x1=x(entryIndex)+barWidth+barWidth*stackIndex-leftMargin;var y0=y(entry[1]);var y1=y(entry[0]);var barHeight=y1-y0;var borderRadius=initialBorderRadius*2>barHeight?barHeight/2:initialBorderRadius;var showTopBorder=keyIndex===stack.length-1;var showBottomBorder=keyIndex===0;var commands=_this2.coordinatesToPathCommands(x0,y0,x1,y1,borderRadius,showTopBorder,showBottomBorder);return{path:_this2.commandsToSvgPath(commands),color:colors[stackIndex][keyIndex],key:keys[stackIndex][keyIndex]};});});});}return array.merge(areas);}},{key:\"calcExtent\",value:function calcExtent(values){var _this$props4=this.props,gridMax=_this$props4.gridMax,gridMin=_this$props4.gridMin;var mergedValues=array.merge(values);return array.extent([].concat((0,_toConsumableArray2.default)(mergedValues),[gridMin,gridMax]));}},{key:\"calcIndexes\",value:function calcIndexes(){var data=this.props.data;return data[0].data.map(function(_,index){return index;});}},{key:\"getSeries\",value:function getSeries(){var _this$props5=this.props,data=_this$props5.data,keys=_this$props5.keys,offset=_this$props5.offset,order=_this$props5.order,valueAccessor=_this$props5.valueAccessor;return data.map(function(obj,index){return shape.stack().keys(keys[index]).value(function(item,key){return valueAccessor({item:item,key:key});}).order(order).offset(offset)(obj.data);});}},{key:\"render\",value:function render(){var _this3=this;var _this$props6=this.props,data=_this$props6.data,animate=_this$props6.animate,animationDuration=_this$props6.animationDuration,style=_this$props6.style,numberOfTicks=_this$props6.numberOfTicks,children=_this$props6.children,horizontal=_this$props6.horizontal;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=this.getSeries();var values=array.merge(array.merge(series));var indexes=this.calcIndexes(values);var extent=this.calcExtent(values);var ticks=array.ticks(extent[0],extent[1],numberOfTicks);var xDomain=horizontal?extent:indexes;var yDomain=horizontal?indexes:extent;var x=this.calcXScale(xDomain);var y=this.calcYScale(yDomain);var bandwidth=horizontal?y.bandwidth():x.bandwidth();var stacks=this.calcAreas(x,y,series);var extraProps={x:x,y:y,width:width,height:height,ticks:ticks,data:data,bandwidth:bandwidth};return _react.default.createElement(_View.default,{style:style},_react.default.createElement(_View.default,{style:{flex:1},onLayout:function onLayout(event){return _this3._onLayout(event);}},height>0&&width>0&&_react.default.createElement(_reactNativeSvg.default,{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;}),stacks.map(function(areas,indexStack){var areaIndex=indexStack%data.length;return areas.map(function(bar,indexArea){var keyIndex=indexArea%data[areaIndex].data.length;var key=areaIndex+\"-\"+keyIndex+\"-\"+bar.key;var svg=data[areaIndex].data[keyIndex][bar.key].svg;return _react.default.createElement(_animatedPath.default,(0,_extends2.default)({key:key,fill:bar.color},svg,{d:bar.path,animate:animate,animationDuration:animationDuration}));});}),_react.default.Children.map(children,function(child){if(child&&!child.props.belowChart){return _react.default.cloneElement(child,extraProps);}return null;}))));}}]);return StackedBarGrouped;}(_react.PureComponent);StackedBarGrouped.propTypes={data:_propTypes.default.arrayOf(_propTypes.default.object),keys:_propTypes.default.arrayOf(_propTypes.default.arrayOf(_propTypes.default.string)).isRequired,colors:_propTypes.default.arrayOf(_propTypes.default.arrayOf(_propTypes.default.string)).isRequired,offset:_propTypes.default.func,order:_propTypes.default.func,style:_propTypes.default.any,spacingInner:_propTypes.default.number,spacingOuter:_propTypes.default.number,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}),gridMin:_propTypes.default.number,gridMax:_propTypes.default.number,valueAccessor:_propTypes.default.func,borderRadius:_propTypes.default.number,innerBarSpace:_propTypes.default.number};StackedBarGrouped.defaultProps={spacingInner:0.05,spacingOuter:0.05,offset:shape.stackOffsetNone,order:shape.stackOrderNone,width:100,height:100,showZeroAxis:true,contentInset:{},numberOfTicks:10,showGrid:true,valueAccessor:function valueAccessor(_ref){var item=_ref.item,key=_ref.key;return item[key];},borderRadius:0,innerBarSpace:0};var _default=StackedBarGrouped;exports.default=_default;","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-svg-charts/src/stacked-bar-chart/stacked-bar-grouped.js"],"names":["StackedBarGrouped","state","width","height","coordinatesToPathCommands","x0","y0","x1","y1","borderRadius","showTopBorder","showBottomBorder","commands","push","marker","values","topLeft1","topLeft2","bottomLeft1","bottomLeft2","bottomRight1","bottomRight2","topRight1","topRight2","commandsToSvgPath","map","command","join","trim","event","nativeEvent","layout","setState","domain","props","horizontal","contentInset","left","right","spacingInner","spacingOuter","scale","scaleLinear","range","scaleBand","paddingInner","paddingOuter","top","bottom","x","y","series","colors","keys","data","initialBorderRadius","innerBarSpace","areas","barWidth","bandwidth","length","stack","stackIndex","serie","keyIndex","entry","entryIndex","leftMargin","path","shape","area","d","_index","defined","isNaN","color","key","barHeight","array","merge","gridMax","gridMin","mergedValues","extent","_","index","offset","order","valueAccessor","obj","value","item","animate","animationDuration","style","numberOfTicks","children","getSeries","indexes","calcIndexes","calcExtent","ticks","xDomain","yDomain","calcXScale","calcYScale","stacks","calcAreas","extraProps","flex","_onLayout","React","Children","child","belowChart","cloneElement","indexStack","areaIndex","bar","indexArea","svg","PureComponent","propTypes","PropTypes","arrayOf","object","string","isRequired","func","any","number","bool","defaultProps","stackOffsetNone","stackOrderNone","showZeroAxis","showGrid"],"mappings":"s4BAAA,qD,gFAEA,6DACA,wEACA,uDACA,uDACA,uDACA,sE,GAEMA,CAAAA,iB,0dACFC,K,CAAQ,CACJC,KAAK,CAAE,CADH,CAEJC,MAAM,CAAE,CAFJ,C,OAuIRC,yB,CAA4B,SAACC,EAAD,CAAKC,EAAL,CAASC,EAAT,CAAaC,EAAb,CAAiBC,YAAjB,CAA+BC,aAA/B,CAA8CC,gBAA9C,CAAmE,CAC3F,GAAMC,CAAAA,QAAQ,CAAG,EAAjB,CACAA,QAAQ,CAACC,IAAT,CAAc,CAAEC,MAAM,CAAE,GAAV,CAAeC,MAAM,CAAE,CAACV,EAAD,CAAKC,EA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esContent":["import React, { PureComponent } from 'react'\nimport { View } from 'react-native'\nimport PropTypes from 'prop-types'\nimport Svg from 'react-native-svg'\nimport * as array from 'd3-array'\nimport * as scale from 'd3-scale'\nimport * as shape from 'd3-shape'\nimport Path from '../animated-path'\n\nclass StackedBarGrouped extends PureComponent {\n state = {\n width: 0,\n height: 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 calcXScale(domain) {\n const {\n horizontal,\n contentInset: { left = 0, right = 0 },\n spacingInner,\n spacingOuter,\n } = this.props\n\n const { width } = this.state\n\n if (horizontal) {\n return scale\n .scaleLinear()\n .domain(domain)\n .range([left, width - right])\n }\n\n return scale\n .scaleBand()\n .domain(domain)\n .range([left, width - right])\n .paddingInner([spacingInner])\n .paddingOuter([spacingOuter])\n }\n\n calcYScale(domain) {\n const {\n horizontal,\n contentInset: { top = 0, bottom = 0 },\n spacingInner,\n spacingOuter,\n } = this.props\n\n const { height } = this.state\n\n if (horizontal) {\n return scale\n .scaleBand()\n .domain(domain)\n .range([top, height - bottom])\n .paddingInner([spacingInner])\n .paddingOuter([spacingOuter])\n }\n\n return scale\n .scaleLinear()\n .domain(domain)\n .range([height - bottom, top])\n }\n\n calcAreas(x, y, series) {\n const { horizontal, colors, keys, data, borderRadius: initialBorderRadius, innerBarSpace } = this.props\n let areas\n let barWidth\n\n if (horizontal) {\n barWidth = y.bandwidth() / data.length\n\n areas = series.map((stack, stackIndex) => {\n return stack.map((serie, keyIndex) => {\n return serie.map((entry, entryIndex) => {\n const leftMargin = series.length > 1 ? innerBarSpace / 2 : 0\n\n const path = shape\n .area()\n .x0((d) => x(d[0]))\n .x1((d) => x(d[1]))\n .y(\n (d, _index) =>\n (_index === 0\n ? y(entryIndex) + barWidth * stackIndex + leftMargin\n : y(entryIndex) + barWidth + barWidth * stackIndex) - leftMargin\n )\n .defined((d) => !isNaN(d[0]) && !isNaN(d[1]))([entry, entry])\n\n return {\n path,\n color: colors[stackIndex][keyIndex],\n key: keys[stackIndex][keyIndex],\n }\n })\n })\n })\n } else {\n barWidth = x.bandwidth() / data.length\n\n areas = series.map((stack, stackIndex) => {\n return stack.map((serie, keyIndex) => {\n return serie.map((entry, entryIndex) => {\n const leftMargin = series.length > 1 ? innerBarSpace / 2 : 0\n const x0 = x(entryIndex) + barWidth * stackIndex + leftMargin\n const x1 = x(entryIndex) + barWidth + barWidth * stackIndex - leftMargin\n const y0 = y(entry[1])\n const y1 = y(entry[0])\n const barHeight = y1 - y0\n const borderRadius = initialBorderRadius * 2 > barHeight ? barHeight / 2 : initialBorderRadius\n const showTopBorder = keyIndex === stack.length - 1\n const showBottomBorder = keyIndex === 0\n const commands = this.coordinatesToPathCommands(\n x0,\n y0,\n x1,\n y1,\n borderRadius,\n showTopBorder,\n showBottomBorder\n )\n\n return {\n path: this.commandsToSvgPath(commands),\n color: colors[stackIndex][keyIndex],\n key: keys[stackIndex][keyIndex],\n }\n })\n })\n })\n }\n\n return array.merge(areas)\n }\n\n coordinatesToPathCommands = (x0, y0, x1, y1, borderRadius, showTopBorder, showBottomBorder) => {\n const commands = []\n commands.push({ marker: 'M', values: [x0, y0] })\n\n if (showTopBorder) {\n const topLeft1 = [x0 + borderRadius, y0]\n const topLeft2 = [x0, y0 + borderRadius]\n commands.push({ marker: 'L', values: topLeft1 })\n commands.push({\n marker: 'C',\n values: [...topLeft1, x0, y0, ...topLeft2],\n })\n commands.push({ marker: 'L', values: topLeft2 })\n } else {\n commands.push({ marker: 'L', values: [x0, y0] })\n }\n\n if (showBottomBorder) {\n const bottomLeft1 = [x0, y1 - borderRadius]\n const bottomLeft2 = [x0 + borderRadius, y1]\n commands.push({ marker: 'L', values: bottomLeft1 })\n commands.push({\n marker: 'C',\n values: [...bottomLeft1, x0, y1, ...bottomLeft2],\n })\n commands.push({ marker: 'L', values: bottomLeft2 })\n const bottomRight1 = [x1 - borderRadius, y1]\n const bottomRight2 = [x1, y1 - borderRadius]\n commands.push({ marker: 'L', values: bottomRight1 })\n commands.push({\n marker: 'C',\n values: [...bottomRight1, x1, y1, ...bottomRight2],\n })\n commands.push({ marker: 'L', values: bottomRight2 })\n } else {\n commands.push({ marker: 'L', values: [x0, y1] })\n commands.push({ marker: 'L', values: [x1, y1] })\n }\n\n if (showTopBorder) {\n const topRight1 = [x1, y0 + borderRadius]\n const topRight2 = [x1 - borderRadius, y0]\n\n commands.push({ marker: 'L', values: topRight1 })\n commands.push({\n marker: 'C',\n values: [...topRight1, x1, y0, ...topRight2],\n })\n commands.push({ marker: 'L', values: topRight2 })\n } else {\n commands.push({ marker: 'L', values: [x1, y0] })\n }\n\n commands.push({ marker: 'Z', values: [] })\n\n return commands\n }\n\n commandsToSvgPath = (commands) =>\n commands\n .map((command) => `${command.marker} ${command.values.join(',')}`)\n .join(' ')\n .trim()\n\n calcExtent(values) {\n const { gridMax, gridMin } = this.props\n\n // One more merge for stacked groups\n const mergedValues = array.merge(values)\n\n return array.extent([...mergedValues, gridMin, gridMax])\n }\n\n calcIndexes() {\n const { data } = this.props\n\n // Must return an array with indexes for the number of groups to be shown\n return data[0].data.map((_, index) => index)\n }\n\n getSeries() {\n const { data, keys, offset, order, valueAccessor } = this.props\n\n return data.map((obj, index) =>\n shape\n .stack()\n .keys(keys[index])\n .value((item, key) => valueAccessor({ item, key }))\n .order(order)\n .offset(offset)(obj.data)\n )\n }\n\n render() {\n const { data, animate, animationDuration, style, numberOfTicks, children, horizontal } = 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 = this.getSeries()\n\n //double merge arrays to extract just the values\n const values = array.merge(array.merge(series))\n const indexes = this.calcIndexes(values)\n\n const extent = this.calcExtent(values)\n const ticks = array.ticks(extent[0], extent[1], numberOfTicks)\n\n const xDomain = horizontal ? extent : indexes\n const yDomain = horizontal ? indexes : extent\n\n const x = this.calcXScale(xDomain)\n const y = this.calcYScale(yDomain)\n\n const bandwidth = horizontal ? y.bandwidth() : x.bandwidth()\n\n const stacks = this.calcAreas(x, y, series)\n\n const extraProps = {\n x,\n y,\n width,\n height,\n ticks,\n data,\n bandwidth,\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 {stacks.map((areas, indexStack) => {\n const areaIndex = indexStack % data.length\n\n return areas.map((bar, indexArea) => {\n const keyIndex = indexArea % data[areaIndex].data.length\n const key = `${areaIndex}-${keyIndex}-${bar.key}`\n\n const { svg } = data[areaIndex].data[keyIndex][bar.key]\n\n return (\n <Path\n key={key}\n fill={bar.color}\n {...svg}\n d={bar.path}\n animate={animate}\n animationDuration={animationDuration}\n />\n )\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\nStackedBarGrouped.propTypes = {\n data: PropTypes.arrayOf(PropTypes.object),\n keys: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)).isRequired,\n colors: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)).isRequired,\n offset: PropTypes.func,\n order: PropTypes.func,\n style: PropTypes.any,\n spacingInner: PropTypes.number,\n spacingOuter: PropTypes.number,\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 gridMin: PropTypes.number,\n gridMax: PropTypes.number,\n valueAccessor: PropTypes.func,\n borderRadius: PropTypes.number,\n innerBarSpace: PropTypes.number,\n}\n\nStackedBarGrouped.defaultProps = {\n spacingInner: 0.05,\n spacingOuter: 0.05,\n offset: shape.stackOffsetNone,\n order: shape.stackOrderNone,\n width: 100,\n height: 100,\n showZeroAxis: true,\n contentInset: {},\n numberOfTicks: 10,\n showGrid: true,\n valueAccessor: ({ item, key }) => item[key],\n borderRadius: 0,\n innerBarSpace: 0,\n}\n\nexport default StackedBarGrouped\n"]},"metadata":{},"sourceType":"script"}