/* Tencent is pleased to support the open source community by making Metis available. Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://opensource.org/licenses/BSD-3-Clause Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ !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 n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(window,function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=8)}([function(t,e,i){"use strict";t.exports=i(3)},function(t,e){t.exports=function(t,e,i,n){var r=i?i.call(n,t,e):void 0;if(void 0!==r)return!!r;if(t===e)return!0;if("object"!=typeof t||!t||"object"!=typeof e||!e)return!1;var s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(e),h=0;h2){i=0;for(var n=0;n1){for(var n=i[0],r=1;r0&&!isNaN(t)&&!REMPTY_REG.test(t)}const x=/^(\d)+(.)?\d*%$/;function m(t,e){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}function _(t,e){return{x:t.x-e.x,y:t.y-e.y}}function b(t,e){return{x:e*t.x,y:e*t.y}}function w(t,e){return _(e,t)}function L(t,e,i,n,r,s){void 0===s&&(s=[]),A(t,[e,i],n,r,s)}function A(t,e,i,n,r){if(void 0===r&&(r=null),e)if(!t.setLineDash&&r&&r.length>0)for(var s=1;s0&&t.setLineDash(r),t.moveTo(e[0].x,e[0].y),s=1;s0?s:[1]).forEach(function(t){t>0&&(c+=t)}),c=c||1;for(var p=Math.floor(h/c)*s.length,d=e.x,f=e.y,g=0;g0;){y=(m=s[x%s.length])*u,v=m*l;var m,_=(i.x-d-y)*(i.x-e.x)+(i.y-f-v)*(i.y-e.y);x%2==0&&(_>0?(t.save(),t.beginPath(),t.lineWidth=r,n&&(t.fillStyle=n),t.moveTo(d,f),t.lineTo(d+y,f+v),t.closePath(),t.stroke(),t.restore()):_<0&&(t.save(),t.lineWidth=r,n&&(t.fillStyle=n),t.beginPath(),t.moveTo(d,f),t.lineTo(i.x,i.y),t.closePath(),t.stroke(),t.restore())),d+=y,f+=v,x++}}}}function C(t,e,i,n,r){if(void 0===r&&(r=null),e&&!(e.length<1)){t.save(),t.beginPath(),r&&t.setLineDash(r),t.moveTo(e[0].point.x,e[0].point.y);for(var s=1;s0&&i&&i.length>0){t.save(),t.beginPath(),t.moveTo(e[0].point.x,e[0].point.y);for(var s=1;s=t.x&&i>=t.y&&e<=t.x+t.width&&i<=t.y+t.height)}function T(t,e,i){var n=0,r=0;if(e){var s=k(i);e.split("\n").forEach(function(e){var o=O(t,e,i);n=n0&&(this.startIndex=0,this.endIndex=this.option.xAxis.data.length-1),t.color instanceof Array&&t.color.forEach(function(t){t&&0===t.indexOf("#")&&t.length<8&&e.colorArray.push(t)}),X.forEach(function(t){e.colorArray.indexOf(t)<0&&e.colorArray.push(t)})},this.getXAxis=function(){return d(this.option,"xAxis.data")},this.createYAxisLabels=function(){var t=[],e=this.getValuesArray(),i=!1;if(e.forEach(function(t){t&&t.length>0&&(i=!0)}),!i)return[];for(var n=this.calculateAxisScale(e),r=this._getYAxisLabelFormatter(),s=0;s0){var u=(o/s>10?r+o:o/s<.1?n+s:n+r)/5,c=U(u);l=Math.floor(u/c+.5)*c,h=Math.ceil(r/l)*l,a=t<0?-Math.ceil(n/l)*l:Math.ceil(n/l)*l}else if(t>=0){var u=r/5,c=U(u);l=Math.floor(u/c+.5)*c,h=Math.ceil(r/l)*l,a=0}else if(e<0){var u=n/5,c=U(u);l=Math.floor(u/c+.5)*c,h=0,a=t<0?-Math.ceil(n/l)*l:Math.ceil(n/l)*l}return{maxSupport:h,minSupport:a,scale:l}}(o,s),i=n.scale,e=(n.maxSupport-n.minSupport)/i)}return{scale:i,count:e,minSupport:n.minSupport,maxSupport:n.maxSupport}},this.option=t||{xAxis:{data:[]},yAxis:{data:[]},series:[]}}return t.prototype.setIndexRange=function(t,e){this.startIndex=t,this.endIndex=e},t.prototype.getIndexRange=function(){return{startIndex:this.startIndex,endIndex:this.endIndex}},t.prototype.getYAxisValueMax=function(){return this.valueRange.max},t.prototype.getXAxisCount=function(){return this.option.xAxis.data.length},t.prototype.getSeriesDataByIndex=function(t){return this.option.series&&this.option.series[t]&&this.option.series[t].data?this.option.series[t].data:[]},t.prototype.getSeriesNameByIndex=function(t){if(this.option.series&&this.option.series[t])return this.option.series[t]},t.prototype.getColorByIndex=function(t){var e=t%this.colorArray.length;return this.colorArray[e]},t.prototype.getPieColorByIndex=function(t){return $[t%$.length]},t.prototype.getValuesArray=function(){var t=[];if(this.option&&this.option.series)for(var e=0;e100?100:i)/100}}return null},t.prototype._getYAxisLabelFormatter=function(){if(this.option.yAxis&&this.option.yAxis.axisLabel&&"function"==typeof this.option.yAxis.axisLabel.formatter)return this.option.yAxis.axisLabel.formatter},t.prototype._getXAxisLabelFormatter=function(){if(this.option.xAxis&&this.option.xAxis.axisLabel&&"function"==typeof this.option.xAxis.axisLabel.formatter)return this.option.xAxis.axisLabel.formatter},t.prototype._getTooltip=function(){if(this.option.tooltip)return this.option.tooltip},t.prototype.getPipelineType=function(){return d(this.option,"series.type")},t.prototype.createCoordinate=function(t){var e=this.getXStickCount(),i=this.getYStickCount(),n=new W(t,e,i);n.setStickLength(4);var r=this.createYAxisLabels();n.setYAxisLabels(r);var s=this.createXAxisLabels();return n.setXAxisLabels(s),n.calculate(),n},t.prototype.getFromOption=function(t){return d(this.option,t)},t}();function U(t){var e=1;if((t=Math.abs(t))>5)for(;t>5;)t/=10,e*=10;else if(t<.5&&0!=t)for(;t<.5;)t*=10,e/=10;return e}function Z(t,e){var i,n,r;try{i=t.toString().split(".")[1].length}catch(t){i=0}try{n=e.toString().split(".")[1].length}catch(t){n=0}return(t*(r=Math.pow(10,Math.max(i,n)))+e*r)/r}function G(t,e){var i=0,n=t.toString(),r=e.toString();try{i+=n.split(".")[1].length}catch(t){}try{i+=r.split(".")[1].length}catch(t){}return Number(n.replace(".",""))*Number(r.replace(".",""))/Math.pow(10,i)}let J={BIG_FONT:'60px "microsoft yahei",sans-serif',FONT:'14px/24px "Microsoft YaHei"',SMALL_FONT:'12px/24px "Microsoft YaHei"'};function K(t,e){t.style.cursor=e}var Q=function(){function t(t,e,i,n,r,s,o,a,h,l,u,c){this.width=0,this.height=0,this.btnWidth=0,this.btnHeight=0,this.progressHeight=0,this.progressPadding=0,this.leftBtnValue=0,this.rightBtnValue=1,this.paddingRight=0,this._needRefresh=!0,this.option=null,this.width=r||0,this.topCanvas=t,this.height=s||0,this.btnWidth=u||10,this.btnHeight=c||s,this.progressHeight=o,this.progressPadding=.1*this.height,this.leftBtnValue=a||0,this.rightBtnValue=h||1,this.paddingRight=0,this.x=i||0,this.y=n||0,this.lastPost=null,this.selectedBtn,this.valueChangecallback=function(t){l(t)},this.mousedownListener=this.mousedownListener.bind(this),this.mousemoveListener=this.mousemoveListener.bind(this),this.mouseupListener=this.mouseupListener.bind(this),this.mouseleaveListener=this.mouseleaveListener.bind(this),this.option=null,this.optionManager=e,this._needRefresh=!0,this._inVisible=!1}return t.prototype.resize=function(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this._needRefresh=!0},t.prototype.setBoundRect=function(t){this.boundRect=t},t.prototype.beforeDraw=function(t){this.boundRect&&t&&(t.save(),t.clearRect(this.boundRect.x,this.boundRect.y,this.boundRect.width,this.boundRect.height),t.restore())},t.prototype.isInLeftBtn=function(t,e){return H({x:this.x+this.leftBtnValue*this.getProgressLength(),y:this.y+(this.height-this.btnHeight)/2,width:this.btnWidth,height:this.btnHeight},t,e)},t.prototype.isInRightBtn=function(t,e){return H({x:this.x+this.rightBtnValue*this.getProgressLength()+this.btnWidth,y:this.y+(this.height-this.btnHeight)/2,width:this.btnWidth,height:this.btnHeight},t,e)},t.prototype.isInProgress=function(t,e){return H({x:this.x+this.btnWidth+this.getProgressLength()*this.leftBtnValue,y:this.y+this.progressPadding,width:(this.rightBtnValue-this.leftBtnValue)*this.getProgressLength(),height:this.height-2*this.progressPadding},t,e)},t.prototype.getProgressLength=function(){return this.width-2*this.btnWidth-this.paddingRight},t.prototype.setCursorStyle=function(t,e,i){H(this.getRectExtend(),e,i)&&(this.isInLeftBtn(e,i)||this.isInProgress(e,i)||this.isInRightBtn(e,i)?K(t,"ew-resize"):K(t,"default"))},t.prototype.mousemoveListener=function(t){if(!this._inVisible){var e=(t=window.event||t).offsetX||t.layerX,i=t.offsetY||t.layerY;if(this.setCursorStyle(this.topCanvas,e,i),this.lastPost&&this.selectedBtn){var n=e-this.lastPost.x;if(0!==n){var r=n/this.getProgressLength();"left"===this.selectedBtn?(this.setLeftBtnValue(this.leftBtnValue+r),this._needRefresh=!0):"right"===this.selectedBtn?(this.setRightBtnValue(this.rightBtnValue+r),this._needRefresh=!0):"progress"===this.selectedBtn&&(r=r<0?this.leftBtnValue+r>=0?r:-this.leftBtnValue:this.rightBtnValue+r>=1?1-this.rightBtnValue:r,this.setLeftBtnValue(this.leftBtnValue+r),this.setRightBtnValue(this.rightBtnValue+r),this._needRefresh=!0),this.validate()&&(this.lastPost={x:e,y:i}),this.valueChangecallback()}}}},t.prototype.needRefresh=function(){return this._needRefresh},t.prototype.mouseleaveListener=function(){this.lastPost=null,this.selectedBtn=null},t.prototype.mousedownListener=function(t){var e=(t=window.event||t).offsetX||t.layerX,i=t.offsetY||t.layerY;this.lastPost={x:e,y:i},this.isInLeftBtn(e,i)?this.selectedBtn="left":this.isInRightBtn(e,i)?this.selectedBtn="right":this.isInProgress(e,i)?this.selectedBtn="progress":(this.selectedBtn=null,this.lastPost=null)},t.prototype.mouseupListener=function(){this.lastPost=null,this.selectedBtn=null},t.prototype.getBtnWidth=function(){return this.btnWidth},t.prototype.getBtnHeight=function(){return this.btnHeight},t.prototype.validate=function(){return this.leftBtnValue<=1&&this.leftBtnValue>=0&&this.rightBtnValue>=this.leftBtnValue&&this.rightBtnValue<=1},t.prototype.normalizeValue=function(){this.leftBtnValue<0?this.leftBtnValue=0:this.leftBtnValue>1?this.leftBtnValue=1:"number"!=typeof this.leftBtnValue&&(this.leftBtnValue=0),this.rightBtnValue1?this.rightBtnValue=1:"number"!=typeof this.rightBtnValue&&(this.rightBtnValue=this.leftBtnValue)},t.prototype.setLeftBtnValue=function(t){t<0?t=0:t>this.rightBtnValue?t=this.rightBtnValue:t>1&&(t=1),this.leftBtnValue=t,this._needRefresh=!0},t.prototype.getLeftBtnValue=function(){return this.leftBtnValue},t.prototype.setRightBtnValue=function(t){t<0?t=0:t1&&(t=1),this.rightBtnValue=t,this._needRefresh=!0},t.prototype.getRightBtnValue=function(){return this.rightBtnValue},t.prototype.getRectExtend=function(){return{x:this.x-10,y:this.y-10,width:this.width+20,height:this.height+20}},t.prototype.getRegion=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.repaint=function(){this._needRefresh=!0},t.prototype.setVisible=function(t){this._inVisible=!t,t&&(this._needRefresh=!0)},t.prototype.isVisible=function(){return!this._inVisible},t.prototype.draw=function(t){if(this._inVisible)this._needRefresh=!1;else{this.normalizeValue();var e=this.getProgressLength();this.drawBackground(t);var i=this.x+e*this.leftBtnValue,n=this.y+(this.height-this.btnHeight)/2;t.save(),t.beginPath(),N(t,i,n,this.btnWidth,this.btnHeight,5),t.closePath(),t.fillStyle="#fff",t.fill(),t.strokeStyle="#ccc",t.stroke(),t.restore();var r=this.x+this.btnWidth+e*this.rightBtnValue,s=this.y+(this.height-this.btnHeight)/2;t.save(),t.beginPath(),N(t,r,s,this.btnWidth,this.btnHeight,5),t.closePath(),t.fillStyle="#fff",t.fill(),t.strokeStyle="#ccc",t.stroke(),t.restore(),this._needRefresh=!1}},t.prototype.drawBackground=function(t){var e=this.optionManager.getSeriesDataByIndex(0),i=e.length-1,n=f([e]);i=i<0?0:i;var r=c({x:0,y:0,width:e.length-1,height:n.max-n.min},{x:this.x+this.btnWidth,y:this.y+this.height-this.progressPadding,width:this.getProgressLength(),height:this.height-2*this.progressPadding},!0),s=u({x:0,y:0},r),o=u({x:e.length-1,y:0},r),a=[];if(e&&e.length>0){for(var h=0;h=0;r--){var s=n[r];s.listener===e&&s.context===i&&n.splice(r,1)}this.listenersMap[t]=n}},t}(),et=function(){function t(t){this.tipContainer=t,this.font=J.BIG_FONT}return t.prototype.show=function(t,e,i,n,r,s){if(!(d(i,"item.length")<1)){var o,a=t+(n=n&&"number"==typeof n?n:0),h=e+n,l=s&&s._getTooltip()?s._getTooltip():{show:!0};if("function"==typeof l.formatter&&0!=l.show)o=l.formatter(i.items);else if(0!=l.show){o=null!=i.title?i.title+"":null;var u=this.handleData(i),c=u.pie||[],p=u.line||[];for(var f in delete u.pie,delete u.line,p.forEach(function(t){null!=t.value&&(o=o||"",o+='
'+t.seriesName+":"+t.value)}),u)u[f].forEach(function(t){null!=t.value&&(o=o||"",o+='
'+t.seriesName+":"+t.value)});c.forEach(function(t){null!=t.value&&(o=o||"",o+=t.seriesName+"
"+t.name+":"+t.value+"("+t.percent+"%)")})}var g=this.tipContainer;if(o){g.innerHTML="";var y=function(t){var e=Object.assign({},{borderWidth:"0px",borderColor:"rgb(51, 51, 51)",borderRadius:"4px",display:"block",color:"black",font:'14px/24px "Microsoft YaHei"',padding:"5px",backgroundColor:"rgb(255,255,255)",border:"solid 1px #ccc",boxShadow:"0px 4px 4px -2px rgba(208,208,208,0.7)"},t),i=document.createElement("div");return it(i,e),i}(l.styles);g.appendChild(y),y.innerHTML=o,"block"!=g.style.display&&(g.style.display="block"),r&&(t+g.clientWidth+n>r.width&&(a=t-g.clientWidth-n),e+g.clientHeight+n>r.height&&(h=e-g.clientHeight-n)),g.style.left=a+"px",g.style.top=h+"px"}else this.hide()}},t.prototype.hide=function(){"none"!=this.tipContainer.style.display&&(this.tipContainer.style.display="none")},t.prototype.handleData=function(t){var e={},i=[];return t&&t.items&&(t.items.forEach(function(t){if(t){var n=t.seriesType;n?(e[n]=e[n]||[],e[n].push(t)):i.push(t)}}),e.line=e.line||[],i.forEach(function(t){t&&e.line.push(t)})),e},t}();function it(t,e){for(var i in e)t.style[i]=e[i]}var nt=function(){function t(){this.visible=!0,this.getPointInfo=function(){},this.getHover=function(){},this._matrix=new a,this.id=p(),this._inverseMatrix=new a,this.properties={}}return t.prototype.getName=function(){return this.name},t.prototype.setName=function(t,e){void 0===e&&(e=!1),this.name!=t&&(this.name=t,e||this.eventHandler.dispatchPropertyChangeEvent({type:"name",source:this}))},t.prototype.getSeriesName=function(){return this.seriesName},t.prototype.setSeriesName=function(t){this.seriesName=t},t.prototype.getSeriesIndex=function(){return this.seriesIndex},t.prototype.setSeriesIndex=function(t){this.seriesIndex=t},t.prototype.setSeriesType=function(t){this.seriesType=t},t.prototype.getSeriesType=function(){return this.seriesType},t.prototype.setColor=function(t){this.color=t},t.prototype.getColor=function(){return this.color},t.prototype.setMatrix=function(t,e){if(void 0===e&&(e=!1),!function(t,e){if(t===e)return!0;if(null==t&&null==e)return!0;if(null!=t&&null!=e){if(t.data.length!=e.data.length)return!1;for(var i=t.data,n=e.data,r=0;r=n._milisecond?(n.callback(n._milisecond,n._userData),n._hasDone=!0):(n.callback(t,i),window.cancelAnimationFrame(n._timerObject.timer),n._timerObject.timer=window.requestAnimationFrame(n._loop))}}}return t.prototype.run=function(){var t=this;this._hasRun=!0,this._delay?this._timerObject.delayTimer=setTimeout(function(){t._beginTime=new Date,t._loop()},this._delay):(this._beginTime=new Date,this._loop())},t.prototype.cancle=function(){this.hasDone()||(clearTimeout(this._timerObject.delayTimer),window.cancelAnimationFrame(this._timerObject.timer),this._hasCancle=!0)},t.prototype.hasCancle=function(){return this._hasCancle},t.prototype.hasFinish=function(){return this._hasCancle||this._hasDone},t.prototype.hasRun=function(){return this._hasRun},t.prototype.hasDone=function(){return this._hasDone},t.prototype.done=function(t){this.hasCancle()&&!t||this.hasDone()||(this.cancle(),this._hasDone=!0,this.callback(this._milisecond,this._userData))},t}(),ot=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),at=function(t){function e(e,i,n){var r=t.call(this)||this;return r.smooth=!1,r.controlPoints=[],r.indexInterval=1,r.startIndex=0,r.endIndex=0,r._drawPercent=1,r.getPointInfo=function(t,e){if(1===r.pointInfoList.length&&r.footPoint)return r.pointInfoList[0];var i=r._getXAxisIndexByPosition(t,e);return r.pointInfoList[i]},r.optionManager=e,r.valueArray=i.data,r.markLine=i.markLine,r._needCalculate=!0,r.eventHandler=n,r.zIndex=0,r.lineWidth=1,r}return ot(e,t),e.prototype.setColor=function(t,e){void 0===e&&(e=!1),this.color=t,e||this.eventHandler.dispatchPropertyChangeEvent({type:"color",source:this})},e.prototype.setLineWidth=function(t,e){void 0===e&&(e=!1),this.lineWidth=parseInt(t,10)||1,e||this.eventHandler.dispatchPropertyChangeEvent({type:"lineWidth",source:this})},e.prototype.getPointInfoList=function(){return this.pointInfoList},e.prototype.setIndexInterval=function(t,e){void 0===e&&(e=!1),this.indexInterval=t,e||this.eventHandler.dispatchPropertyChangeEvent({type:"interval",source:this})},e.prototype.getColor=function(){return this.color},e.prototype.setValues=function(t,e){void 0===e&&(e=!1),this.valueArray=t,this._needCalculate=!0,e||this.eventHandler.dispatchPropertyChangeEvent({type:"valueArray",source:this})},e.prototype.setIndexRange=function(t,e,i){void 0===i&&(i=!1),this.startIndex==t&&this.endIndex==e||(this._needCalculate=!0,i||this.eventHandler.dispatchPropertyChangeEvent({type:"IndexRange",source:this})),this.startIndex=t,this.endIndex=e},e.prototype.setSmooth=function(t,e){void 0===e&&(e=!1),this.smooth!=t&&(this.smooth=t,e||this.eventHandler.dispatchPropertyChangeEvent({type:"smooth",source:this}))},e.prototype.calculatePointInfo=function(){var t,e=[],i=[];if(this.valueArray){for(var n=this.endIndex-this.startIndex+1,r=0;rthis.startIndex&&(e=[],i=[],t=null,"string"==typeof(s=this.valueArray[0+this.startIndex])&&(0==(s=y(s)).length||isNaN(s))&&(s=null),null!=s&&(t=j(u({x:.5,y:s},this._matrix)),this.footPoint=j(u({x:.5,y:0},this._matrix))),i.push(t),(o=new rt(t)).setYValue(s),o.setIndex(0+this.startIndex),(a=this.optionManager.getXAxis())&&o.setXValue(a[0+this.startIndex]),e.push(o))}this.pointInfoList=e,this.controlPoints=function(t,e){e=e||.1;var i=[];if(t&&t.length>0){var n=t.concat();n.push(n[n.length-1]),n.unshift(n[0]);for(var r=n.length-1,s=1;s1e3&&(i=1),t._drawPercent=i,t.eventHandler.dispatchPropertyChangeEvent({type:"animation",source:t})})),this._animation.run(),this._animation},e.prototype.draw=function(t){this.drawByPercent(t,this._drawPercent),this.drawMarkLine(t)},e.prototype.drawMarkLine=function(t){var e=this;this.markLine&&this.markLine.data&&this.markLine.lineStyle&&this.markLine.data.forEach(function(i){var n;if(e.pointInfoList.forEach(function(t){t.xValue===i.xAxis&&(n=t)}),n&&n.point){var r=n.point.x||0,s=z.getOrigin().y,o=z.getYAxisEnd().y;L(t,{x:r,y:s},{x:r,y:o},e.markLine.lineStyle.normal.color,1,[2,2]),I(t,r,s,3,e.markLine.lineStyle.normal.color,e.markLine.lineStyle.normal.color),I(t,r,o,3,e.markLine.lineStyle.normal.color,e.markLine.lineStyle.normal.color);var a=e.markLine.label.formatter(n.xValue),h=O(t,a,"12px sans-serif");B(t,a,r-h/2,o-10,e.markLine.lineStyle.normal.color,void 0,"start","middle")}})},e.prototype.drawByPercent=function(t,e){e=e<0?0:e;var i=this.pointInfoList;e&&e<1&&(i=this.pointInfoList.slice(0,Math.round(e*this.pointInfoList.length))),this.smooth?function(t,e,i,n,r){if(!(e.length<2)){var s=[],o=[],a=[],h=[],l=d(e[0],"point");l&&s.push(e[0]);for(var u=1;u=2&&(a.push(s),h.push(o)),o=[],s=[]):(l&&(o.push(i[2*(u-1)]),o.push(i[2*(u-1)+1])),s.push(c)),l=c.point}for(s.length>=2&&(a.push(s),h.push(o),o=[],s=[]),u=0;u=2&&o.push(s),s=[])}for(s.length>=2&&(o.push(s),s=[]),a=0;a0){var s=new at(t,e,i);s.setIndexRange(r.startIndex,r.endIndex,!0),s.setSmooth(d(e,"smooth")),s.setName(e.name,!0),s.setZIndex(e.z,!0);var o=d(e,"lineStyle.normal.width");return s.setLineWidth(o),s.setColor(n.color),s}},t}(),lt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ut=function(t){function e(e,i){var n=t.call(this)||this;return n.setName(e),n.setValue(i),n._invisible=!1,n._runingAngle=0,n._color="#000",n._extendsLength=0,n._radiusOuter=0,n._enableAnimation=!0,n._hover=!1,n}return lt(e,t),e.prototype.setName=function(t){this.name=t},e.prototype.getName=function(){return this.name},e.prototype.setParent=function(t){this._parent=t},e.prototype.getParent=function(){return this._parent},e.prototype.setSeriesIndex=function(t){this.seriesIndex=t},e.prototype.getSeriesIndex=function(){return this.seriesIndex},e.prototype.getSeriesName=function(){return this.seriesName},e.prototype.setSeriesName=function(t){this.seriesName=t},e.prototype.setValue=function(t){if(!v(t))throw"value is can't convert to number!";this.value=parseFloat(t)},e.prototype.getValue=function(){return this.value},e.prototype.setDataIndex=function(t){this.dataIndex=t},e.prototype.getDataIndex=function(){return this.dataIndex},e.prototype._isInSector=function(t,e){var i=Math.sqrt(t*t+e*e);if(0==i)return!0;var n=t/i,r=Math.acos(n);return e<0&&(r=2*Math.PI-r),r>=this.startAngle&&r<=this.startAngle+this.angle},e.prototype.setStartAngle=function(t){this.startAngle=t},e.prototype.setAngle=function(t,e){void 0===e&&(e=!0),this.angle!=t&&(this.angle=t,e&&this.beginAngleAnimation())},e.prototype.getAngle=function(){return this.angle},e.prototype.setVisible=function(t,e){this._invisible!=!t&&(this._invisible=!t,e||this._pieEventHandler.dispatchPropertyChangeEvent({type:"needCalculateAngle",source:this}),t||(this.setAngle(0,!1),this._runingAngle=0))},e.prototype.isVisible=function(){return!this._invisible},e.prototype.getAngleForDraw=function(){return this._runingAngle},e.prototype.setColor=function(t){this._color=t},e.prototype.getColor=function(){return this._color},e.prototype.setPieEventHandler=function(t){this._pieEventHandler=t},e.prototype.getRect=function(){if(this._parent instanceof gt)return this._parent.getRect()},e.prototype.drawLegend=function(t,e){var i=e.getColor(),n=e.getFont(),r=e.getRect(),s=e.getName(),o=T(t,s,n),a=r.width-o.width-10;a>0&&(t.save(),N(t,r.x+5,r.y+2,a,r.height-4,2),t.fillStyle=e.isDisable()?"#ccc":i,t.fill(),t.restore()),r.width>o.width&&B(t,s,r.x+r.width-o.width,r.y,e.isDisable()?"#ccc":"#000",n)},e.prototype.draw=function(t,e,i,n,r,s){s instanceof gt&&function(t,e,i,n,r,s,o,a){var h=0,l=0;isNaN(n)?1==n.length?h=l=n[0]:n.length>=2&&(h=n[0],l=n[1]):h=l=n,t.save(),t.strokeStyle=o,t.fillStyle=o,t.beginPath(),h==l||null==h?t.moveTo(e,i):t.arc(e,i,h,s,r,!0),t.arc(e,i,l,r,s,!1),t.closePath(),t.fill(),t.restore()}(t,e,i,[n,r+this._extendsLength],this.startAngle,this.startAngle+this.getAngleForDraw(),this._color)},e.prototype.beginAngleAnimation=function(){var t=this;if(this._angleAnimation&&(this._angleAnimation.cancle(),this._angleAnimation=null),this._enableAnimation){var e=this.angle-this._runingAngle,i=this._runingAngle;this._angleAnimation=new st(1e3,function(n){var r=n/1e3*e;t._runingAngle=i+r,n>=1e3&&(t._runingAngle=t.angle),t._pieEventHandler.dispatchPropertyChangeEvent({type:"animation",source:t})}),this._angleAnimation.hasRun()||this._angleAnimation.run()}},e.prototype.onEnter=function(){var t=this;this._radiusAnimation&&(this._radiusAnimation.cancle(),this._radiusAnimation=null),this._enableAnimation&&(this._radiusAnimation=new st(2e3,function(e){var i=e/2e3;t._extendsLength+=10*i,t._extendsLength>10&&(t._extendsLength=10),t._pieEventHandler&&t._pieEventHandler.dispatchPropertyChangeEvent({type:"animation",source:t})}),this._radiusAnimation.hasRun()||(this._hover=!0,this._radiusAnimation.run()))},e.prototype.onLeave=function(){var t=this;this._radiusAnimation&&(this._radiusAnimation.cancle(),this._radiusAnimation=null),this._enableAnimation&&(this._radiusAnimation=new st(2e3,function(e){var i=e/2e3;t._extendsLength-=10*i,t._extendsLength<0&&(t._extendsLength=0),t._pieEventHandler&&t._pieEventHandler.dispatchPropertyChangeEvent({type:"animation",source:t})}),this._radiusAnimation.hasRun()||this._radiusAnimation.run())},e.prototype.destroy=function(){this._radiusAnimation&&(this._radiusAnimation.cancle(),this._radiusAnimation=null),this._angleAnimation&&(this._angleAnimation.cancle(),this._angleAnimation=null)},e.prototype.buildTooltipInfo=function(){return{seriesType:"pie",seriesIndex:this.getSeriesIndex(),seriesName:this.getSeriesName(),name:this.getName(),dataIndex:this.getDataIndex(),value:this.getValue(),color:this.getColor(),percent:Math.floor(.5*this.getAngle()/Math.PI*1e4)/100}},e}(nt),ct=function(){function t(t,e,i){"number"==typeof t&&NaN!=t&&(t+=""),this.text=t,this.color=e,this.font=i}return t.prototype.draw=function(t){B(t,this.text,this.x,this.y,this.color,this.font)},t.prototype.setPostion=function(t,e){this.x=t,this.y=e},t.prototype.getSize=function(t){if(!this.size){var e=t.font.replace(/\d+px\s/g,this.font+" ");this.font=e,this.size=T(t,this.text,this.font)}return this.size},t}(),pt=function(){function t(t){var e=this;this.renderList=[],t&&t.forEach(function(t){if(t){var i=new ct(t.text,t.color,t.font);e.renderList.push(i)}})}return t.prototype.getSize=function(t){var e=0,i=0;return this.size||(this.renderList.forEach(function(n){var r=n.getSize(t);r&&(i0&&i.push({text:s,color:t.color,font:t.font}),i.length>0&&n.push(i),i=void 0}e[e.length-1].length>0&&(i=i||[]).push({text:e[e.length-1],color:t.color,font:t.font})}}),i&&i.length>0&&(n.push(i),i=null),n.forEach(function(t){var i=new pt(t);e.renderList.push(i)})}return t.prototype.draw=function(t,e,i){var n=0,r=0;this.renderList.forEach(function(e){var i=e.getSize(t);i&&(n=n0},n.eventHandler=e,n._pipeEventHanlder=new tt,n._pipeEventHanlder.registerListener("propertyChange",n.onPiePropertyChangeListener,n),n._children=[],n._chart=i,n._hoverList=[],n}return ft(e,t),e.prototype.setWidth=function(t,e){void 0===e&&(e=!1);var i=parseFloat(t);i!=this.width&&(this._width=i,e||this.eventHandler.dispatchPropertyChangeEvent({type:"width",source:this}))},e.prototype.setHeight=function(t,e){void 0===e&&(e=!1);var i=parseFloat(t);i!=this.height&&(this._height=i,e||this.eventHandler.dispatchPropertyChangeEvent({type:"height",source:this}))},e.prototype.setChart=function(t){this._chart=t},e.prototype.setCenterX=function(t,e){if(void 0===e&&(e=!1),this._centerX!==t){this._centerX=this._validate(t);var i=this._convert(this._width,this._centerX),r=this._convert(this._height,this._centerY);e||this.eventHandler.dispatchPropertyChangeEvent({type:"x",source:this});var s=n(i,r);this.setMatrix(s)}},e.prototype.setCenterY=function(t,e){if(void 0===e&&(e=!1),this._centerY!==t){this._centerY=this._validate(t);var i=this._convert(this._width,this._centerY),r=this._convert(this._height,this._centerY);e||this.eventHandler.dispatchPropertyChangeEvent({type:"y",source:this});var s=n(i,r);this.setMatrix(s)}},e.prototype.setRadiusInner=function(t){this._radiusInner=this._validate(t)},e.prototype.setRadiusOuter=function(t){this._radiusOuter=this._validate(t)},e.prototype.setOptionManager=function(t){this.optionManager=t},e.prototype._getFloatFromPercentString=function(t){return parseFloat(t)},e.prototype._validate=function(t){return"number"===t||function(t){return"string"==typeof t&&x.test(t)}(t)?t:v(t)?parseFloat(t):void 0},e.prototype._convert=function(t,e){return"number"==typeof e?e:"string"==typeof e?t*parseFloat(e)/100:e},e.prototype.draw=function(t){for(var e=this._convert(this._width,this._centerX),i=this._convert(this._height,this._centerY),n=Math.min(this._width,this._height)/2,r=this._convert(n,this._radiusInner),s=this._convert(n,this._radiusOuter),o=this._startAngle,a=this.getChildren(),h=0;h0&&"function"==typeof this._hoverFormatter)(a=this._hoverFormatter(e))instanceof Array&&(this._labelRender=new dt(a),this._labelRender.draw(t,i.x,i.y));else if("function"!=typeof this._normalFormatter){if(e){var n=this._labelFontSize+"px ";if(!e||!e.name)return;var r=e.name,s=t.font.replace(/\d+px\s/g,n),o=T(t,r,s);B(t,r,i.x-o.width/2,i.y-o.height/2,e.color,s)}}else{var a,h=this.buildAllLabelParams();(a=this._normalFormatter(h))instanceof Array&&(this._labelRender=new dt(a),this._labelRender.draw(t,i.x,i.y))}}},e.prototype.setLabelPosition=function(t){this._labelPosition=t},e.prototype.setLabelFontSize=function(t){this._labelFontSize=t},e.prototype.getRect=function(){var t=this._convert(this._width,this._centerX),e=this._convert(this._height,this._centerY),i=Math.min(this._width,this._height)/2,n=this._convert(i,this._radiusOuter);return{x:t-n,y:e-n,width:2*n,height:2*n}},e.prototype.onPiePropertyChangeListener=function(t){(t.source instanceof ut||t.source instanceof e)&&(this.eventHandler.dispatchPropertyChangeEvent({type:"animation",source:this}),t.source instanceof ut&&"needCalculateAngle"===t.type&&this.calculateItemAngle())},e.prototype.getChildren=function(){return this._children},e.prototype.addChildren=function(t){var e=this;t.forEach(function(t){e._children.push(t),t.setParent(e),t.setPieEventHandler(e._pipeEventHanlder)}),this.calculateItemAngle()},e.prototype.removeByName=function(t){for(var e=this._children.length-1;e>=0;e--){var i=this._children[e];i.name===t&&this.removes([i])}},e.prototype.removes=function(t){if(t){for(;t.length>0;){var e=t.pop();if(e){var i=this._children.indexOf(e);i>=0&&this._children.splice(i,1),e.destroy()}}this.calculateItemAngle()}},e.prototype.calculateItemAngle=function(){var t=this;this._total=0;var e=0;this._children.forEach(function(e){e.isVisible()&&(t._total+=e.getValue())}),this._children.forEach(function(i){i.isVisible()&&(e=i.getValue()*Math.PI*2/t._total,i.setAngle(e,!0))})},e.prototype.destroy=function(){this._children.forEach(function(t){t&&t&&t.destroy()})},e.prototype.handleHover=function(t,e){var i=this,n=u({x:t,y:e},this._inverseMatrix),r=Math.sqrt(n.x*n.x+n.y*n.y),s=Math.min(this._width,this._height)/2,o=this._convert(s,this._radiusInner),a=this._convert(s,this._radiusOuter),h=this.getChildren(),l=[],c=this._hoverList.concat(),p=[];if(null==o&&ro&&r0&&0==l.length?this.onLeave():0==this._hoverList.length&&l.length>0&&this.onEnter(),this._hoverList=l,!1},e.prototype.onLeave=function(){this.setLabelParam(null)},e.prototype.onEnter=function(){},e.prototype.getChildById=function(t){var e=null;return this._children.forEach(function(i){i.getId()!==t||(e=i)}),e},e.prototype.setNormalFormatter=function(t){this._normalFormatter=t},e.prototype.setHoverFormatter=function(t){this._hoverFormatter=t},e.prototype.buildAllLabelParams=function(){var t=[],e=0,i={};if(this._children)return this._children.forEach(function(i){var n=i.buildTooltipInfo();n.visible=i.isVisible(),e+=n.value,t.push(n)}),i.all=t,i.total=e,i.seriesName=this.getSeriesName(),i},e.prototype._isVisible=function(){if(null==this._children||this._children.length<0)return!1;var t=!1;return this._children.forEach(function(e){e&&e.isVisible()&&(t=!0)}),t},e}(nt),yt=function(){function t(){}return t.prototype.createChart=function(t,e,i,n){var r=new gt(i,n.chart),s=d(e,"center",["50%","50%"]),o=d(e,"radius",["0%","100%"]),a=[r];r.setWidth(n.width),r.setHeight(n.height),r.setCenterX(s[0]),r.setCenterY(s[1]),r.setOptionManager(t),o instanceof Array?o.length>1?(r.setRadiusInner(o[0]),r.setRadiusOuter(o[1])):r.setRadiusOuter(o[0]):r.setRadiusOuter(o);var h=[],l=0;(e.data||[]).forEach(function(i){if(v(i.value)){var r=new ut(i.name,i.value);r.setSeriesName(e.name),r.setSeriesIndex(n.seriesIndex),r.setDataIndex(l),r.setColor(t.getPieColorByIndex(l)),h.push(r),a.push(r)}l++}),r.addChildren(h);var u=function(t){var e=d(t,"label.emphasis.textStyle.fontSize","12"),i=d(t,"label.normal.position","center");return{fontSize:parseInt(e),position:i}}(e);r.setLabelPosition(u.position),r.setLabelFontSize(u.fontSize);var c=function(t){return d(t,"label.formatters")}(e);return c&&(r.setHoverFormatter(d(c,"hover")),r.setNormalFormatter(d(c,"normal"))),r.setSeriesType("pie"),r.setSeriesName(e.name),a},t}(),vt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),xt=function(t){function e(e,i,n){var r=t.call(this)||this;return r.optionManager=e,r.valueArray=i.data,r.eventHandler=n,r}return vt(e,t),e.prototype.setColor=function(t,e){void 0===e&&(e=!1),this.color=t,e||this.eventHandler.dispatchPropertyChangeEvent({type:"color",source:this})},e.prototype.draw=function(t){console.log("draw bar:",t)},e.prototype.destroy=function(){},e}(nt),mt=function(){function t(){}return t.prototype.createChart=function(t,e,i,n){if(n=n||{},e&&e.data&&e.data.length>0)return new xt(t,e,i)},t}(),_t=Object.assign||function(t){for(var e,i=1,n=arguments.length;i=0&&this.dirtyList.splice(i,1),delete this.dirtyMap[e]}},t.prototype.sortPipeline=function(){if(this.pipelines){var t=this.pipelines.concat();this.pipelines=t.sort(function(t,e){var i=t.getZIndex(),n=e.getZIndex();return(i=isNaN(i)?0:i)<(n=isNaN(n)?0:n)?-1:i>n?1:0})}},t.prototype.isDirty=function(){return this.dirtyList.length>0},t.prototype.clearDirty=function(){this.dirtyList=[],this.dirtyMap=[]},t}(),wt=function(){function t(){this.font="12px STSong SimSun"}return t.prototype.setId=function(t){this.id=t},t.prototype.getId=function(){return this.id},t.prototype.getName=function(){return this.name},t.prototype.setName=function(t){this.name=t},t.prototype.getColor=function(){return this.color},t.prototype.setColor=function(t){this.color=t},t.prototype.isDisable=function(){return this.disable},t.prototype.setDisable=function(t){this.disable=t},t.prototype.getPosition=function(){return{x:this.x,y:this.y}},t.prototype.setPosition=function(t,e){this.x=t,this.y=e},t.prototype.getRect=function(){var t=this.getSize();return t&&null!=t.width&&null!=t.height&&null!=this.x&&null!=this.y?{x:this.x,y:this.y,width:t.width,height:t.height}:{}},t}(),Lt=function(){function t(t,e,i,n){this.font="12px STSong SimSun",this.align="right",this._invisible=!1,this.alignLeft=function(){var t=0,e=0,i=0,n=this.canvas.getContext("2d");this.renderList=[];for(var r=0;rthis.width&&e<=0?(s.setPosition(this.x,this.y+t),t+=o.height,e=0,i=0):this.widththis.width&&e<=0?(a.setPosition(this.x,this.y+t),t+=h.height,e=0,i=0):this.widththis.width&&t<=0)o.height,t=0,e=0,i.push(s);else if(this.width0;)i.push(n.pop());n.push(s)}else t+=o.width,e=0==e||e0;)i.push(n.pop());return i},t.prototype.getRect=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.getRectExtend=function(){return{x:this.x-10,y:this.y-10,width:this.width+20,height:this.height+20}},t.prototype.setFont=function(t){this.font=t},t.prototype.setWidth=function(t){this.width=t},t.prototype.addLegends=function(t){var e;if(t instanceof Array)for(var i=0;i=0&&this.items.splice(i,1),delete this.itemMap[t]}},t.prototype.updateColor=function(t,e){this.renderList.forEach(function(i){i.getName()!==t||i.setColor(e)})},t.prototype.draw=function(t){if(!this._invisible){t=t||this.canvas.getContext("2d"),this.clearRect();for(var e=0;er.width&&B(t,i,e.x+e.width-r.width,e.y,n.isDisable()?"#ccc":"#000",n.font)},n.name=e,n.color=i,n.pointRadius=12,n}return It(e,t),e.prototype.calculateSize=function(t){var e=O(t,this.name,this.font),i=k(this.font),n=e+this.paddingLeft+this.colorWidth+2*this.colorPaddingLR;return this.width=n,this.height=i,{width:n,height:i,labelWidth:e}},e}(wt),Rt={},Mt="uw-chart-instance",Et={paddingTop:20,paddingBottom:30,paddingLeft:10,paddingRight:10},kt=function(){function t(t,e){if(this.topCanvas=null,this.middleCanvas=null,this.bottomCanvas=null,this.tipContainer=null,this.barCanvas=null,this.parentDom=null,this._needRefresh=!0,this._paintAll=!0,this.width=0,this.height=0,this.optionManager=new q,this.paddings=Object.assign({},Et),this.barHeight=40,this.tootltipTimer=null,this._hoverList=[],this._initEventListener=function(){var t=this;this._dettachEventListener(),this.container.addEventListener("mousedown",this.eventHandler.mousedownListener),this.container.addEventListener("mouseup",this.eventHandler.mouseupListener),this.container.addEventListener("mouseleave",this.eventHandler.mouseleaveListener),this.container.addEventListener("mousemove",this.eventHandler.mousemoveListener),this.container.addEventListener("mousewheel",this.eventHandler.mousewheelListener),this.eventHandler.registerListener("mousedown",this.progressBar.mousedownListener),this.eventHandler.registerListener("mousemove",this.progressBar.mousemoveListener),this.eventHandler.registerListener("mouseup",this.progressBar.mouseupListener),this.eventHandler.registerListener("mouseleave",this.progressBar.mouseleaveListener),this.eventHandler.registerListener("mouseleave",function(){t._clearTopCanvas()}),this.eventHandler.registerListener("mouseleave",function(){t._leaveCanvas()}),this.eventHandler.registerListener("mousemove",this._coordinateRegionListener),this.eventHandler.registerListener("mousedown",function(){t._legendClick(event)}),this.eventHandler.registerListener("mousemove",function(){t._legendSelect(event)}),this.eventHandler.registerListener("propertyChange",function(e){t._onPropertyChange(e)}),this.eventHandler.registerListener("mousewheel",function(e){t._coordinateRegionWheelListener(e)})},this._dettachEventListener=function(){this.container.removeEventListener("mousedown",this.eventHandler.mousedownListener),this.container.removeEventListener("mouseup",this.eventHandler.mouseupListener),this.container.removeEventListener("mouseleave",this.eventHandler.mouseleaveListener),this.container.removeEventListener("mousemove",this.eventHandler.mousemoveListener),this.container.removeEventListener("mousewheel",this.eventHandler.mousewheelListener),this.eventHandler.unRegisterListener("mousedown"),this.eventHandler.unRegisterListener("mousemove"),this.eventHandler.unRegisterListener("mouseup"),this.eventHandler.unRegisterListener("mouseleave"),this.eventHandler.unRegisterListener("propertyChange"),this.eventHandler.unRegisterListener("mousewheel")},this.parentDom=e,this._instanceId=p(),e){var i=e.getAttribute(Mt);i&&Rt[i]&&(Rt[i].destroy(),delete Rt[i]),e.setAttribute(Mt,this._instanceId)}this.type=t;var n=function(t){if(t){var e=document.createElement("div");e.style.position="relative";var i=Bt(),n=Bt(),r=Bt(),s=Bt(),o=function(){var t=document.createElement("div");return it(t,{position:"absolute",display:"none",whiteSpace:"nowrap",zIndex:"9999999",transition:"left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.2s cubic-bezier(0.23, 1, 0.32, 1)",left:"10px",top:"10px"}),t}();return t.appendChild(e),e.appendChild(n),e.appendChild(s),e.appendChild(r),e.appendChild(i),e.appendChild(o),{container:e,topCanvas:i,barCanvas:n,middleCanvas:r,bottomCanvas:s,tipContainer:o}}}(e);Rt[this._instanceId]=this,this.container=n.container,this.topCanvas=n.topCanvas,this.middleCanvas=n.middleCanvas,this.bottomCanvas=n.bottomCanvas,this.tipContainer=n.tipContainer,this.barCanvas=n.barCanvas,this.progressBar=this.createProgressBar(this.barHeight),this._coordinateRegionListener=this._coordinateRegionListener.bind(this),this.eventHandler=new tt,this._initEventListener(),this.tooltip=new et(this.tipContainer),this.legend=new Lt(this.bottomCanvas,0,0,this.width),this.legend.setEventHandler(this.eventHandler),this.dataContainer=new bt(this.eventHandler),this.propertyChangeHandler=new At(this),this.properties={},this.survivalMonitor()}return t.prototype.setOption=function(t){var e=this;this.optionManager.setOption(t);var i=this.parentDom.clientWidth,n=this.parentDom.clientHeight,r={width:parseInt(i),height:parseInt(n),chart:this},s=0!=this.optionManager.getFromOption("legend.show");this.legend.setVisible(!!s,!0),this.dataContainer.initPipelines(this.optionManager,r),this.setSize(i,n,this.optionManager.getGrid()),this.setCoordinateStyle(),this.transformChartLine(),function(t){let e=function(){t&&t(),requestAnimationFrame(e,16)};requestAnimationFrame(e,16)}(function(){e.needRefresh()&&e.draw()})},t.prototype.setCoordinateStyle=function(){var t=this.optionManager.getFromOption("yAxis")||{},e=d(t,"axisLine.show",!0),i=d(t,"axisTick.show",!0),n=d(t,"axisLabel.inside",!1);this.coordinate.setYAxisLabelInside(n),this.coordinate.setYAxisLineVisible(e),this.coordinate.setYAxisTickVisible(i);var r=d(t,"splitLine",{});"object"==typeof r&&(this.coordinate.axisParam.yAxis.splitLine=Object.assign({},this.coordinate.axisParam.yAxis.splitLine,r))},t.prototype.transformChartLine=function(){var t=this;this._animationArray=[];var e={x:this.coordinate.origin.x,y:this.coordinate.origin.y,width:this.coordinate.xAxisLength,height:this.coordinate.yAxisLength},i=this.optionManager.createMatrix(e);this.dataContainer.getPipelines().forEach(function(e){if(e instanceof nt){e instanceof at&&(e.setMatrix(i),e.calculatePointInfo());var n=e.buildAnimation();t._animationArray.push(n)}})},t.prototype.buildLegendItems=function(){var t=[];this.dataContainer.getPipelines().forEach(function(e){if(e instanceof at){var i=e.getName();i&&((n=new Ct(i,e.getColor())).setId(e.getId()),t.push(n))}else if(e instanceof ut){var n,r=e.getName();r&&((n=new St(r,e.getColor())).setId(e.getId()),t.push(n))}}),this.legend.addLegends(t)},t.prototype.setSize=function(t,e,i){var n=parseInt(t),r=parseInt(e);this.width=n,this.height=r,this.container.style.width=n+"px",this.container.style.height=r+"px",D(this.topCanvas,n,r),D(this.middleCanvas,n,r),D(this.bottomCanvas,n,r),D(this.barCanvas,n,r),this.paddings=i||Object.assign({},Et),this.calculateLayout()},t.prototype.getSize=function(){return{width:this.width,height:this.height}},t.prototype.calculateLayout=function(){var t=this.width,e=this.height;this.legend.setWidth(this.width),this.buildLegendItems();var i=0;this.legend.isVisible()&&(i=this.legend.getHeight());var n=this.paddings.paddingLeft,r=0,s=this.optionManager.getDataZoom();s&&(r=this.barHeight);var o=e-this.paddings.paddingBottom-r,a=t-this.paddings.paddingLeft-this.paddings.paddingLeft,h=e-this.paddings.paddingTop-this.paddings.paddingBottom-r-i;if(s){var l=this.height-r,u=this.paddings.paddingLeft;this.progressBar.resize(u,l,a,r),this.progressBar.setBoundRect({x:0,y:l-3,width:t,height:r+6}),this.progressBar.setVisible(!0),this.progressBar.setLeftBtnValue(s.start),this.progressBar.setRightBtnValue(s.end);var c=this.optionManager.getXAxisCount()-1,p=Math.round(c*s.start),d=Math.round(c*s.end);this.optionManager.setIndexRange(p,d)}else this.progressBar.setVisible(!1);var f={x:n,y:o,width:a,height:h};this.coordinate=this.optionManager.createCoordinate(f),this._needRefresh=!0},t.prototype.destroy=function(){this._survivalTimer&&(clearTimeout(this._survivalTimer),this._survivalTimer=null),this._dettachEventListener(),this.destroyAllAnimation(),this._instanceId&&Rt[this._instanceId]&&delete Rt[this._instanceId],this.parentDom.contains(this.container)&&(this.parentDom.removeChild(this.container),this.parentDom.removeAttribute(Mt),this.topCanvas=null,this.middleCanvas=null,this.barCanvas=null,this.bottomCanvas=null,this.tipContainer=null),this.dataContainer.getPipelines().forEach(function(t){t&&"function"==typeof t.destroy&&t.destroy()})},t.prototype.createProgressBar=function(t){var e=t,i=this.height-e,n=this.paddings.paddingLeft,r=this.width-this.paddings.paddingLeft-this.paddings.paddingRight,s=new Q(this.topCanvas,this.optionManager,n,i,r,e,20,0,1,this._handleXAsixChange.bind(this),10,e);return s.setVisible(!1),s},t.prototype._handleXAsixChange=function(){var t=this,e=this.progressBar.getRightBtnValue(),i=this.progressBar.getLeftBtnValue(),n=this.optionManager.getXAxis(),r=1;n&&n.length>0&&(r=n.length-1);var s=Math.round(r*i),o=Math.round(r*e);this.optionManager.setIndexRange(s,o),this.coordinate.setStickCounts(o-s+1,this.coordinate.yStickCount);var a=this.optionManager.createXAxisLabels();this.coordinate.setXAxisLabels(a),this.coordinate.calculate(),this.coordinate._needRefresh=!0;var h=this.dataContainer.getPipelines(),l={x:this.coordinate.origin.x,y:this.coordinate.origin.y,width:this.coordinate.xAxisLength,height:this.coordinate.yAxisLength},u=this.optionManager.createMatrix(l);h.forEach(function(e){if(e instanceof at){var i=t.optionManager.getIndexRange();e.setMatrix(u),e.setIndexRange(i.startIndex,i.endIndex),e.needCalculate()&&(t._needRefresh=!0,e.calculatePointInfo())}})},t.prototype._legendSelect=function(t){var e=t.offsetX||t.layerX,i=t.offsetY||t.layerY;if(H(this.legend.getRectExtend(),e,i)){var n=this.legend.getLegendItemByPos(e,i);K(this.topCanvas,n?"pointer":"default")}},t.prototype._onPropertyChange=function(t){t&&this.propertyChangeHandler.handle(t)},t.prototype._legendClick=function(t){var e=t.offsetX||t.layerX,i=t.offsetY||t.layerY,n=this.legend.getLegendItemByPos(e,i);if(n){var r,s=n.getName();n.isDisable()?(r=this.dataContainer.getPipelineByName(s))&&r.setVisible(!0):(r=this.dataContainer.getPipelineByName(s))&&r.setVisible(!1),n.setDisable(!n.isDisable()),this.legend.refresh()}},t.prototype._leaveCanvas=function(){var t=this;this._hoverList.forEach(function(e){var i=t.dataContainer.getPipelineById(e);i&&i.onLeave&&i.onLeave()}),this._hoverList=[]},t.prototype._coordinateRegionListener=function(t){var e=this,i=this._getCoordinateRegion(),n=t.offsetX||t.layerX,r=t.offsetY||t.layerY;this.markPointAnimation&&(this.markPointAnimation.cancle(),this.markPointAnimation=null),this._clearTopCanvas();var s=this.dataContainer.getPipelines(),o={};H(i,n,r)&&this.optionManager.getFromOption("xAxis")&&(o=this.handleLineHoverData(n,r,s),this.markPointAnimation&&(this.markPointAnimation.cancle(),this.markPointAnimation=null),this.markPointAnimation=new st(100,function(t){var i=t/100;e._drawMarkPoints(n,r,o,4*i)}),this.markPointAnimation.run()),o.items=o.items||[];var a=[],h=[],l=this._hoverList.concat();s.forEach(function(t){if(t instanceof gt&&t.getHover(n,r,o)){var e=t.getId();e&&h.push(e)}});var u=this.legend.getLegendItemByPos(n,r);if(u){var c=u.getId(),p=this.dataContainer.getPipelineById(c);if(p instanceof ut&&p.getParent()){var d=p.getParent();d.setLabelParam(null);var f=d.getId();if(f&&h.indexOf(f)<0&&h.push(f),!u.isDisable()){h.push(c);var g=p.buildTooltipInfo();o.items.push(g),d.setLabelParam(g)}}}h.forEach(function(t){var e=l.indexOf(t);e<0?a.push(t):l.splice(e,1)}),l.forEach(function(t){var i=e.dataContainer.getPipelineById(t);i&&i.onLeave&&i.onLeave()}),a.forEach(function(t){var i=e.dataContainer.getPipelineById(t);i&&i.onEnter&&i.onEnter()}),this._hoverList=h,this._handleTooltip(n,r,o,this.optionManager,{width:this.topCanvas.width,height:this.topCanvas.height})},t.prototype._coordinateRegionWheelListener=function(t){var e=this._getCoordinateRegion();this.progressBar&&this.progressBar.isVisible()&&(e=function(t,e){if(null==t)return e;if(null==e)return t;var i=Math.min(t.x,e.x),n=Math.min(t.y,e.y);return{x:i,y:n,width:Math.max(t.x+t.width-i,e.x+e.width-i),height:Math.max(t.y+t.height-n,e.y+e.height-n)}}(e,this.progressBar.getRegion()));var i=t.offsetX||t.layerX,n=t.offsetY||t.layerY;if(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),this.markPointAnimation&&(this.markPointAnimation.cancle(),this.markPointAnimation=null),H(e,i,n)){var r=t.wheelDelta,s=0;0!=(s=Math.abs(r)>10?r/120:r/3)&&this.eventHandler.dispatchPropertyChangeEvent({type:"mousewheel",source:this,value:s})}return!1},t.prototype._clearTopCanvas=function(){this.tooltip.hide(),this.markPointAnimation&&(this.markPointAnimation.cancle(),this.markPointAnimation=null);var t=this.topCanvas.getContext("2d"),e=parseInt(this.topCanvas.width),i=parseInt(this.topCanvas.height);t.save(),t.clearRect(0,0,e,i),t.restore()},t.prototype._handleTooltip=function(t,e,i,n,r){this.topCanvas&&this.tooltip.show(t,e,i,20,r,n)},t.prototype._getCoordinateRegion=function(){return this.coordinate.getRect()},t.prototype.refresh=function(){this._needRefresh=!0},t.prototype.handleLineHoverData=function(t,e,i){var n={},r=[];if(n.items=[],n.selectedPoints=r,n.items=[],i)for(var s=0;s0||this._needRefresh)&&(this._refreshPipeline(void 0),this.dataContainer.clearDirty()),this._needRefresh=!1},t.prototype._refreshPipeline=function(t){var e=this,i=this.dataContainer.pipelines,n=this.middleCanvas.getContext("2d");n.save(),n.clearRect(0,0,this.width,this.height),n.restore(),n.save(),i.forEach(function(i){i&&i.isVisible()&&(i instanceof at?(i.setIndexInterval(e.optionManager.getIndexInterval(),!0),t&&t<1?i.drawByPercent(n,t):i.draw(n)):i instanceof gt&&i.draw(n),e._needRefresh=!1,e.dataContainer.removeFromDirty(i))}),n.restore(),this._needRefresh=!1},t.prototype._drawMarkPoints=function(t,e,i,n){if(void 0===n&&(n=4),this._animationArray&&(this._animationArray.forEach(function(t){t instanceof st&&t.done(!0)}),this._animationArray=null),this.topCanvas&&null!=this.optionManager.getFromOption("xAxis")){var r=this.topCanvas.getContext("2d"),s=t-this.coordinate.origin.x,o=(0==this.coordinate.xSpan?0:Math.round(s/this.coordinate.xSpan))*this.coordinate.xSpan+this.coordinate.origin.x,a={x:o,y:this.coordinate.origin.y},h={x:o,y:this.coordinate.origin.y-this.coordinate.yAxisLength};r.save(),L(r,a,h,"#c0c0c0",1);for(var l=i.selectedPoints,u=0;uM.length&&M.push(t)}function B(t,e,i,n){var r=typeof t;"undefined"!==r&&"boolean"!==r||(t=null);var s=!1;if(null===t)s=!0;else switch(r){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case h:case l:s=!0}}if(s)return i(n,t,""===e?"."+V(t,0):e),1;if(s=0,e=""===e?".":e+":",Array.isArray(t))for(var o=0;o