!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var a in i)("object"==typeof exports?exports:t)[a]=i[a]}}(window,(function(){return i={},t.m=e=[function(t,e,i){"use strict";function a(t,e){for(var i=0;i\n \n \n \n \n \n ',t.loading=e.children[0])}},{key:"loadingHide",value:function(){t.loading.style.zIndex=-1}},{key:"clean",value:function(e){t.loading=!1,e.innerHTML=""}}]),t}();function r(t,e){for(var i=0;i=t?t:this._itemFirst}},{key:"setItemFirst",value:function(t){var e=this.kline.getDataLen()+this._itemCount-5;t<5?t=5:ee.getDataAt(i).date){var n=e.getDataAt(i).date;return i+(t-n)/(1s.date&&t=this._itemCount?t:this._itemCount}},{key:"addMore",value:function(){this._post&&this._itemFirst+1<=this._itemCount&&(this._post=!1,this.kline._on.moreCallBack())}},{key:"update",value:function(){var t=this._itemCount;this.calcItemCount();var e=this.kline.getDataLen();te?this.setItemFirst(e+Math.round((this._itemFirst-e)/t*this._itemCount)):et?this.setItemFirst(this._itemCount+this._itemFirst-t):this._itemFirste)&&(e=r[t=l]);this._timePeriod=t}},{key:"calcCount",value:function(){this._count=Math.ceil(t.AXIS_SPACE/this.kline.zoom.getItemWidth());var e=this._timePeriod*this._count;et)return!1;var i=this.kline.getData(),a="",n=0=this._posix&&i<=this._posix+this._width&&a>=this._posiy&&a<=this._posiy+this._height?(this.kline._el.style.cursor="pointer",this._isActive=!0,this):this._isActive=!1}},{key:"mouseEvent",value:function(t,e){return this._hover=this.inPath(t,e),this._hover}},{key:"clickEvent",value:function(t,e){var i=this.inPath(t,e),a=this.kline;return!!i&&("hide"===this._action&&a.indicatorTextVisible(!this.kline._showIndicatorText),a._on&&a._on.iconCallBack&&a._on.iconCallBack(this._action,this._indicator),!0)}}]),t}(),S=function(){function t(e,i){var a;return P(this,t),(a=T(this,M(t).call(this,e,i,"set")))._image.src=e._theme?m:A,a}return D(t,R),L(t,[{key:"draw",value:function(t){this._isActive?this._image.src=this.kline._theme?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAilBMVEUAAABgn99ZmvlZmfJamPNZl/NYmPRal/hamPVZlfVZlPNZl/ZZmPZam/RZlvVZmfRYl/NXl/JXmPJYl/JWl/JYmfRYlvFZmPJYmPJXmPJYl/JYmPJXl/NYmPNYl/BYl/JXmPJYmPRXl/JXmPFXl/FYl/JWmPJXl/FXl/JXmPFXl/JYl/JXmPJXl/HweVw3AAAALXRSTlMACCs8PkJDR0pNVlZZXmRwgIyNjp2do6OrsrO0uLq9wMjI0Nzn7O/x9vn7/f6TKw2BAAAA4klEQVQ4y53T13LCMBCFYdnmp4neQ8BgwPTz/q+XmwwWNrCZnOtvRqstzkVxwpskceRcVONDapGL+ZjYJZ9B4jBSgOYwSPMFmCvIvAo6l/vq+zer+6VTARuti4fX2pRBX+d2Adpn9Z9Bfa9JWPtE+/oTGOvQCEHjoHEIWkcNAHya56kHGOjYCsBCOwB/kqSTB9hpUYDu9dYDSJV5nykF6N2u3QfI9AVALg9eOQBLZQ+w1fIV2P79CbNI+5uMqo0alVs9DcG03GpzWPa47YVhFq7c7D9L+27tzcMxT888Xuv8fwDqXSyMbP2FKAAAAABJRU5ErkJggg==":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAilBMVEUAAACAv/9VlfRVk/BalvBVlfFTkfFJkvNEk/RFivo4hvY3iPc1hvc0hfgsg/grgPkjgPoifP0hfP0hff0fe/0fev0cfP0be/0ce/8aef0aev0aev0bef4aev8aev4ZeP8Yef4Yef4Xef8YeP8WeP8WeP8WeP8Vd/8Wd/8Wd/8Vd/8VeP8Vd/8Vd/9abGtKAAAALXRSTlMABBghIiQlKi0wOzw/RUxabHl7fI2OlJWdpqepra+ytr/AyNbj6ezv9fj6/f4dJ2ngAAAA4klEQVQ4y53T13LCMBCFYdnmp4neQ8BgwPTz/q+XmwwWNrCZnOtvRqstzkVxwpskceRcVONDapGL+ZjYJZ9B4jBSgOYwSPMFmCvIvAo6l/vq+zer+6VTARuti4fX2pRBX+d2Adpn9Z9Bfa9JWPtE+/oTGOvQCEHjoHEIWkcNAHya56kHGOjYCsBCOwB/kqSTB9hpUYDu9dYDSJV5nykF6N2u3QfI9AVALg9eOQBLZQ+w1fIV2P79CbNI+5uMqo0alVs9DcG03GpzWPa47YVhFq7c7D9L+27tzcMxT888Xuv8fwDqXSyMbP2FKAAAAABJRU5ErkJggg==":this._image.src=this.kline._theme?m:A,t.save(),t.drawImage(this._image,this._posix,this._posiy,this._width,this._height),t.restore()}}]),t}(),N=function(){function t(e,i){var a;return P(this,t),(a=T(this,M(t).call(this,e,i,"close")))._image.src=e._theme?p:k,a}return D(t,R),L(t,[{key:"draw",value:function(t){this._isActive?this._image.src=this.kline._theme?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAARVBMVEUAAABgn99ZmvlZmfJamPNZl/NYmPRZmPhamPVbl/JZmPJYmfJYmPNZmPNYl/JYmPJXmPJXl/FXmPJXl/FXl/JXmPJXl/FZ6QGwAAAAFnRSTlMACCs8PkJDTU9ReXqmqrG3v9/o9fr6lJGRogAAAKpJREFUOMu1k+sOwyAIRlFrW2tv9sL7P+rM0k3ATZNl5afnROSLACht7JcyWgGoxhaqUaBtsTSYsmDAVuqPQtvR4z4T2iW4xP0+SKELmAx/4Ji1cMmIfPrwyLfBOJ3iMjhnYz4NwXkO0dhOzkVQbkOcS0n6E5HmIYXYfw7CAM4nmocUrvcLAySXBmRcGC+h38n80VizG4aR5rG6G77c70J1caqrV13e2vo/AGfRGNsBtVgYAAAAAElFTkSuQmCC":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAARVBMVEUAAACAv/9VlfRVk/BalvBVlfFTkfFEjfVBjPU9ifYmffwmfvodev0cev0aef0bev4Zef4Xd/4Xd/4VeP8WeP8Vd/8Vd/+22k4uAAAAFnRSTlMABBghIiQlMTM2ZGWYnaWstdrl8/n6FMJCPwAAAKpJREFUOMu1k+sOwyAIRlFrW2tv9sL7P+rM0k3ATZNl5afnROSLACht7JcyWgGoxhaqUaBtsTSYsmDAVuqPQtvR4z4T2iW4xP0+SKELmAx/4Ji1cMmIfPrwyLfBOJ3iMjhnYz4NwXkO0dhOzkVQbkOcS0n6E5HmIYXYfw7CAM4nmocUrvcLAySXBmRcGC+h38n80VizG4aR5rG6G77c70J1caqrV13e2vo/AGfRGNsBtVgYAAAAAElFTkSuQmCC":this._image.src=this.kline._theme?p:k,t.save(),t.drawImage(this._image,this._posix,this._posiy,this._width,this._height),t.restore()}}]),t}(),O=function(){function t(e,i){var a;return P(this,t),(a=T(this,M(t).call(this,e,i,"hide")))._image.src=e._theme?_:C,a}return D(t,R),L(t,[{key:"draw",value:function(t){this.kline._showIndicatorText?this._isActive?this._image.src=this.kline._theme?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAABgn99ZmvlZmfJamPNZl/Nbl/JamPNZl/NXl/FXl/FxIKrUAAAACnRSTlMACCs8PkJRUpDfZECx5AAAAHVJREFUKM9jYFQORQJGAgwioSjAkUEVVSCIwRRVIJghFA3QUaANws6ACUSsTAUxw2a1QgXCZk0DCWSCxRngTKgwQyhMCUQB1BYgB6oAKgDkQRXA3JG5EqoAJhA2C6oA7tLKaWhOD0+lbwBhRBRGVGJENnpyAADryq78/8xAhgAAAABJRU5ErkJggg==":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAIVBMVEUAAACAv/9VlfRVk/BalvBVlfE5jvo9ifYgfPsXd/4Vd/8h6Ma8AAAACnRSTlMABBghIiQ2Nn/arfochwAAAHVJREFUKM9jYFQORQJGAgwioSjAkUEVVSCIwRRVIJghFA3QUaAdwq6ACUSsLAUxw2e1QgXCZ00HCVSCxRngTKgwQyhMCUQB1BYgB6oAKgDkQRXA3FG5EqoAJhA+C6oA7tLM6WhODyulbwBhRBRGVGJENnpyAADvGK/qe3eqMAAAAABJRU5ErkJggg==":this._image.src=this.kline._theme?_:C:this._isActive?this._image.src=this.kline._theme?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAHlBMVEUAAABgn99ZmvlZmfJamPNZl/Nbl/JZl/NXl/FXl/EZicCeAAAACXRSTlMACCs8PkJRkN873L0tAAAAa0lEQVQoz2NgVA5FAkYCDCKhKMCRQRVVIIjBFFUgmCEUDRAtUIYmED4jFVUgrLMNTUsGXAlUAKEEZgtcCUwArgTuDpgSuABMCW4BdC0YhqJbi+EwdKdjeA7D+xgBRFogY0QURlRiRDZ6cgAAJ+KtURSett4AAAAASUVORK5CYII=":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAHlBMVEUAAACAv/9VlfRVk/BalvBVlfE9ifYgfPsXd/4Vd/8XKNrLAAAACXRSTlMABBghIiQ2f9oV+RK9AAAAa0lEQVQoz2NgVA5FAkYCDCKhKMCRQRVVIIjBFFUgmCEUDRAtUIYmED4jFVUgrLMNTUsGXAlUAKEEZgtcCUwArgTuDpgSuABMCW4BdC0YhqJbi+EwdKdjeA7D+xgBRFogY0QURlRiRDZ6cgAAJ+KtURSett4AAAAASUVORK5CYII=":this._image.src=this.kline._theme?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAHlBMVEUAAAD////////////////////Q0NCanJ6MjZGJio3p2B0DAAAACXRSTlMABBUcHR8xfNl/+iMFAAAAa0lEQVQoz2NgVA5FAkYCDCKhKMCRQRVVIIjBFFUgmCEUDRAtUIYmED4jFVUgrLMNTUsGXAlUAKEEZgtcCUwArgTuDpgSuABMCW4BdC0YhqJbi+EwdKdjeA7D+xgBRFogY0QURlRiRDZ6cgAAJ+KtURSett4AAAAASUVORK5CYII=":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAHlBMVEUAAADY6+vg4Off4ube4Ofe4OfV2d++wcitsbuprLYkacCaAAAACXRSTlMADUtoa3N+reemCpvPAAAAa0lEQVQoz2NgVA5FAkYCDCKhKMCRQRVVIIjBFFUgmCEUDRAtUIYmED4jFVUgrLMNTUsGXAlUAKEEZgtcCUwArgTuDpgSuABMCW4BdC0YhqJbi+EwdKdjeA7D+xgBRFogY0QURlRiRDZ6cgAAJ+KtURSett4AAAAASUVORK5CYII=",t.save(),t.drawImage(this._image,this._posix,this._posiy,this._width,this._height),t.restore()}}]),t}();function V(t){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function W(t,e,i){return(W="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var a=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Y(t)););return t}(t,e);if(a){var n=Object.getOwnPropertyDescriptor(a,e);return n.get?n.get.call(i):n.value}})(t,e,i||t)}function B(t,e){return!e||"object"!==V(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}function Y(t){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&function(t,e){(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}(t,e)}function F(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function X(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function H(t,e){for(var i=0;ithis._outputs[t].data.length-1?this._outputs[t].data.push(i):this._outputs[t].data[e]=i}},{key:"modifyIndicatorOutput",value:function(t,e){var i=this._outputs.findIndex((function(t){return t.index===e.index}));-1=n.getMinusBarY2())return;g.drawText(t,f,v,e,i,!1,l,"left"),e+=y,0===d&&0===s._viewType&&(h[0].setParams({x:e,y:i-2,width:16,height:16}),h[0].draw(t),h[1].setParams({x:e+22,y:i-2,width:16,height:16}),h[1].draw(t),e+=44)}}}],[{key:"IndicatorConfig",value:function(t){var e;return F(e={MA:{input:[7,30,0,0,0,0,0,0,0,0],output:new Array(10).fill(0).map((function(e,i){return{index:i,label:"MA"+(i+1),lineWidth:1,lineColor:t.getColors("Indicator",i),lineVisible:1}}))},EMA:{input:[7,30,0,0,0,0,0,0,0,0],output:new Array(10).fill(0).map((function(e,i){return{index:i,label:"EMA"+(i+1),lineWidth:1,lineColor:t.getColors("Indicator",i),lineVisible:1}}))},BOLL:{input:[20,2],output:[{index:0,label:"MID",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"UPPER",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1},{index:2,label:"UPPER",lineWidth:1,lineColor:t.getColors("Indicator",2),lineVisible:1}]},SAR:{input:[4,2,20],output:[]},DEPTH:{input:[],output:[]},VOLUME:{input:[5,10,0,0,0,0],output:new Array(6).fill(0).map((function(e,i){return{label:"MA"+(i+1),index:i,lineWidth:1,lineColor:t.getColors("Indicator",i),lineVisible:1}}))},MACD:{input:[12,26,9],output:[{index:0,label:"DIF",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"DEA",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1},{index:2,label:"MACD"}]},KDJ:{input:[9,3,3],output:[{index:0,label:"K",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"D",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:2,label:"J",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1}]},OBV:{input:[30],output:[{index:0,label:"OBV",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"MAOBV",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1}]},RSI:{input:[6,12,24],output:new Array(10).fill(0).map((function(e,i){return{index:i,label:"RSI"+(i+1),lineWidth:1,lineColor:t.getColors("Indicator",i),lineVisible:1}})).concat([{index:3,label:"上限",lineWidth:1,lineColor:t.getColors("LimitLine"),lineVisible:1},{index:4,label:"下限",lineWidth:1,lineColor:t.getColors("LimitLine"),lineVisible:1},{index:5,label:"背景",lineColor:t.getColors("BetweenBg"),lineVisible:1}]),maxLimit:70,minLimit:30},TRIX:{input:[12,9],output:[{index:0,label:"TRIX",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"MATRIX",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1}]},WR:{input:[10,6],output:new Array(10).fill(0).map((function(e,i){return{index:i,label:"WR"+(i+1),lineWidth:1,lineColor:t.getColors("Indicator",i),lineVisible:1}}))},CCI:{input:[20],output:[{index:0,label:"CCI",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1}]},ROC:{input:[12,6],output:[{index:0,label:"ROC",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"MAROC",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1}]},ATR:{input:[14],output:[{index:0,label:"ATR",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1}]},DMI:{input:[14,6],output:[{index:0,label:"PDI",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"MDI",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1},{index:2,label:"ADX",lineWidth:1,lineColor:t.getColors("Indicator",2),lineVisible:1},{index:3,label:"ADXR",lineWidth:1,lineColor:t.getColors("Indicator",3),lineVisible:1}]},VR:{input:[26,2],output:[{index:0,label:"VR",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"MAVR",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1}]},PSY:{input:[12,6],output:[{index:0,label:"PSY",lineWidth:1,lineColor:t.getColors("Indicator",0),lineVisible:1},{index:1,label:"MAPSY",lineWidth:1,lineColor:t.getColors("Indicator",1),lineVisible:1}]},BIAS:{input:[6,12,24],output:new Array(10).fill(0).map((function(e,i){return{index:i,label:"RSI"+(i+1),lineWidth:1,lineColor:t.getColors("Indicator",i),lineVisible:1}}))},BRAR:[26],Yang:[7,14]},"DEPTH",{input:[6,12,24],output:new Array(10).fill(0).map((function(e,i){return{index:i,label:"RSI"+(i+1),lineWidth:1,lineColor:t.getColors("Indicator",i),lineVisible:1}}))}),F(e,"ORDER",[20]),e}},{key:"calcMA",value:function(t,e){for(var i=0,a=e.length-1;a>=e.length-t;a--)i+=e[a];return i/t}},{key:"calcEMA",value:function(t,e,i){return(e*(t-1)+2*i)/(t+1)}},{key:"calcTR",value:function(t,e,i){return Math.max(t-e,Math.max(Math.abs(t-i),Math.abs(e-i)))}},{key:"calcDX",value:function(t,e,i){var a=Math.abs(e[t]-i[t])/(e[t]+i[t])*100;return isNaN(a)?0:a}},{key:"calcDM",value:function(t,e){if(t<1)return[0,0];var i=e[t-1],a=e[t],n=[a.high-i.high,i.low-a.low];return(n[0]<0||n[0]<=n[1])&&(n[0]=0),(n[1]<0||n[1]<=n[0])&&(n[1]=0),n}},{key:"calc3Volume",value:function(t,e){var i=e[t].close-e[t-1].close,a=e[t].volume;return 0e[0].close,c=n,u=l?h.high:h.low,d=l?g.getJsMaxValue():-g.getJsMaxValue(),v=0;vh.low){l=!1,c=n,u=h.low,d=-g.getJsMaxValue();for(var y=0;ye[f-1].close&&(c=Math.min(c+n,r)),d=Math.min(h.low,d+c*(u-d)),u=h.high;else if(do.open?a.getColors("Positive"):a.getColors("Negative");g.drawRect(t,d,h,l,u,c);for(var v=0;ve[s-1].close?n.push(n[s-1]+e[s].volume):e[s].closee[t-1].close}}]),U(t,[{key:"creatIcons",value:function(){var t=[];t.push(new S(this.kline,this)),t.push(new N(this.kline,this)),this._icons=t}},{key:"getIcons",value:function(){return this._icons}},{key:"params",value:function(t){return[{type:"PSY",value:t[0]},{type:"MAPSY",value:t[0]}]}},{key:"calc",value:function(){this.clearOutput();var e=this.kline,i=e.getData(),a=e.getDataLen(),n=this.getParameter(0).getValue(),r=this.getParameter(1).getValue();if(!(0===n||ah.open?s.getColors("Positive"):s.getColors("Negative");g.drawRect(e,v,l,c,d,u)}}},{key:"calcMaxMinVal",value:function(){for(var t=this.kline,e=t.zoom.getItemFirst(),i=t.zoom.getItemLast(),a=-g.getJsMaxValue(),n=g.getJsMaxValue(),r=0;rthis._width&&(t=this._width-w),e<0&&(e=y+.5+10),Draws.drawFillReact(ctx,"#fff",.8,t,e,w,h),Draws.drawStrokeReact(ctx,color,t,e,w,h),Draws.drawText(ctx,Canvas.getFont(),"#333",price,t+pad,e+pad,"left"),Draws.drawText(ctx,Canvas.getFont(),"#333",text,t+pad,e+pad+18,"left")}},{key:"calc",value:function(){for(var t=this.kline,e=t.zoom.getItemFirst(),i=t.zoom.getItemLast(),a=g.getJsMaxValue(),n=-g.getJsMaxValue(),r=i;re.getMax())){var a=this.kline,n=a.layout.getAxisWidth(),r=e.getViewWidth(),s=e.getY(i.close),o=a.getTheme(),h=o.getColors("CloseLine"),l=h+"ed";if(this._priceLine.line&&g.drawDotted(t,h,0,s-.5,r-1,s-.5),this._priceLine.label&&(g.drawRect(t,l,r,s-10,n,19),g.drawLine(t,o.getColors("IndexText"),r,s-.5,r+5,s-.5),g.drawText(t,e.valToFixed(i.close),o.getColors("IndexText"),r+10,s-6,!1,!1,"left")),this._priceLine.count){var c=this._priceLine.label?s-10+20:s-10,u=this._priceLine.label?s-10+23:s-6;a._countDownTime&&(g.drawRect(t,l,r,c,n,19),g.drawText(t,g.getCountTime(0,a._countDownTime),o.getColors("IndexText"),r+10,u,!1,!1,"left"))}}}},{key:"drawText",value:function(t,e,i,a,n){for(var r=this.kline.manage,s="Consolas",o=this.kline.getTheme(),h=r.getViewWidth(),l=0;l=n.getMinusBarY2())return;g.drawText(t,d,u,e,i,!1,s,"left"),e+=v}else{var f=a[l].color||o.getColors("Text"),y=a[l].val;g.drawText(t,y,f,e,i,!1,s,"left"),e+=g.calcTextWidth(t,y,!1,s,8)}}},{key:"getName",value:function(){return"TimeShare"}}]),t}(),xt=function(){function t(e){mt(this,t),this.kline=e,this._priceLine={line:!0,label:!0,count:!0}}return kt(t,[{key:"changePriceLine",value:function(t){this._priceLine=t}},{key:"calcMaxMinVal",value:function(){for(var t=this.kline,e=t.getData(),i=t.zoom.getItemFirst(),a=t.zoom.getItemLast(),n=g.getJsMaxValue(),r=-g.getJsMaxValue(),s=a;sMath.max(_,k)&&g.drawLine(t,C,M,P,M,m),s&&this._maxAndMinVal[0]===v&&(s=!1,g.drawMaxAndMinPrice(t,e.valToFixed(v),a.getColors("Text"),M+.5,p+.5,!1,"Consolas")),o&&this._maxAndMinVal[1]===f&&(o=!1,g.drawMaxAndMinPrice(t,e.valToFixed(f),a.getColors("Text"),M+.5,m-.5,!1,"Consolas"))}}},{key:"drawOverlay",value:function(t,e){var i=this.kline,a=i.getTitle(),n="cn"===i.getLang(),r=i.manage.getHover();r<0&&(r=i.getDataLen()-1);var s=i.getDataAt(r),o=0===r?s:i.getDataAt(r-1),h=i.getTheme(),l=[],c=(s.close-o.close)/o.close;a&&l.push({val:a,color:h.getColors("Title")}),l.push({val:"".concat(n?"时间":"Date",":").concat(g.dateFormat(s.date,"yyyy-mm-dd hh:mn"))}),l.push([{val:"".concat(n?"开":"O",":")},{val:"".concat(e.valToFixed(s.open)),color:0<=c?h.getColors("Positive"):h.getColors("Negative")}]),l.push([{val:"".concat(n?"高":"H",":")},{val:"".concat(e.valToFixed(s.high)),color:0<=c?h.getColors("Positive"):h.getColors("Negative")}]),l.push([{val:"".concat(n?"低":"L",":")},{val:"".concat(e.valToFixed(s.low)),color:0<=c?h.getColors("Positive"):h.getColors("Negative")}]),l.push([{val:"".concat(n?"收":"C",":")},{val:"".concat(e.valToFixed(s.close)),color:0<=c?h.getColors("Positive"):h.getColors("Negative")}]),l.push([{val:"".concat(n?"涨幅":"Change",":")},{val:g.numberToRate(c,!1,!0),color:0<=c?h.getColors("Positive"):h.getColors("Negative")}]);var u=(s.high-s.low)/s.low;l.push([{val:"".concat(n?"振幅":"Ampl",":")},{val:"".concat(g.numberToRate(u,!1,!0)),color:0<=c?h.getColors("Positive"):h.getColors("Negative")}]);var d=0===i._viewType?5:2;this.drawText(t,5,e._posi.textY+d,l,e),e._posi.textY+=e._lineH,this.drawNewPrice(t,e,i.getLastData())}},{key:"drawNewPrice",value:function(t,e,i){var a=this.kline.getLog()?Math.log(i.close)/Math.log(10):i.close;if(!(ae.getMax())){var n=this.kline,r=n.layout.getAxisWidth(),s=e.getViewWidth(),o=e.getY(i.close),h=n.getTheme(),l=i.close>i.open?h.getColors("Positive"):h.getColors("Negative"),c=l+"ed";if(this._priceLine.line&&g.drawDotted(t,l,0,o-.5,s-1,o-.5),this._priceLine.label&&(g.drawRect(t,c,s,o-10,r,19),g.drawLine(t,h.getColors("IndexText"),s,o-.5,s+5,o-.5),g.drawText(t,e.valToFixed(i.close),h.getColors("IndexText"),s+10,o-6,!1,!1,"left")),this._priceLine.count){var u=this._priceLine.label?o-10+20:o-10,d=this._priceLine.label?o-10+23:o-6;n._countDownTime&&(g.drawRect(t,c,s,u,r,19),g.drawText(t,g.getCountTime(0,n._countDownTime),h.getColors("IndexText"),s+10,d,!1,!1,"left"))}}}},{key:"drawText",value:function(t,e,i,a,n){for(var r=this.kline.manage,s="Consolas",o=this.kline.getTheme(),h=r.getViewWidth(),l=0;l=n.getMinusBarY2())return;g.drawText(t,d,u,e,i,!1,s,"left",!1),e+=v}else{var f=a[l].color||o.getColors("Text"),y=a[l].val;g.drawText(t,y,f,e,i,!1,s,"left"),e+=g.calcTextWidth(t,y,!1,s,8)}}},{key:"getName",value:function(){return"CandleStick"}}]),t}(),wt=function(){function t(e){return mt(this,t),ft(this,yt(t).call(this,e))}return pt(t,xt),kt(t,[{key:"draw",value:function(t,e){for(var i=this.kline,a=i.getTheme(),n=i.zoom.getItemFirst(),r=i.zoom.getItemLast(),s=!0,o=!0,h=i._mainChartStyle,l=r;lMath.max(C,b)&&g.drawLine(t,p,T,D,T,w),s&&this._maxAndMinVal[0]===_&&(s=!1,g.drawMaxAndMinPrice(t,e.valToFixed(_),a.getColors("Text"),T+.5,x+.5,!1,"Consolas")),o&&this._maxAndMinVal[1]===k&&(o=!1,g.drawMaxAndMinPrice(t,e.valToFixed(k),a.getColors("Text"),T+.5,w-.5,!1,"Consolas"))}}},{key:"getName",value:function(){return"CandleStickHLC"}}]),t}(),Ct=function(){function t(e){return mt(this,t),ft(this,yt(t).call(this,e))}return pt(t,xt),kt(t,[{key:"draw",value:function(t,e){for(var i=this.kline,a=i.getTheme(),n=i.zoom.getItemFirst(),r=!0,s=!0,o=i.zoom.getItemLast();on[o].width+n[o].paddingR){var c=n[o].name;"DEPTH"===c&&(c="全量深度"),g.drawText(t,c,h,n[o].posiL,n[o].posiH,!1,!1,"left"),s-=n[o].width+n[o].paddingR}else this.bound=[0,e.getViewWidth()-s]}}}]),t}(),Nt=function(){function t(e,i){var a;return Pt(this,t),(a=Tt(this,Mt(t).call(this,e,i,["VOLUME","MACD","KDJ","OBV","RSI","TRIX","WR","CCI","ROC","ATR","DMI","VR","PSY","BIAS"])))._lastSelected=null,a._selected=i._indicators[0].getName(),a.calc("Deputy"),a}return Dt(t,Rt),Lt(t,[{key:"clickEvent",value:function(t,e){var i=this.inPath(t,e),a=this.kline;if(i&&!i.dis){if(i.name!==this.getSubText())return this._lastSelected=this._selected,this._selected=i.name,this.repaintChart(),this._selected;a._on.iconCallBack&&a._on.iconCallBack("set",this._chart._indicators[0])}}},{key:"repaintChart",value:function(){var t=this.kline;t.replaceIndicator({name:this._selected,last:this._lastSelected}),t._on.indicatorBarCallBack&&t._on.indicatorBarCallBack("deputy",this._selected,this._lastSelected)}},{key:"draw",value:function(t){this.bound=[];for(var e=this.kline,i=e.manage,a=e.getTheme(),n=this._indicators,r=this.kline._indicators,s=this._chart.getPosiY2(),o=i.getViewWidth(),h=0;hn[h].width+n[h].paddingR?(g.drawText(t,c,l,n[h].posiL,n[h].posiH,!1,!1,"left"),o-=n[h].width+n[h].paddingR):this.bound=[0,i.getViewWidth()-o]}this._indicators=n}}]),t}();function Ot(t){return(Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Vt(t,e,i){return(Vt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var a=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Bt(t)););return t}(t,e);if(a){var n=Object.getOwnPropertyDescriptor(a,e);return n.get?n.get.call(i):n.value}})(t,e,i||t)}function Wt(t,e){return!e||"object"!==Ot(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}function Bt(t){return(Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Yt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&function(t,e){(Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}(t,e)}function Et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ft(t,e){for(var i=0;i=i.getDataLen()||t<0)return a.yCoordsToPrice(e);var n=i.getDataAt(t),r=a.getY(n.open),s=a.getY(n.close),o=a.getY(n.high),h=a.getY(n.low);return oe[1].x?(i=s.x1,s.y1):e[0].xe[1].y?0:n.getPosiY2()),e[0].y=this._lineWidth%2==0?e[0].y:e[0].y-.5,a=this._lineWidth%2==0?a:a-.5,g.drawStyleLine(t,this._color,e[0].x,e[0].y,i,a,this._lineWidth,this._lineStyle);for(var o=0;(this._selected||"none"!==this._hover)&&oi+4||e.yi+4||e.xo-4?1:e.xs-4?1:"none"}},{key:"draw",value:function(t){if(0!==this.getDataLen()){var e=this.getDataAt(0);this.drawCrossLine(t,this.getX(e.date),this.getY(e.price))}}},{key:"drawCrossLine",value:function(t,e,i){var a=this.getHorzPoint(),n=this.getVertPoint(),r=this.kline.getTheme();if(i=this._lineWidth%2==0?i:i-.5,e=this._lineWidth%2==0?e+.5:e,g.drawStyleLine(t,this._color,a.x1,i,a.x2,i,this._lineWidth,this._lineStyle),g.drawStyleLine(t,this._color,e,n.y1,e,n.y2,this._lineWidth,this._lineStyle),this._selected||"none"!==this._hover){var s=this._lineWidth;!this._selected&&0!==this._hover||(s=this._lineWidthHover),g.drawArc(t,r.getColors("Point"),r.getColors("Background"),e,i,this._radius,s)}}}]),t}(),jt=function(){function t(e,i){return Et(this,t),Wt(this,Bt(t).call(this,e,2,i))}return Yt(t,Ht),Xt(t,[{key:"getName",value:function(){return"SegLine"}},{key:"draw",value:function(t){var e=this.getDataLen();if(1===e){var i=this.getDataAt(0);this.drawPoint(t,this.getX(i.date),this.getY(i.price),i.price)}else if(2===e){for(var a=[],n=0;no+4||e.yh+4||e.xl+4)?"none":this.getDataLen()}},{key:"updateData",value:function(t){if(this._hover===this.getDataLen())for(var e=this.kline.zoom,i=0;is+4?"none":this.calcDistance(a[0],a[1],i)<4?this.getDataLen():"none"}},{key:"draw",value:function(t){var e=this.getDataLen();if(1===e){var i=this.getDataAt(0);this.drawPoint(t,this.getX(i.date),this.getY(i.price),i.price)}else if(2===e){for(var a=[],n=0;ne[1].x?(i=s.x1,s.y1):e[0].xe[1].y?0:n.getPosiY2()),e[0].y=this._lineWidth%2==0?e[0].y:e[0].y-.5,a=this._lineWidth%2==0?a:a-.5,g.drawStyleLine(t,this._color,e[0].x,e[0].y,i,a,this._lineWidth,this._lineStyle),s=this.calcLineTo(e[2].x,e[2].y,i+o,a+h),a=e[0].x>e[1].x?(i=s.x1,s.y1):e[0].xe[1].y?0:n.getPosiY2()),e[2].y=this._lineWidth%2==0?e[2].y:e[2].y-.5,a=this._lineWidth%2==0?a:a-.5,g.drawStyleLine(t,this._color,e[2].x,e[2].y,i,a,this._lineWidth,this._lineStyle);for(var l=0;(this._selected||"none"!==this._hover)&&l=r[1].x?(c=this.getX(this.getDataAt(1).date),this.getX(this.getDataAt(2).date)):(c=this.getX(this.getDataAt(2).date),this.getX(this.getDataAt(1).date));for(var f=[0,.236,.382,.5,.618,.786,1,1.382,1.618,2.618,3.618,4.236].reverse(),y=0;y=e[0].y?i[0].calcY:i[0].calcY-h;l=this._lineWidth%2==0?l:l-.5;var c=e[2].x>=e[1].x?e[1].x:e[2].x;g.drawRect(t,this._bgColor,c,l,Math.abs(r-n),h);for(var u=0;u=e[0].x?e[2].x:e[2].x-o;g.drawRect(t,this._bgColor,l,n.y1,o,h);for(var c=0;ce[1].x?(o=s.x1,s.y1):e[0].xe[1].y?0:a.getPosiY2()),e[0].y=this._lineWidth%2==0?e[0].y:e[0].y-.5,h=this._lineWidth%2==0?h:h-.5,g.drawStyleLine(t,this._color,e[0].x,e[0].y,o,h,this._lineWidth,this._lineStyle)}for(var l=0;(this._selected||"none"!==this._hover)&&l=e[0].y&&(n.push({x:e[0].x,y:e[0].y+(e[1].y-e[0].y)/2}),n.push({x:e[1].x,y:e[0].y+(e[1].y-e[0].y)/2}),r.push({x:e[0].x+(e[1].x-e[0].x)/2,y:e[0].y}),r.push({x:e[0].x+(e[1].x-e[0].x)/2,y:e[1].y}));var s=a._theme?"#5B6060":"#637575";i.num<0?g.drawDotted(t,s,n[1].x,n[1].y,n[0].x,n[0].y):g.drawDotted(t,s,n[0].x,n[0].y,n[1].x,n[1].y),g.drawArrow(t,s,n,1,.5),e[1].ye[0].y&&g.drawDotted(t,s,r[0].x,r[0].y,r[1].x,r[1].y),g.drawArrow(t,s,r,1,.5)}},{key:"drawTips",value:function(t,e,i){var a=this.kline,n=0,r=this.kline.manage.getMainChart();i[1].yi[0].y&&(n=i[1].y+11),n+this.tipsRectH>=r.getPosiY2()&&(n=r.getPosiY2()-this.tipsRectH-10),n<=r.getPosiY1()&&(n=10);var s=g.calcTextWidth(t,"".concat(e.price," (").concat(e.increase,")"),13),o=g.calcTextWidth(t,"".concat(e.num,"柱 ").concat(e.time),13),h=Math.max(s,o),l=(i[1].x-i[0].x)/2+i[0].x-.5*h;n=this._lineWidth%2==0?n:n-.5,g.drawRect(t,a._theme?"rgba(0, 73, 79, 0.9)":"rgba(32, 179, 190, 0.9)",l,n,h+18,this.tipsRectH),g.drawText(t,"".concat(e.price," (").concat(e.increase,")"),"#fff",9+l+.5*h,n+11,13),g.drawText(t,"".concat(e.num,"柱 ").concat(e.time),"#fff",9+l+.5*h,n+11+23,13)}},{key:"calc",value:function(t,e){var i=t,a=e,n=this.kline.zoom,r={time:0,price:0,num:0,increase:0};return a.pricei.price&&(r.price=g.numberPrice(a.price-i.price,2),r.increase=g.numberToRate((a.price-i.price)/i.price,!1)),this.getX(i.date),this.getX(a.date),r.num=n.dateToIndex(a.date)-n.dateToIndex(i.date),r.num<0?r.time="-"+g.getTimeInterval(a.date,i.date):r.time=g.getTimeInterval(i.date,a.date),r}}]),t}(),he=function(){function t(e,i){return Et(this,t),Wt(this,Bt(t).call(this,e,3,i))}return Yt(t,Ht),Xt(t,[{key:"getName",value:function(){return"ParallelSegLine"}},{key:"inPath",value:function(t,e){if(!e)return"none";for(var i={x:e.x,y:e.y},a=[],n=0;n=this._absB?2*this._absA:2*this._absB;return Math.abs(d-u-g)<10?this.getDataLen():"none"}},{key:"drawEllipse",value:function(t,e){var i=this.kline.getTheme();e[0].x=this._lineWidth%2==0?e[0].x+.5:e[0].x,e[0].y=this._lineWidth%2==0?e[0].y:e[0].y-.5;var a=(e[1].x-e[0].x)/2,n=(e[1].y-e[0].y)/2,r=e[0].x+a,s=e[0].y+n;this._absA=Math.abs(a),this._absB=Math.abs(n),g.drawEllipse(t,r,s,this._absA,this._absB,0,2*Math.PI,this._bgColor,this._color,this._lineWidth,this._lineStyle),this._absA>=this._absB?(this._c=Math.sqrt(Math.pow(a,2)-Math.pow(n,2)),this._f1={x:r-this._c,y:s},this._f2={x:r+this._c,y:s}):(this._c=Math.sqrt(Math.pow(n,2)-Math.pow(a,2)),this._f1={x:r,y:s-this._c},this._f2={x:r,y:s+this._c});for(var o=0;(this._selected||"none"!==this._hover)&&o=this._absB?2*this._absA:2*this._absB;return Math.abs(d-u-g)<10?this.getDataLen():"none"}},{key:"drawEllipse",value:function(t,e){var i=this.kline.getTheme();e[0].x=this._lineWidth%2==0?e[0].x+.5:e[0].x,e[0].y=this._lineWidth%2==0?e[0].y:e[0].y-.5;var a,n,r=e[1].y-e[0].y,s=e[1].x-e[0].x,o=e[1].x,h=e[0].y;this._absA=Math.abs(r),this._absB=Math.abs(s),n=e[1].y>=e[0].y?(a=0,Math.PI):(a=0,-Math.PI),g.drawRadian(t,o,h,this._absB,this._absA,a,n,this._color,this._lineWidth,this._lineStyle),this._absA>=this._absB?(this._c=Math.sqrt(Math.pow(r,2)-Math.pow(s,2)),this._f1={x:o,y:h+this._c},this._f2={x:o,y:h-this._c}):(this._c=Math.sqrt(Math.pow(s,2)-Math.pow(r,2)),this._f1={x:o+this._c,y:h},this._f2={x:o-this._c,y:h});for(var l=0;(this._selected||"none"!==this._hover)&&lthis._maxAndMinVal[1];o-=this._rang){var h="",l=Math.floor(o/this._rang)*this._rang,c=this.getY(l);if("main"===this._name&&e.getLog()?(h=this.valToFixed(Math.pow(10,l)),c=this.getY(h)):h="VOLUME"===this._name?g.numberRang(l):"RSI"===this._name?l.toFixed(2):this.valToFixed(l),s-10h){var l=n.layout.getAxisWidth(),c=this.getViewWidth();0<=s&&g.drawDotted(t,r.getColors("SelectionBg"),0,h-.5,c-1,h-.5,5,5),g.drawRect(t,r.getColors("SelectionBg"),c,h-10,l,19),g.drawLine(t,r.getColors("SelectionText"),c,h-.5,c+5,h-.5),g.drawText(t,this.yCoordsToPrice(h),r.getColors("SelectionText"),c+10,h-6,!1,!1,"left")}0<=s&&g.drawDotted(t,r.getColors("SelectionBg"),o,0,o,this.getPosiY2(),5,5)}}]),t}(),Ce=function(){function t(e,i,a){var n;ke(this,t),(n=ye(this,pe(t).call(this,e,i,a)))._isClean=!0,n._tools=[];for(var r=i.tools,s=0;s=this.kline.zoom.getItemLast()&&tl.getPosiY1()&&h<=l.getMinusBarY2()-10){var u=l.getTool();u.setData({date:a.indexToDate(c),price:u.getPrice(c,h)}),e.draw("Overlay")}}else if(t._mouseDown){if(2===t._mouseDownButton)return;i.clearHover();var g=t._selectedTools;if(g){if(g._isLock)return;t.kline._el.style.cursor="grabbing",h>l.getPosiY1()&&h<=l.getMinusBarY2()-10&&(g.isMovePoint()?g.updateData({date:a.indexToDate(c),price:g.getPrice(c,h)}):g.updateData({ind:c-a.xCoordsToIndex(t._mouseDown.x),price:l.valToFixed(l.yCoordsToPrice(h)-l.yCoordsToPrice(t._mouseDown.y))}),t._mouseDown={x:o,y:h},e.draw("Overlay"))}else if(t._chartIsMove){var d=parseInt(h-t._mouseDown.y),v=t._chartIsMove.chart,f=t.kline.getCharts()[t._chartIsMove.index+1];if(0===d)return;if(!f)return;var y=JSON.parse(JSON.stringify(v.getPosi())),p=JSON.parse(JSON.stringify(f.getPosi())),m=e.getChartMinH();if(y.h+=d,p.y+=d,p.h-=d,y.h