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/bar"),require("echarts/lib/chart/line"),require("echarts/lib/chart/candlestick"),require("echarts/lib/component/visualMap"),require("echarts/lib/component/dataZoom")):"function"==typeof define&&define.amd?define(["echarts/lib/echarts","echarts/lib/component/tooltip","echarts/lib/component/legend","echarts/lib/chart/bar","echarts/lib/chart/line","echarts/lib/chart/candlestick","echarts/lib/component/visualMap","echarts/lib/component/dataZoom"],t):e.VeCandle=t(e.echarts)}(this,function(e){"use strict";function t(e){var t=e.showMA,i=e.MA,n=e.legendName,a=e.labelMap,r=[x];return t&&(r=r.concat(i.map(function(e){return"MA"+e}))),a&&(r=r.map(function(e){return null==a[e]?e:a[e]})),{data:r,formatter:function(e){return null!=n[e]?n[e]:e}}}function i(e){var t=e.metrics,i=e.dataType,n=e.digit,a=e.labelMap;return{trigger:"axis",axisPointer:{type:"cross"},position:function(e,t,i,n,a){var r={top:10};return r[e[0]<a.viewSize[0]/2?"right":"left"]=60,r},formatter:function(e){var r=[];return r.push(e[0].axisValue+"<br>"),e.forEach(function(e){var o=e.data,s=e.seriesName,c=e.componentSubType,l=e.color,d=null==a[s]?s:a[s];if(r.push(h(l)+" "+d+": "),"candlestick"===c)r.push("<br>"),t.slice(0,4).forEach(function(e,t){var a=p(o[t+1],i,n);r.push("- "+e+": "+a+"<br>")});else if("line"===c){var u=p(o,i,n);r.push(u+"<br>")}else if("bar"===c){var f=p(o[1],i,n);r.push(f+"<br>")}}),r.join("")}}}function n(e){var t=e.downColor,i=e.upColor,n=e.MA;return{show:!1,seriesIndex:e.showMA?1+n.length:1,dimension:2,pieces:[{value:1,color:t},{value:-1,color:i}]}}function a(e){return[{left:"10%",right:"8%",top:"10%",height:e.showVol?"50%":"65%",containLabel:!1},{left:"10%",right:"8%",top:"65%",height:"16%",containLabel:!1}]}function r(e){var t=e.dims,i=O,n={onZero:!1};return[{type:"category",data:t,scale:!0,boundaryGap:!1,axisLine:n,splitLine:i,min:"dataMin",max:"dataMax"},{type:"category",gridIndex:1,data:t,scale:!0,boundaryGap:!1,axisLine:n,axisTick:O,splitLine:i,axisLabel:O,min:"dataMin",max:"dataMax"}]}function o(e){var t=e.dataType,i=e.digit,n=O;return[{scale:!0,axisTick:n,axisLabel:{formatter:function(e){return p(e,t,i)}}},{scale:!0,gridIndex:1,splitNumber:2,axisLine:O,axisTick:n,splitLine:O,axisLabel:O}]}function s(e){var t=e.start,i=e.end;return[{type:"inside",xAxisIndex:[0,1],start:t,end:i},{show:!0,xAxisIndex:[0,1],type:"slider",top:"85%",start:t,end:i}]}function c(e){var t=e.values,i=e.volumes,n=e.upColor,a=e.downColor,r=e.showMA,o=e.MA,s=e.showVol,c=e.labelMap,h=e.digit,d=e.itemStyle||{normal:{color:n,color0:a,borderColor:null,borderColor0:null}},u={normal:{opacity:.5}},f=[{name:null==c[x]?x:c[x],type:"candlestick",data:t,itemStyle:d}];return r&&o.forEach(function(e){var i="MA"+e;f.push({name:null==c[i]?i:c[i],data:l(e,t,h),type:"line",lineStyle:u,smooth:!0})}),s&&f.push({name:"Volume",type:"bar",xAxisIndex:1,yAxisIndex:1,data:i}),f}function l(e,t,i){var n=[];return t.forEach(function(a,r){if(r<e)n.push("-");else{for(var o=0,s=0;s<e;s++)o+=t[r-s][1];n.push(+(o/e).toFixed(i))}}),n}(e="default"in e?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 h=function(e){return['<span style="',"background-color:"+e+";","display: inline-block;","width: 10px;","height: 10px;","border-radius: 50%;","margin-right:2px;",'"></span>'].join("")},d=["#19d4ae","#5ab1ef","#fa6e86","#ffb980","#0067a6","#c4b4e4","#d87a80","#9cbbff","#d9d0c7","#87a997","#d49ea2","#5b4947","#7ba3a8"],u=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()},f=function(e){return String(e).replace(/^(\s+|-)?\d+(?=.?\d*($|\s))/g,function(e){return e.replace(/(?=(?!\b)(\d{3})+$)/g,",")})},p=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";if(null==e||isNaN(e))return n;switch(t){case"KMB":return u(e);case"percent":return parseFloat((100*e).toFixed(i))+"%";case"normal":return f(e);default:return e}},b=function(e){return Object.prototype.toString.call(e)},m=function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},y=function(e){return"[object Array]"===b(e)},v=function(e){return"[object Object]"===b(e)},g=[5,10,20,30],x="日K",O={show:!1},j=function(e,l,h,d){var u=h.dimension,f=void 0===u?e[0]:u,p=h.metrics,b=void 0===p?e.slice(1,6):p,m=h.digit,v=void 0===m?2:m,x=h.itemStyle,O=h.labelMap,j=void 0===O?{}:O,A=h.legendName,w=void 0===A?{}:A,M=h.MA,k=void 0===M?g:M,C=h.showMA,E=void 0!==C&&C,S=h.showVol,L=void 0!==S&&S,T=h.showDataZoom,P=void 0!==T&&T,V=h.downColor,$=void 0===V?"#ec0000":V,H=h.upColor,N=void 0===H?"#00da3c":H,z=h.start,F=void 0===z?50:z,_=h.end,W=void 0===_?100:_,q=h.dataType,B=d.tooltipVisible,I=d.legendVisible,Z=y(l[0]),D=[],G=[],K=[],R=b.slice(0,4),J=b[4];Z?l.forEach(function(t){var i=[];D.push(t[e.indexOf(f)]),R.forEach(function(n){i.push(t[e.indexOf(n)])}),G.push(i),J&&K.push(t[e.indexOf(J)])}):l.forEach(function(e,t){var i=[];if(D.push(e[f]),R.forEach(function(t){i.push(e[t])}),G.push(i),J){var n=e[b[0]]>e[b[1]]?1:-1;K.push([t,e[J],n])}});var Q=I&&t({showMA:E,MA:k,legendName:w,labelMap:j}),U=B&&i({metrics:b,dataType:q,digit:v,labelMap:j}),X=L&&n({downColor:$,upColor:N,MA:k,showMA:E}),Y=P&&s({start:F,end:W});return{legend:Q,tooltip:U,visualMap:X,grid:a({showVol:L}),xAxis:r({dims:D}),yAxis:o({dataType:q,digit:v}),dataZoom:Y,series:c({values:G,volumes:K,upColor:N,downColor:$,showMA:E,MA:k,showVol:L,labelMap:j,digit:v,itemStyle:x}),axisPointer:{link:{xAxisIndex:"all"}}}},A={render:function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"v-charts-component-loading"},[i("div",{staticClass:"loader"},[i("div",{staticClass:"loading-spinner"},[i("svg",{staticClass:"circular",attrs:{viewBox:"25 25 50 50"}},[i("circle",{staticClass:"path",attrs:{cx:"50",cy:"50",r:"20",fill:"none"}})])])])])},staticRenderFns:[]},w={render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{staticClass:"v-charts-data-empty"},[e._v(" 暂无数据 ")])},staticRenderFns:[]},M=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};return{name:"VeCandle",mixins:[{render:function(e){return e("div",{class:[m(this.$options.name||this.$options._componentTag)],style:this.canvasStyle},[e("div",{style:this.canvasStyle,ref:"canvas"}),e(A,{style:{display:this.loading?"":"none"}}),e(w,{style:{display:this.dataEmpty?"":"none"}}),this.$slots.default])},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,legend:[Object,Array],xAxis:[Object,Array],yAxis:[Object,Array],radar:Object,tooltip:Object,axisPointer:Object,brush:[Object,Array],geo:Object,timeline:[Object,Array],graphic:[Object,Array],series:[Object,Array],backgroundColor:[Object,String],textStyle:Object,animation:Object,theme:Object,themeName:String,loading:Boolean,dataEmpty:Boolean,extend:Object,judgeWidth:{type:Boolean,default:!0},widthChangeDelay:{type:Number,default:300}},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)}},events:{deep:!0,handler:function(){this.createEventProxy()}}},computed:{canvasStyle:function(){return{width:this.width,height:this.height,position:"relative"}},chartColor:function(){return this.colors||this.theme&&this.theme.color||d}},methods:{dataHandler:function(e){if(this.chartHandler){var t=e,i=t.columns,n=void 0===i?[]:i,a=t.rows,r=void 0===a?[]:a,o={tooltipVisible:this.tooltipVisible,legendVisible:this.legendVisible,echarts:this.echarts,color:this.chartColor};this.beforeConfig&&(e=this.beforeConfig(e));var s=this.chartHandler(n,r,this.settings,o);s&&("function"==typeof s.then?s.then(this.optionsHandler):this.optionsHandler(s))}},resize:function(){this.echarts.resize()},optionsHandler:function(e){var t=this;if(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),["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]"===b(n)?n.forEach(function(e){t.addMark(e,i)}):"[object Object]"===b(n)&&this.addMark(n,i)}this.extend&&Object.keys(this.extend).forEach(function(i){"function"==typeof t.extend[i]?e[i]=t.extend[i](e[i]):y(e[i])&&v(e[i][0])?e[i].forEach(function(n,a){e[i][a]=M({},n,t.extend[i])}):v(e[i])?e[i]=M({},e[i],t.extend[i]):e[i]=t.extend[i]}),this.afterConfig&&(e=this.afterConfig(e)),this.echarts.setOption(e,!0),this.judgeWidth&&this.judgeWidthHandler(e),this.afterSetOption&&this.afterSetOption(this.echarts),this.afterSetOptionOnce&&!this._once.afterSetOptionOnce&&(this._once.afterSetOptionOnce=this.afterSetOptionOnce(this.echarts))},judgeWidthHandler:function(e){var t=this;this.$el.clientWidth?this.echarts.resize():this.$nextTick(function(e){t.$el.clientWidth?t.echarts.resize():setTimeout(function(e){t.echarts.resize(),t.$el.clientWidth||console.warn(" Can't get dom width or height ")},t.widthChangeDelay)})},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?"outer-theme":"ve-chart");this.echarts=this.echartsLib.init(this.$refs.canvas,e,this.initOptions),this.data&&this.dataHandler(this.data),this.createEventProxy()}},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)){var n={};"[object Object]"===b(i)&&(n.deep=!0),e.$watch(i,function(){e.dataHandler(e.data)},n)}})},registerTheme:function(){e.registerTheme("outer-theme",this.theme)},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),a=0;a<i;a++)n[a]=arguments[a];t.events[e].apply(null,n)}}}(i)))})}},created:function(){this.echarts=null,this.registeredEvents=[],this._once={},this.addWatchToProps(),this.theme&&this.registerTheme()},mounted:function(){this.init(),window.addEventListener("resize",this.echarts.resize)},beforeDestroy:function(){window.removeEventListener("resize",this.echarts.resize),this.echarts.dispose()}}],created:function(){this.chartHandler=j,this.echartsLib=e}}});
  