!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";e=e&&e.hasOwnProperty("default")?e.default:e;var t={categoryAxis:{axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1}},valueAxis:{axisLine:{show:!1}},line:{smooth:!0},grid:{containLabel:!0,left:10,right:10}},i=["#19d4ae","#5ab1ef","#fa6e86","#ffb980","#0067a6","#c4b4e4","#d87a80","#9cbbff","#d9d0c7","#87a997","#d49ea2","#5b4947","#7ba3a8"],n=function(e){return[''].join("")},r=["initOptions","loading","dataEmpty","judgeWidth","widthChangeDelay"],a=["grid","dataZoom","visualMap","toolbox","title","legend","xAxis","yAxis","radar","tooltip","axisPointer","brush","geo","timeline","graphic","series","backgroundColor","textStyle"],o={th:3,mi:6,bi:9,tr:12},s={zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0,abbrLabel:{th:"k",mi:"m",bi:"b",tr:"t"}},l=1e12,c=1e9,h=1e6,d=1e3;function u(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 f(e,t,i,n){var r=Math.abs(t),a=!1,s=!1,f="",p="",b=!1,m=void 0,y=void 0;i=i||"",t=t||0,~i.indexOf("(")?(a=!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]?"),""),r>=l&&!m||"t"===m?(f+=e.abbrLabel.tr,t/=l):r=c&&!m||"b"===m?(f+=e.abbrLabel.bi,t/=c):r=h&&!m||"m"===m?(f+=e.abbrLabel.mi,t/=h):(r=d&&!m||"k"===m)&&(f+=e.abbrLabel.th,t/=d)),~i.indexOf("[.]")&&(s=!0,i=i.replace("[.]","."));var g=t.toString().split(".")[0],v=i.split(".")[1],x=i.indexOf(","),O=(i.split(".")[0].split(",")[0].match(/0/g)||[]).length;if(v?(g=(p=~v.indexOf("[")?u(t,(v=(v=v.replace("]","")).split("["))[0].length+v[1].length,n,v[1].length):u(t,v.length,n)).split(".")[0],p=~p.indexOf(".")?"."+p.split(".")[1]:"",s&&0==+p.slice(1)&&(p="")):g=u(t,0,n),f&&!m&&+g>=1e3&&f!==o.trillion&&(g=""+ +g/1e3,f=o.million),~g.indexOf("-")&&(g=g.slice(1),b=!0),g.length0;j--)g="0"+g;x>-1&&(g=g.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")),i.indexOf(".")||(g="");var A=g+p+(f||"");return a?A=(a&&b?"(":"")+A+(a&&b?")":""):y>=0?A=0===y?(b?"-":"+")+A:A+(b?"-":"+"):b&&(A="-"+A),A}function p(e,t){Object.keys(t).forEach(function(i){e[i]=t[i]})}var b={},m={};function y(e,t,i){return function(e,t,i){t=t||b.defaultFormat,i=i||Math.round;var n=void 0,r=void 0;if(0===e&&null!==b.zeroFormat)n=b.zeroFormat;else if(null===e&&null!==b.nullFormat)n=b.nullFormat;else{for(var a in m)if(m[a]&&t.match(m[a].regexp)){r=m[a].format;break}n=(r=r||f.bind(null,b))(e,t,i,y)}return n}(0===e||void 0===e?0:null===e||function(e){return"number"==typeof e&&isNaN(e)}(e)?null:"string"==typeof e?b.zeroFormat&&e===b.zeroFormat?0:b.nullFormat&&e===b.nullFormat||!e.replace(/[^0-9]+/g,"").length?null:+e:+e||null,t,i)}p(b,s),y.options=b,y._numberToFormat=f.bind(null,b),y.register=function(e,t){m[e]=t},y.unregister=function(e){m[e]=null},y.setOptions=function(e){p(b,e)},y.reset=function(){p(b,s)},y.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"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v=Object.assign||function(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:"-";if(isNaN(e))return n;if(!t)return e;if("[object Function]"===j(t))return t(e,y);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 y(e,a)},C=[5,10,20,30],M="日K",E={show:!1};var L=function(e,t,i,r){var a=i.dimension,o=void 0===a?e[0]:a,s=i.metrics,l=void 0===s?e.slice(1,6):s,c=i.digit,h=void 0===c?2:c,d=i.itemStyle,u=i.labelMap,f=void 0===u?{}:u,p=i.legendName,b=void 0===p?{}:p,m=i.MA,y=void 0===m?C:m,g=i.showMA,v=void 0!==g&&g,x=i.showVol,O=void 0!==x&&x,j=i.showDataZoom,A=void 0!==j&&j,w=i.downColor,S=void 0===w?"#ec0000":w,L=i.upColor,F=void 0===L?"#00da3c":L,$=i.start,H=void 0===$?50:$,_=i.end,T=void 0===_?100:_,P=i.dataType,N=r.tooltipVisible,R=r.legendVisible,V=k(t[0]),B=[],W=[],D=[],q=l.slice(0,4),I=l[4];V?t.forEach(function(t){var i=[];B.push(t[e.indexOf(o)]),q.forEach(function(n){i.push(t[e.indexOf(n)])}),W.push(i),I&&D.push(t[e.indexOf(I)])}):t.forEach(function(e,t){var i=[];if(B.push(e[o]),q.forEach(function(t){i.push(e[t])}),W.push(i),I){var n=e[l[0]]>e[l[1]]?1:-1;D.push([t,e[I],n])}});var Z=R&&function(e){var t=e.showMA,i=e.MA,n=e.legendName,r=e.labelMap,a=[M];return t&&(a=a.concat(i.map(function(e){return"MA"+e}))),r&&(a=a.map(function(e){return null==r[e]?e:r[e]})),{data:a,formatter:function(e){return null!=n[e]?n[e]:e}}}({showMA:v,MA:y,legendName:b,labelMap:f}),U=N&&function(e){var t=e.metrics,i=e.dataType,r=e.digit,a=e.labelMap;return{trigger:"axis",axisPointer:{type:"cross"},position:function(e,t,i,n,r){var a={top:10};return a[e[0]"),e.forEach(function(e){var s=e.data,l=e.seriesName,c=e.componentSubType,h=e.color,d=null==a[l]?l:a[l];if(o.push(n(h)+" "+d+": "),"candlestick"===c)o.push("
"),t.slice(0,4).forEach(function(e,t){var n=null!=a[e]?a[e]:e,l=z(s[t+1],i,r);o.push("- "+n+": "+l+"
")});else if("line"===c){var u=z(s,i,r);o.push(u+"
")}else if("bar"===c){var f=z(s[1],i,r);o.push(f+"
")}}),o.join("")}}}({metrics:l,dataType:P,digit:h,labelMap:f}),G=O&&function(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}]}}({downColor:S,upColor:F,MA:y,showMA:v}),J=A&&function(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}]}({start:H,end:T});return{legend:Z,tooltip:U,visualMap:G,grid:[{left:"10%",right:"8%",top:"10%",height:{showVol:O}.showVol?"50%":"65%",containLabel:!1},{left:"10%",right:"8%",top:"65%",height:"16%",containLabel:!1}],xAxis:function(e){var t=e.dims,i={onZero:!1};return[{type:"category",data:t,scale:!0,boundaryGap:!1,axisLine:i,splitLine:E,min:"dataMin",max:"dataMax"},{type:"category",gridIndex:1,data:t,scale:!0,boundaryGap:!1,axisLine:i,axisTick:E,splitLine:E,axisLabel:E,min:"dataMin",max:"dataMax"}]}({dims:B}),yAxis:function(e){var t=e.dataType,i=e.digit;return[{scale:!0,axisTick:E,axisLabel:{formatter:function(e){return z(e,t,i)}}},{scale:!0,gridIndex:1,splitNumber:2,axisLine:E,axisTick:E,splitLine:E,axisLabel:E}]}({dataType:P,digit:h}),dataZoom:J,series:function(e){var t=e.values,i=e.volumes,n=e.upColor,r=e.downColor,a=e.showMA,o=e.MA,s=e.showVol,l=e.labelMap,c=e.digit,h=e.itemStyle||{normal:{color:n,color0:r,borderColor:null,borderColor0:null}},d={normal:{opacity:.5}},u=[{name:null==l[M]?M:l[M],type:"candlestick",data:t,itemStyle:h}];return a&&o.forEach(function(e){var i="MA"+e;u.push({name:null==l[i]?i:l[i],data:function(e,t,i){var n=[];return t.forEach(function(r,a){if(a