text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("echarts/lib/echarts"),require("echarts/lib/component/tooltip"),require("echarts/lib/component/legend"),require("echarts/lib/chart/sankey")):"function"==typeof define&&define.amd?define(["echarts/lib/echarts","echarts/lib/component/tooltip","echarts/lib/component/legend","echarts/lib/chart/sankey"],t):e.VeSankey=t(e.echarts)}(this,function(e){"use strict";(e=e&&e.hasOwnProperty("default")?e.default:e).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 t=function(e){return['<span style="',"background-color:"+e+";","display: inline-block;","width: 10px;","height: 10px;","border-radius: 50%;","margin-right:2px;",'"></span>'].join("")},i=["#19d4ae","#5ab1ef","#fa6e86","#ffb980","#0067a6","#c4b4e4","#d87a80","#9cbbff","#d9d0c7","#87a997","#d49ea2","#5b4947","#7ba3a8"],n={th:3,mi:6,bi:9,tr:12},r={zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0,abbrLabel:{th:"k",mi:"m",bi:"b",tr:"t"}},a=1e12,o=1e9,s=1e6,l=1e3;function c(e,t,i,n){var r=e.toString().split("."),a=t-(n||0),o=2===r.length?Math.min(Math.max(r[1].length,a),t):a,s=Math.pow(10,o),l=(i(e+"e+"+o)/s).toFixed(o);if(n>t-o){var c=new RegExp("\\.?0{1,"+(n-(t-o))+"}$");l=l.replace(c,"")}return l}function h(e,t,i,r){var h=Math.abs(t),d=!1,u=!1,f="",p="",b=!1,m=void 0,y=void 0;i=i||"",t=t||0,~i.indexOf("(")?(d=!0,i=i.replace(/[(|)]/g,"")):(~i.indexOf("+")||~i.indexOf("-"))&&(y=~i.indexOf("+")?i.indexOf("+"):t<0?i.indexOf("-"):-1,i=i.replace(/[+|-]/g,"")),~i.indexOf("a")&&(m=!!(m=i.match(/a(k|m|b|t)?/))&&m[1],~i.indexOf(" a")&&(f=" "),i=i.replace(new RegExp(f+"a[kmbt]?"),""),h>=a&&!m||"t"===m?(f+=e.abbrLabel.tr,t/=a):h<a&&h>=o&&!m||"b"===m?(f+=e.abbrLabel.bi,t/=o):h<o&&h>=s&&!m||"m"===m?(f+=e.abbrLabel.mi,t/=s):(h<s&&h>=l&&!m||"k"===m)&&(f+=e.abbrLabel.th,t/=l)),~i.indexOf("[.]")&&(u=!0,i=i.replace("[.]","."));var g=t.toString().split(".")[0],v=i.split(".")[1],O=i.indexOf(","),x=(i.split(".")[0].split(",")[0].match(/0/g)||[]).length;if(v?(g=(p=~v.indexOf("[")?c(t,(v=(v=v.replace("]","")).split("["))[0].length+v[1].length,r,v[1].length):c(t,v.length,r)).split(".")[0],p=~p.indexOf(".")?"."+p.split(".")[1]:"",u&&0==+p.slice(1)&&(p="")):g=c(t,0,r),f&&!m&&+g>=1e3&&f!==n.trillion&&(g=""+ +g/1e3,f=n.million),~g.indexOf("-")&&(g=g.slice(1),b=!0),g.length<x)for(var j=x-g.length;j>0;j--)g="0"+g;O>-1&&(g=g.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")),i.indexOf(".")||(g="");var k=g+p+(f||"");return d?k=(d&&b?"(":"")+k+(d&&b?")":""):y>=0?k=0===y?(b?"-":"+")+k:k+(b?"-":"+"):b&&(k="-"+k),k}function d(e,t){Object.keys(t).forEach(function(i){e[i]=t[i]})}var u={},f={};function p(e,t,i){var n=void 0;return 0===e||void 0===e?n=0:null===e||function(e){return"number"==typeof e&&isNaN(e)}(e)?n=null:"string"==typeof e?u.zeroFormat&&e===u.zeroFormat?n=0:(u.nullFormat&&e===u.nullFormat||!e.replace(/[^0-9]+/g,"").length)&&(n=null):n=+e||null,function(e,t,i){t=t||u.defaultFormat,i=i||Math.round;var n=void 0,r=void 0;if(0===e&&null!==u.zeroFormat)n=u.zeroFormat;else if(null===e&&null!==u.nullFormat)n=u.nullFormat;else{for(var a in f)if(f[a]&&t.match(f[a].regexp)){r=f[a].format;break}n=(r=r||h.bind(null,u))(e,t,i,p)}return n}(n,t,i)}function b(e,t){var i=null;return function(){var n=this,r=arguments;clearTimeout(i),i=setTimeout(function(){e.apply(n,r)},t)}}function m(e){return Object.prototype.toString.call(e)}function y(e){return"[object Object]"===m(e)}d(u,r),p.options=u,p._numberToFormat=h.bind(null,u),p.register=function(e,t){f[e]=t},p.unregister=function(e){f[e]=null},p.setOptions=function(e){d(u,e)},p.reset=function(){d(u,r)},p.register("percentage",{regexp:/%/,format:function(e,t,i,n){var r=~t.indexOf(" %")?" ":"",a=void 0;return n.options.scalePercentBy100&&(e*=100),t=t.replace(/\s?%/,""),~(a=n._numberToFormat(e,t,i)).indexOf(")")?((a=a.split("")).splice(-1,0,r+"%"),a=a.join("")):a=a+r+"%",a}});var g=function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";if(isNaN(e))return n;if(!t)return e;if("[object Function]"===m(t))return t(e,p);i=isNaN(i)?0:++i;var r=".["+new Array(i).join(0)+"]",a=t;switch(t){case"KMB":a=i?"0,0"+r+"a":"0,0a";break;case"normal":a=i?"0,0"+r:"0,0";break;case"percent":a=i?"0,0"+r+"%":"0,0.[00]%"}return p(e,a)},v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e};var O=function(e,i,n,r){var a=n.links,o=n.dimension,s=void 0===o?e[0]:o,l=n.metrics,c=void 0===l?e[1]:l,h=n.dataType,d=void 0===h?["normal","normal"]:h,u=n.digit,f=void 0===u?2:u,p=n.valueFull,b=void 0!==p&&p,m=n.useDataValue,y=void 0!==m&&m,O=n.label,x=n.itemStyle,j=n.lineStyle;if(a)return{tooltip:function(e){var i=e.itemDataType,n=e.linksDataType,r=e.digit;return{trigger:"item",formatter:function(e){var a=[],o=e.name,s=e.data,l=e.value,c=e.color;return a.push(t(c)),a.push(o+" : "),s&&s.source?a.push(g(l,n,r)+"<br />"):a.push(g(l,i,r)+"<br />"),a.join("")}}}({itemDataType:d[0],linksDataType:d[1],digit:f}),series:function(e){var t=e.rows,i=e.dimension,n=e.metrics,r=e.links,a=e.valueFull,o=e.useDataValue,s=e.label,l=e.itemStyle,c=e.lineStyle,h={},d={type:"sankey",data:t.map(function(e){return h[e[i]]=e[n],{name:e[i],value:e[n]}}),links:o?r.map(function(e){return v({},e,{value:h[e.target]})}):a?r:r.map(function(e){return null==e.value?v({},e,{value:h[e.target]}):e})};return s&&(d.label=s),l&&(d.itemStyle=l),c&&(d.lineStyle=c),[d]}({rows:i,dimension:s,metrics:c,links:a,valueFull:b,useDataValue:y,label:O,itemStyle:x,lineStyle:j})};console.warn("links is needed in settings!")},x={render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"v-charts-component-loading"},[t("div",{staticClass:"loader"},[t("div",{staticClass:"loading-spinner"},[t("svg",{staticClass:"circular",attrs:{viewBox:"25 25 50 50"}},[t("circle",{staticClass:"path",attrs:{cx:"50",cy:"50",r:"20",fill:"none"}})])])])])},staticRenderFns:[]},j={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"v-charts-data-empty"},[this._v(" 暂无数据 ")])},staticRenderFns:[]},k=["initOptions","loading","dataEmpty","judgeWidth","widthChangeDelay"];return{name:"VeSankey",mixins:[{render:function(e){return e("div",{class:[(t=this.$options.name||this.$options._componentTag,t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())],style:this.canvasStyle},[e("div",{style:this.canvasStyle,ref:"canvas"}),e(j,{style:{display:this.dataEmpty?"":"none"}}),e(x,{style:{display:this.loading?"":"none"}}),this.$slots.default]);var t},props:{data:{type:[Object,Array],default:function(){return{}}},settings:{type:Object,default:function(){return{}}},width:{type:String,default:"auto"},height:{type:String,default:"400px"},beforeConfig:{type:Function},afterConfig:{type:Function},afterSetOption:{type:Function},afterSetOptionOnce:{type:Function},events:{type:Object},grid:{type:[Object,Array]},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,Array]},initOptions:{type:Object,default:function(){return{}}},title:[Object,Array],legend:[Object,Array],xAxis:[Object,Array],yAxis:[Object,Array],radar:Object,tooltip:Object,axisPointer:[Object,Array],brush:[Object,Array],geo:[Object,Array],timeline:[Object,Array],graphic:[Object,Array],series:[Object,Array],backgroundColor:[Object,String],textStyle:[Object,Array],animation:Object,theme:Object,themeName:String,loading:Boolean,dataEmpty:Boolean,extend:Object,judgeWidth:{type:Boolean,default:!1},widthChangeDelay:{type:Number,default:300},tooltipFormatter:{type:Function},resizeable:{type:Boolean,default:!0},resizeDelay:{type:Number,default:200},changeDelay:{type:Number,default:0},setOptionOpts:{type:[Boolean,Object],default:!0}},watch:{data:{deep:!0,handler:function(e){e&&this.changeHandler()}},settings:{deep:!0,handler:function(e){e.type&&this.chartLib&&(this.chartHandler=this.chartLib[e.type]),this.changeHandler()}},width:"nextTickResize",height:"nextTickResize",events:{deep:!0,handler:function(){this.createEventProxy()}},theme:{deep:!0,handler:function(e){this.themeChange(e)}},themeName:function(e){this.themeChange(e)}},computed:{canvasStyle:function(){return{width:this.width,height:this.height,position:"relative"}},chartColor:function(){return this.colors||this.theme&&this.theme.color||i}},methods:{dataHandler:function(){if(this.chartHandler){var e=this.data,t=e,i=t.columns,n=void 0===i?[]:i,r=t.rows,a=void 0===r?[]:r,o={tooltipVisible:this.tooltipVisible,legendVisible:this.legendVisible,echarts:this.echarts,color:this.chartColor,tooltipFormatter:this.tooltipFormatter,_once:this._once};this.beforeConfig&&(e=this.beforeConfig(e));var s=this.chartHandler(n,a,this.settings,o);s&&("function"==typeof s.then?s.then(this.optionsHandler):this.optionsHandler(s))}},nextTickResize:function(){var e=this;this.$nextTick(function(t){e.echarts.resize()})},resize:function(){this.echarts.resize()},optionsHandler:function(e){var t=this;this.legendPosition&&e.legend&&(e.legend[this.legendPosition]=10,~["left","right"].indexOf(this.legendPosition)&&(e.legend.top="middle",e.legend.orient="vertical")),this.themeName||(e.color=this.chartColor);if(["grid","dataZoom","visualMap","toolbox","title","legend","xAxis","yAxis","radar","tooltip","axisPointer","brush","geo","timeline","graphic","series","backgroundColor","textStyle"].forEach(function(i){t[i]&&(e[i]=t[i])}),this.animation&&Object.keys(this.animation).forEach(function(i){e[i]=t.animation[i]}),this.markArea||this.markLine||this.markPoint){var i={markArea:this.markArea,markLine:this.markLine,markPoint:this.markPoint},n=e.series;"[object Array]"===m(n)?n.forEach(function(e){t.addMark(e,i)}):"[object Object]"===m(n)&&this.addMark(n,i)}this.extend&&Object.keys(this.extend).forEach(function(i){var n=t.extend[i];~i.indexOf(".")?function(e,t,i){if(t){var n=e,r=t.split(".");r.forEach(function(e,t){t===r.length-1?n[e]=i:(n[e]||(n[e]={}),n=n[e])})}}(e,i,n):"function"==typeof n?e[i]=n(e[i]):"[object Array]"===m(e[i])&&y(e[i][0])?e[i].forEach(function(t,r){e[i][r]=v({},t,n)}):y(e[i])?e[i]=v({},e[i],n):e[i]=n}),this.afterConfig&&(e=this.afterConfig(e)),this.echarts.setOption(e,this.setOptionOpts),this.$emit("ready",this.echarts),this._once["ready-once"]||(this._once["ready-once"]=!0,this.$emit("ready-once",this.echarts)),this.judgeWidth&&this.judgeWidthHandler(e),this.afterSetOption&&this.afterSetOption(this.echarts),this.afterSetOptionOnce&&!this._once.afterSetOptionOnce&&(this._once.afterSetOptionOnce=!0,this.afterSetOptionOnce(this.echarts))},judgeWidthHandler:function(e){var t=this,i=this.echarts,n=this.widthChangeDelay;this.$el.clientWidth?i&&i.resize():this.$nextTick(function(e){t.$el.clientWidth?i&&i.resize():setTimeout(function(e){i&&i.resize(),t.$el.clientWidth||console.warn(" Can't get dom width or height ")},n)})},addMark:function(e,t){Object.keys(t).forEach(function(i){t[i]&&(e[i]=t[i])})},init:function(){if(!this.echarts){var e=this.themeName||this.theme||"ve-chart";this.echarts=this.echartsLib.init(this.$refs.canvas,e,this.initOptions),this.data&&this.changeHandler(),this.createEventProxy(),this.resizeable&&window.addEventListener("resize",this.resizeHandler)}},addWatchToProps:function(){var e=this,t=this._watchers.map(function(e){return e.expression});Object.keys(this.$props).forEach(function(i){if(!~t.indexOf(i)&&!~k.indexOf(i)){var n={};~["[object Object]","[object Array]"].indexOf(m(e.$props[i]))&&(n.deep=!0),e.$watch(i,function(){e.changeHandler()},n)}})},createEventProxy:function(){var e=this,t=this,i=Object.keys(this.events||{});i.length&&i.forEach(function(i){-1===e.registeredEvents.indexOf(i)&&(e.registeredEvents.push(i),e.echarts.on(i,function(e){return function(){if(e in t.events){for(var i=arguments.length,n=Array(i),r=0;r<i;r++)n[r]=arguments[r];t.events[e].apply(null,n)}}}(i)))})},themeChange:function(e){this.clean(),this.echarts=null,this.init()},clean:function(){this.resizeable&&window.removeEventListener("resize",this.resizeHandler),this.echarts.dispose()}},created:function(){var e=this;this.echarts=null,this.registeredEvents=[],this._once={},this.resizeHandler=b(function(t){e.echarts&&e.echarts.resize()},this.resizeDelay),this.changeHandler=b(function(t){e.dataHandler()},this.changeDelay),this.addWatchToProps()},mounted:function(){this.init()},beforeDestroy:function(){this.clean()}}],created:function(){this.chartHandler=O,this.echartsLib=e},_numerify:p}});
  