text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("echarts/lib/echarts"),require("echarts/lib/component/tooltip"),require("echarts/lib/component/legend"),require("echarts/lib/chart/bar")):"function"==typeof define&&define.amd?define(["echarts/lib/echarts","echarts/lib/component/tooltip","echarts/lib/component/legend","echarts/lib/chart/bar"],e):t.VeWaterfall=e(t.echarts)}(this,function(t){"use strict";function e(t,e){return{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(i){var a=i[1];return[a.name+"<br/>"+a.seriesName+" :",""+h(a.value,t,e)].join("")}}}function i(t){var e=t.dimension,i=t.rows,a=t.remainStatus,r=t.totalName,n=t.remainName,s=t.xAxisName,o=t.axisVisible,c=[r].concat(i.map(function(t){return t[e]}));return"have-remain"===a&&(c=c.concat([n])),{type:"category",name:s,splitLine:{show:!1},data:c,show:o}}function a(t){var e=t.dataType,i=t.yAxisName,a=t.axisVisible,r=t.digit;return{type:"value",name:i,axisTick:{show:!1},axisLabel:{formatter:function(t){return h(t,e,r)}},show:a}}function r(t){var e=t.dataType,i=t.rows,a=t.metrics,r=t.totalNum,n=t.remainStatus,s=t.dataSum,o=t.digit,c={type:"bar",stack:"总量"},l=s,d=r,u=void 0,f=void 0,m=i.map(function(t){return t[a]});"have-remain"===n?(u=[0].concat(i.map(function(t){return d-=t[a]})).concat([0]),f=[r].concat(m).concat([r-s])):(u=[0].concat(i.map(function(t){return l-=t[a]})),f=[s].concat(m));var b=[];return b.push(Object.assign({name:"辅助",itemStyle:{normal:{opacity:0},emphasis:{opacity:0}},data:u},c)),b.push(Object.assign({name:"数值",label:{normal:{show:!0,position:"top",formatter:function(t){return h(t.value,e,o)}}},data:f},c)),b}function n(t,e){return e?e>t?"have-remain":"none-remain":"not-total"}t="default"in t?t.default:t,"function"!=typeof Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var e=1;e<arguments.length;e++){var i=arguments[e];if(null!=i)for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t}),t.registerTheme("ve-chart",{categoryAxis:{axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1}},valueAxis:{axisLine:{show:!1}},line:{smooth:!0},grid:{containLabel:!0,left:10,right:10}});var s=["#19d4ae","#5ab1ef","#fa6e86","#ffb980","#0067a6","#c4b4e4","#d87a80","#9cbbff","#d9d0c7","#87a997","#d49ea2","#5b4947","#7ba3a8"],o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(isNaN(+t))return t;for(var i=[{value:1e18,symbol:"E"},{value:1e15,symbol:"P"},{value:1e12,symbol:"T"},{value:1e9,symbol:"B"},{value:1e6,symbol:"M"},{value:1e3,symbol:"k"}],a=0;a<i.length;a++)if(Math.abs(t)>=i[a].value)return(t/i[a].value).toFixed(e)+i[a].symbol;return t.toString()},c=function(t){return String(t).replace(/^(\s+|-)?\d+(?=.?\d*($|\s))/g,function(t){return t.replace(/(?=(?!\b)(\d{3})+$)/g,",")})},h=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";if(isNaN(t))return a;switch(e){case"KMB":return o(t);case"percent":return parseFloat((100*t).toFixed(i))+"%";case"normal":return c(t);default:return t}},l=function(t,s,o,c){var h=o.dataType,l=void 0===h?"normal":h,d=o.dimension,u=void 0===d?t[0]:d,f=o.totalName,m=void 0===f?"总计":f,b=o.totalNum,p=o.remainName,g=void 0===p?"其他":p,y=o.xAxisName,v=void 0===y?u:y,x=o.axisVisible,O=void 0===x||x,j=o.digit,w=void 0===j?2:j,A=c.tooltipVisible,k=t.slice();k.splice(k.indexOf(u),1);var S=k[0],N=S,T=A&&e(l,w),P=s.reduce(function(t,e){return t+Number(e[S])},0).toFixed(2),L=n(P,b);return{tooltip:T,xAxis:i({dimension:u,rows:s,remainStatus:L,totalName:m,remainName:g,xAxisName:v,axisVisible:O}),yAxis:a({dataType:l,yAxisName:N,axisVisible:O,digit:w}),series:r({dataType:l,rows:s,dimension:u,metrics:S,totalNum:b,remainStatus:L,dataSum:P,digit:w})}};return{render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{ref:"canvas",staticClass:"ve-waterfall",style:t.canvasStyle})},staticRenderFns:[],name:"VeWaterfall",mixins:[{props:{data:{type:[Object,Array],default:null},settings:{type:Object,default:function(){return{}}},width:{type:String,default:"auto"},height:{type:String,default:"400px"},beforeConfig:{type:Function},afterConfig:{type:Function},events:{type:Object},grid:{type:Object},colors:{type:Array},tooltipVisible:{type:Boolean,default:!0},legendVisible:{type:Boolean,default:!0},legendPosition:{type:String},markLine:{type:Object},markArea:{type:Object},markPoint:{type:Object},visualMap:{type:[Object,Array]},dataZoom:{type:[Object,Array]},toolbox:{type:Object},initOptions:{type:Object,default:function(){return{}}},title:Object,legend:Object,xAxis:Object,yAxis:Object,radar:Object,tooltip:Object,axisPointer:Object,brush:Object,geo:Object,timeline:Object,graphic:Object,series:Object,backgroundColor:[Object,String],textStyle:Object,animation:Object,theme:Object},watch:{data:{deep:!0,handler:function(t){t&&this.dataHandler(t)}},settings:{deep:!0,handler:function(t){t.type&&this.chartLib&&(this.chartHandler=this.chartLib[t.type]),this.dataHandler(this.data)}}},computed:{canvasStyle:function(){return{width:this.width,height:this.height,position:"relative"}},chartColor:function(){return this.colors||this.theme&&this.theme.color||s}},methods:{dataHandler:function(t){if(this.chartHandler){if(!t||!Array.isArray(t.columns)||!Array.isArray(t.rows))return!1;var e=t,i=e.columns,a=e.rows,r={tooltipVisible:this.tooltipVisible,legendVisible:this.legendVisible,echarts:this.echarts,color:this.chartColor};this.beforeConfig&&(t=this.beforeConfig(t));var n=this.chartHandler(i,a,this.settings,r);n&&("function"==typeof n.then?n.then(this.optionsHandler):this.optionsHandler(n))}},optionsHandler:function(t){var e=this;if(this.legendPosition&&t.legend&&(t.legend[this.legendPosition]=10,~["left","right"].indexOf(this.legendPosition)&&(t.legend.top="middle",t.legend.orient="vertical")),t.color=this.chartColor,this.grid&&(t.grid=this.grid),this.dataZoom&&(t.dataZoom=this.dataZoom),this.visualMap&&(t.visualMap=this.visualMap),this.toolbox&&(t.toolbox=this.toolbox),this.title&&(t.title=this.title),this.legend&&(t.legend=this.legend),this.xAxis&&(t.xAxis=this.xAxis),this.yAxis&&(t.yAxis=this.yAxis),this.radar&&(t.radar=this.radar),this.tooltip&&(t.tooltip=this.tooltip),this.axisPointer&&(t.axisPointer=this.axisPointer),this.brush&&(t.brush=this.brush),this.geo&&(t.geo=this.geo),this.timeline&&(t.timeline=this.timeline),this.graphic&&(t.graphic=this.graphic),this.series&&(t.series=this.series),this.backgroundColor&&(t.backgroundColor=this.backgroundColor),this.textStyle&&(t.textStyle=this.textStyle),this.animation&&Object.keys(this.animation).forEach(function(i){t[i]=e.animation[i]}),this.markArea||this.markLine||this.markPoint){var i={markArea:this.markArea,markLine:this.markLine,markPoint:this.markPoint},a=t.series;"[object Array]"===this.getType(a)?a.forEach(function(t){e.addMark(t,i)}):"[object Object]"===this.getType(a)&&this.addMark(a,i)}this.afterConfig&&(t=this.afterConfig(t)),this.echarts.setOption(t,!0)},addMark:function(t,e){Object.keys(e).forEach(function(i){e[i]&&(t[i]=e[i])})},getType:function(t){return Object.prototype.toString.call(t)},init:function(){if(!this.echarts){var t=this.theme?"outer-theme":"ve-chart";this.echarts=this.echartsLib.init(this.$refs.canvas,t,this.initOptions),this.data&&this.dataHandler(this.data),this.events&&this.bindEvents()}},bindEvents:function(){var t=this;Object.keys(this.events).forEach(function(e){t.echarts.on(e,t.events[e])})},addWatchToProps:function(){var t=this,e=this._watchers.map(function(t){return t.expression});Object.keys(this.$props).forEach(function(i){if(!~e.indexOf(i)){var a={};"[object Object]"===Object.prototype.toString.call(i)&&(a.deep=!0),t.$watch(i,function(){t.dataHandler(t.data)},a)}})},registerTheme:function(){t.registerTheme("outer-theme",this.theme)}},created:function(){this.addWatchToProps(),this.theme&&this.registerTheme()},mounted:function(){this.init(),window.addEventListener("resize",this.echarts.resize)},beforeDestory:function(){window.removeEventListener("resize",this.echarts.resize),this.echarts.dispose()}}],created:function(){this.chartHandler=l,this.echartsLib=t}}});
  