text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("echarts/lib/echarts")):"function"==typeof define&&define.amd?define(["echarts/lib/echarts"],t):e.VeLine=t(e.echarts)}(this,function(e){"use strict";function t(e){var t=e.metrics,i=e.axisSite,n=e.yAxisType,r=[],a=o;return t.forEach(function(e){var t=~i.right.indexOf(e)?""+e+s+n[1]:""+e+s+n[0];r.push(t)}),!!r.length&&{data:r,formatter:a}}function i(e){var t=e.dimension,i=e.rows,n=e.xAxisName,r=e.axisVisible;return t.map(function(e,t){return{type:"category",nameLocation:"middle",nameGap:22,boundaryGap:!1,name:n[t]||"",axisTick:{show:!0,lineStyle:{color:"#eee"}},data:i.map(function(t){return t[e]}),axisLabel:{formatter:function(e){return String(e)}},show:r}})}function n(e){var t=e.rows,i=e.axisSite,n=e.yAxisType,r=(e.dimension,e.metrics),a=e.area,o=e.stack,c=[],l={},u=o&&f(o);return r.forEach(function(e){l[e]=[]}),t.forEach(function(e){r.forEach(function(t){l[t].push(e[t]||0)})}),r.forEach(function(e){var t={name:e,type:"line",data:l[e]};a&&(t.areaStyle={normal:{}}),~i.right.indexOf(e)?(t.yAxisIndex=1,t.name=""+e+s+n[1]):(t.yAxisIndex=0,t.name=""+e+s+n[0]),o&&u[e]&&(t.stack=u[e]),c.push(t)}),!!c.length&&c}function r(e){for(var t=e.yAxisName,i=e.yAxisType,n={type:"value",axisTick:{show:!1},show:e.axisVisible},r=[],a=0;a<2;a++)!function(e){i[e]?r[e]=Object.assign({},n,{axisLabel:{formatter:function(t){return h(t,i[e])}}}):r[e]=Object.assign({},n),r[e].name=t[e]||""}(a);return r}function a(){return{trigger:"axis",formatter:function(e){var t=[];return t.push(e[0].name+"<br>"),e.forEach(function(e){var i=void 0,n=e.seriesName.split(s),r=d(n,2),a=r[0],o=r[1];i=h(e.data,o),t.push(c(e.color)),t.push(a+": "+i),t.push("<br>")}),t.join("")}}}var s="@_@",o=function(e){return e.split(s)[0]},c=function(e){return['<span style="',"background-color:"+e+";","display: inline-block;","width: 10px;","height: 10px;","border-radius: 50%;","margin-right:2px;",'"></span>'].join("")};(e="default"in e?e.default:e).registerTheme("ve-chart",{color:["#19d4ae","#5ab1ef","#fa6e86","#ffb980","#0067a6","#c4b4e4","#d87a80","#9cbbff","#d9d0c7","#87a997","#d49ea2","#5b4947","#7ba3a8"],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 l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(isNaN(+e))return e;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"}],n=0;n<i.length;n++)if(Math.abs(e)>=i[n].value)return(e/i[n].value).toFixed(t)+i[n].symbol;return e.toString()},u=function(e){return String(e).replace(/^(\s+|-)?\d+(?=.?\d*($|\s))/g,function(e){return e.replace(/(?=(?!\b)(\d{3})+$)/g,",")})},h=function(e,t){switch(t){case"KMB":return l(e);case"percent":return parseFloat((100*e).toFixed(2))+"%";case"normal":return u(e);default:return e}},f=function(e){var t={};return Object.keys(e).forEach(function(i){e[i].forEach(function(e){t[e]=i})}),t},d=function(){function e(e,t){var i=[],n=!0,r=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!t||i.length!==t);n=!0);}catch(e){r=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw a}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),y=function(e,s,o,c){var l=o.axisSite,u=void 0===l?{right:[]}:l,h=o.yAxisType,f=void 0===h?["normal","normal"]:h,d=o.yAxisName,y=void 0===d?[]:d,p=o.dimension,b=void 0===p?[e[0]]:p,x=o.xAxisName,m=void 0===x?[]:x,v=o.area,g=o.stack,A=c.tooltipVisible,w=c.legendVisible,V=c.axisVisible,E=e.slice();o.metrics?E=o.metrics:E.splice(e.indexOf(b[0]),1);var S=w&&t({metrics:E,axisSite:u,yAxisType:f}),L=A&&a(),O=i({dimension:b,rows:s,xAxisName:m,axisVisible:V}),T=r({yAxisName:y,yAxisType:f,axisVisible:V}),j=n({rows:s,stack:g,axisSite:u,yAxisType:f,dimension:b,metrics:E,area:v});return!(!O||!j)&&{legend:S,xAxis:O,series:j,yAxis:T,tooltip:L}};return{render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{ref:"canvas",staticClass:"ve-line",style:e.canvasStyle})},staticRenderFns:[],name:"VeLine",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},scale:{type:Object},tooltipVisible:{type:Boolean,default:!1},legendVisible:{type:Boolean,default:!1},axisVisible:{type:Boolean,default:!0}},watch:{data:{deep:!0,handler:function(e){e&&this.dataHandler(e)}},settings:{deep:!0,handler:function(e){e.type&&this.chartLib&&(this.chartHandler=this.chartLib[e.type]),this.dataHandler(this.data)}}},computed:{canvasStyle:function(){return{width:this.width,height:this.height}}},methods:{dataHandler:function(e){if(this.chartHandler){if(!e||!Array.isArray(e.columns)||!Array.isArray(e.rows))return!1;var t=e,i=t.columns,n=t.rows,r={tooltipVisible:this.tooltipVisible,legendVisible:this.legendVisible,axisVisible:this.axisVisible};this.beforeConfig&&(e=this.beforeConfig(e));var a=this.chartHandler(i,n,this.settings,r);this.colors&&(a.color=this.colors),this.grid&&(a.grid=this.grid),this.scale&&(a.xAxis.scale=this.scale.x,a.yAxis.scale=this.scale.y),this.afterConfig&&(a=this.afterConfig(a)),a&&this.echarts.setOption(a,!0)}},init:function(){this.echarts||(this.echarts=this.echartsLib.init(this.$refs.canvas,"ve-chart"),this.data&&this.dataHandler(this.data),this.events&&this.bindEvents())},bindEvents:function(){var e=this;Object.keys(this.events).forEach(function(t){e.echarts.on(t,e.events[t])})}},mounted:function(){var e=this;this.$nextTick(function(){e.init(),window.addEventListener("resize",e.echarts.resize)})},beforeDestory:function(){window.removeEventListener("resize",this.echarts.resize),this.echarts.dispose()}}],created:function(){this.chartHandler=y,this.echartsLib=e}}});
  