t.width-t.area[1]-t.area[3]?(i.push(p),u.push(o-t.legend.itemGap*t.pix),o=s,p=[r]):(o+=s,p.push(r))}if(p.length){i.push(p),u.push(o-t.legend.itemGap*t.pix),n.widthArr=u;let e=Math.max.apply(null,u);switch(t.legend.float){case"left":n.area.start.x=t.area[3],n.area.end.x=t.area[3]+e+2*r;break;case"right":n.area.start.x=t.width-t.area[1]-e-2*r,n.area.end.x=t.width-t.area[1];break;default:n.area.start.x=(t.width-e)/2-r,n.area.end.x=(t.width+e)/2+r}n.area.width=e+2*r,n.area.wholeWidth=e+2*r,n.area.height=i.length*d+2*r,n.area.wholeHeight=i.length*d+2*r+2*s,n.points=i}}else{let i=e.length,o=t.height-t.area[0]-t.area[2]-2*s-2*r,u=Math.min(Math.floor(o/d),i);switch(n.area.height=u*d+2*r,n.area.wholeHeight=u*d+2*r,t.legend.float){case"top":n.area.start.y=t.area[0]+s,n.area.end.y=t.area[0]+s+n.area.height;break;case"bottom":n.area.start.y=t.height-t.area[2]-s-n.area.height,n.area.end.y=t.height-t.area[2]-s;break;default:n.area.start.y=(t.height-n.area.height)/2,n.area.end.y=(t.height+n.area.height)/2}let p=i%u==0?i/u:Math.floor(i/u+1),g=[];for(let t=0;to&&(o=n)}n.widthArr.push(o),n.heightArr.push(e.length*d+2*r)}let e=0;for(let t=0;t0?p[i].width+t.yAxis.padding*t.pix:p[i].width,a+=1):"right"==p[i].position&&(t.area[1]+=e>0?p[i].width+t.yAxis.padding*t.pix:p[i].width,e+=1)}else i.yAxisWidth=p;if(t.chartData.yAxisData=u,t.categories&&t.categories.length&&"radar"!==t.type&&"gauge"!==t.type&&"bar"!==t.type){t.chartData.xAxisData=ba(t.categories,t);let e=na(t.categories,t,0,t.chartData.xAxisData.eachSpacing,o),a=e.xAxisHeight,n=e.angle;i.xAxisHeight=a,i._xAxisTextAngle_=n,t.area[2]+=a,t.chartData.categoriesData=e}else if("line"===t.type||"area"===t.type||"scatter"===t.type||"bubble"===t.type||"bar"===t.type){t.chartData.xAxisData=ra(n,t,i,o);let e=na(r=t.chartData.xAxisData.rangesFormat,t,0,t.chartData.xAxisData.eachSpacing,o),a=e.xAxisHeight,s=e.angle;i.xAxisHeight=a,i._xAxisTextAngle_=s,t.area[2]+=a,t.chartData.categoriesData=e}else t.chartData.xAxisData={xAxisPoints:[]};if(t.enableScroll&&"right"==t.xAxis.scrollAlign&&void 0===t._scrollDistance_){let e=0,i=t.chartData.xAxisData.xAxisPoints,o=t.chartData.xAxisData.startX;e=t.chartData.xAxisData.endX-o-t.chartData.xAxisData.eachSpacing*(i.length-1),a.scrollOption.currentOffset=e,a.scrollOption.startTouchX=e,a.scrollOption.distance=0,a.scrollOption.lastMoveTime=0,t._scrollDistance_=e}switch("pie"!==e&&"ring"!==e&&"rose"!==e||(i._pieTextMaxLength_=!1===t.dataLabel?0:function(e,t,i,o){e=la(e);let a=0;for(let n=0;n4&&void 0!==arguments[4]?arguments[4]:1,n=Oo({},{type:"normal",autoColors:!0},t.extra.word);t.chartData.wordCloudData||(t.chartData.wordCloudData=rn(t,n.type,o)),o.beginPath(),o.setFillStyle(t.background),o.rect(0,0,t.width,t.height),o.fill(),o.save();let r=t.chartData.wordCloudData;o.translate(t.width/2,t.height/2);for(let s=0;s0&&(t.tooltip&&t.tooltip.index==s?o.strokeText(e,(r[s].areav[0]+5-t.width/2)*a-n*(1-a)/2,(r[s].areav[1]+5+i-t.height/2)*a):o.fillText(e,(r[s].areav[0]+5-t.width/2)*a-n*(1-a)/2,(r[s].areav[1]+5+i-t.height/2)*a)):r[s].area[0]>0&&(t.tooltip&&t.tooltip.index==s?o.strokeText(e,(r[s].area[0]+5-t.width/2)*a-n*(1-a)/2,(r[s].area[1]+5+i-t.height/2)*a):o.fillText(e,(r[s].area[0]+5-t.width/2)*a-n*(1-a)/2,(r[s].area[1]+5+i-t.height/2)*a)),o.stroke(),o.restore()}o.restore()}(n,t,i,o,e),cn(0,o)},onAnimationFinish:function(){a.uevent.trigger("renderComplete")}});break;case"map":o.clearRect(0,0,t.width,t.height),function(e,t,i,o){var a,n,r=Oo({},{border:!0,mercator:!1,borderWidth:1,active:!0,borderColor:"#666666",fillOpacity:.6,activeBorderColor:"#f04864",activeFillColor:"#facc14",activeFillOpacity:1},t.extra.map),s=e,l=function(e){for(var t,i={xMin:180,xMax:0,yMin:90,yMax:0},o=0;os.x?i.xMax:s.x,i.yMin=i.yMins.y?i.yMax:s.y}}return i}(s);if(r.mercator){var c=Za(l.xMax,l.yMax),h=Za(l.xMin,l.yMin);l.xMax=c[0],l.yMax=c[1],l.xMin=h[0],l.yMin=h[1]}for(var d=t.width/Math.abs(l.xMax-l.xMin),u=t.height/Math.abs(l.yMax-l.yMin),p=d{this.uevent.trigger("renderComplete")}),50);break;case"funnel":this.animationInstance=new dn({timing:t.timing,duration:s,onProcess:function(e){o.clearRect(0,0,t.width,t.height),t.rotate&&Ia(o,t),t.chartData.funnelData=function(e,t,i,o){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,n=Oo({},{type:"funnel",activeWidth:10,activeOpacity:.3,border:!1,borderWidth:2,borderColor:"#FFFFFF",fillOpacity:1,minSize:0,labelAlign:"right",linearType:"none",customColor:[]},t.extra.funnel),r=(t.height-t.area[0]-t.area[2])/e.length,s={x:t.area[3]+(t.width-t.area[1]-t.area[3])/2,y:t.height-t.area[2]},l=n.activeWidth*t.pix,c=Math.min((t.width-t.area[1]-t.area[3])/2-l,(t.height-t.area[0]-t.area[2])/2-l),h=ca(e,c,n,r,a);if(o.save(),o.translate(s.x,s.y),n.customColor=$o(n.linearType,n.customColor,e,i),"pyramid"==n.type)for(let p=0;p4&&void 0!==arguments[4]?arguments[4]:1,n=Oo({},{type:"straight",width:2,activeType:"none",linearType:"none",onShadow:!1,animation:"vertical"},t.extra.line);n.width*=t.pix;let r=t.chartData.xAxisData,s=r.xAxisPoints,l=r.eachSpacing;var c=[];o.save();let h=0,d=t.width+l;return t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&(o.translate(t._scrollDistance_,0),h=-t._scrollDistance_-2*l+t.area[3],d=h+(t.xAxis.itemCount+4)*l),e.forEach((function(e,r){let u,p,g;o.beginPath(),o.setStrokeStyle(e.color),o.moveTo(-1e4,-1e4),o.lineTo(-10001,-10001),o.stroke(),u=[].concat(t.chartData.yAxisData.ranges[e.index]),p=u.pop(),g=u.shift();var f=Ta(e.data,p,g,s,l,t,i,n,a);c.push(f);var x=aa(f,e);if("dash"==e.lineType){let i=e.dashLength?e.dashLength:8;i*=t.pix,o.setLineDash([i,i])}o.beginPath();var y=e.color;if("none"!==n.linearType&&e.linearColor&&e.linearColor.length>0){for(var m=o.createLinearGradient(t.chartData.xAxisData.startX,t.height/2,t.chartData.xAxisData.endX,t.height/2),v=0;v0?o.setShadow(e.setShadow[0],e.setShadow[1],e.setShadow[2],e.setShadow[3]):o.setShadow(0,0,0,"rgba(0,0,0,0)"),o.setLineWidth(n.width),x.forEach((function(e,t){if(1===e.length)o.moveTo(e[0].x,e[0].y);else{o.moveTo(e[0].x,e[0].y);let t=0;if("curve"===n.type)for(let a=0;ah&&(o.moveTo(n.x,n.y),t=1),a>0&&n.x>h&&n.xh&&(o.moveTo(a.x,a.y),t=1),i>0&&a.x>h&&a.xh&&(o.moveTo(a.x,a.y),t=1),i>0&&a.x>h&&a.x4&&void 0!==arguments[4]?arguments[4]:1;Oo({},{type:"circle"},t.extra.scatter);let n=t.chartData.xAxisData,r=n.xAxisPoints,s=n.eachSpacing;var l=[];o.save();let c=0;return t.width,t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&(o.translate(t._scrollDistance_,0),c=-t._scrollDistance_-2*s+t.area[3],t.xAxis.itemCount),e.forEach((function(e,n){let l,c,h;l=[].concat(t.chartData.yAxisData.ranges[e.index]),c=l.pop(),h=l.shift();var d=wa(e.data,c,h,r,s,t,i,a);o.beginPath(),o.setStrokeStyle(e.color),o.setFillStyle(e.color),o.setLineWidth(1*t.pix);var u=e.pointShape;if("diamond"===u)d.forEach((function(e,t){null!==e&&(o.moveTo(e.x,e.y-4.5),o.lineTo(e.x-4.5,e.y),o.lineTo(e.x,e.y+4.5),o.lineTo(e.x+4.5,e.y),o.lineTo(e.x,e.y-4.5))}));else if("circle"===u)d.forEach((function(e,i){null!==e&&(o.moveTo(e.x+2.5*t.pix,e.y),o.arc(e.x,e.y,3*t.pix,0,2*Math.PI,!1))}));else if("square"===u)d.forEach((function(e,t){null!==e&&(o.moveTo(e.x-3.5,e.y-3.5),o.rect(e.x-3.5,e.y-3.5,7,7))}));else if("triangle"===u)d.forEach((function(e,t){null!==e&&(o.moveTo(e.x,e.y-4.5),o.lineTo(e.x-4.5,e.y+4.5),o.lineTo(e.x+4.5,e.y+4.5),o.lineTo(e.x,e.y-4.5))}));else if("triangle"===u)return;o.closePath(),o.fill(),o.stroke()})),!1!==t.dataLabel&&1===a&&e.forEach((function(e,n){let l,c,h;l=[].concat(t.chartData.yAxisData.ranges[e.index]),c=l.pop(),h=l.shift(),Ea(wa(e.data,c,h,r,s,t,i,a),e,i,o,t)})),o.restore(),{xAxisPoints:r,calPoints:l,eachSpacing:s}}(n,t,i,o,e),s=a.xAxisPoints,l=a.calPoints,c=a.eachSpacing;t.chartData.xAxisPoints=s,t.chartData.calPoints=l,t.chartData.eachSpacing=c,Va(0,t,i,o),!1!==t.enableMarkLine&&1===e&&ja(t,0,o),Ya(t.series,t,i,o,t.chartData),Ja(t,i,o,e),cn(0,o)},onAnimationFinish:function(){a.uevent.trigger("renderComplete")}});break;case"bubble":this.animationInstance=new dn({timing:t.timing,duration:s,onProcess:function(e){o.clearRect(0,0,t.width,t.height),t.rotate&&Ia(o,t),Xa(0,t,0,o),Ka(r,t,i,o);var a=function(e,t,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,n=Oo({},{opacity:1,border:2},t.extra.bubble);let r=t.chartData.xAxisData,s=r.xAxisPoints,l=r.eachSpacing;var c=[];o.save();let h=0;return t.width,t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&(o.translate(t._scrollDistance_,0),h=-t._scrollDistance_-2*l+t.area[3],t.xAxis.itemCount),e.forEach((function(e,r){let c,h,d;c=[].concat(t.chartData.yAxisData.ranges[e.index]),h=c.pop(),d=c.shift();var u=wa(e.data,h,d,s,l,t,i,a);o.beginPath(),o.setStrokeStyle(e.color),o.setLineWidth(n.border*t.pix),o.setFillStyle(Ro(e.color,n.opacity)),u.forEach((function(e,i){o.moveTo(e.x+e.r,e.y),o.arc(e.x,e.y,e.r*t.pix,0,2*Math.PI,!1)})),o.closePath(),o.fill(),o.stroke(),!1!==t.dataLabel&&1===a&&u.forEach((function(a,n){o.beginPath();var r=e.textSize*t.pix||i.fontSize;o.setFontSize(r),o.setFillStyle(e.textColor||"#FFFFFF"),o.setTextAlign("center"),o.fillText(String(a.t),a.x,a.y+r/2),o.closePath(),o.stroke(),o.setTextAlign("left")}))})),o.restore(),{xAxisPoints:s,calPoints:c,eachSpacing:l}}(n,t,i,o,e),s=a.xAxisPoints,l=a.calPoints,c=a.eachSpacing;t.chartData.xAxisPoints=s,t.chartData.calPoints=l,t.chartData.eachSpacing=c,Va(0,t,i,o),!1!==t.enableMarkLine&&1===e&&ja(t,0,o),Ya(t.series,t,i,o,t.chartData),Ja(t,i,o,e),cn(0,o)},onAnimationFinish:function(){a.uevent.trigger("renderComplete")}});break;case"mix":this.animationInstance=new dn({timing:t.timing,duration:s,onProcess:function(e){o.clearRect(0,0,t.width,t.height),t.rotate&&Ia(o,t),Xa(0,t,0,o),Ka(r,t,i,o);var a=function(e,t,i,o){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,n=t.chartData.xAxisData,r=n.xAxisPoints,s=n.eachSpacing,l=Oo({},{width:s/2,barBorderCircle:!1,barBorderRadius:[],seriesGap:2,linearType:"none",linearOpacity:1,customColor:[],colorStop:0},t.extra.mix.column),c=Oo({},{opacity:.2,gradient:!1},t.extra.mix.area),h=Oo({},{width:2},t.extra.mix.line),d=t.height-t.area[2],u=[];var p=0,g=0;e.forEach((function(e,t){"column"==e.type&&(g+=1)})),o.save();let f=-2,x=r.length+2,y=0,m=t.width+s;t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&(o.translate(t._scrollDistance_,0),f=Math.floor(-t._scrollDistance_/s)-2,x=f+t.xAxis.itemCount+4,y=-t._scrollDistance_-2*s+t.area[3],m=y+(t.xAxis.itemCount+4)*s),l.customColor=$o(l.linearType,l.customColor,e,i),e.forEach((function(e,n){let v,b,S;v=[].concat(t.chartData.yAxisData.ranges[e.index]),b=v.pop(),S=v.shift();var w=wa(e.data,b,S,r,s,t,i,a);if(u.push(w),"column"==e.type){w=fa(w,s,g,p,0,t);for(let i=0;if&&iu?u:s,c=c>u?u:c,h=h>u?u:h,d=d>u?u:d,s=s<0?0:s,c=c<0?0:c,h=h<0?0:h,d=d<0?0:d,o.arc(e+s,i+s,s,-Math.PI,-Math.PI/2),o.arc(e+n-c,i+c,c,-Math.PI/2,0),o.arc(e+n-h,i+r-h,h,0,Math.PI/2),o.arc(e+d,i+r-d,d,Math.PI/2,Math.PI)}else o.moveTo(T,a.y),o.lineTo(T+a.width,a.y),o.lineTo(T+a.width,t.height-t.area[2]),o.lineTo(T,t.height-t.area[2]),o.lineTo(T,a.y),o.setLineWidth(1),o.setStrokeStyle(_);o.setFillStyle(A),o.closePath(),o.fill()}}p+=1}if("area"==e.type){let i=aa(w,e);for(let a=0;a1){var C=n[0];let t=n[n.length-1];o.moveTo(C.x,C.y);let i=0;if("curve"===e.style)for(let e=0;ey&&(o.moveTo(t.x,t.y),i=1),e>0&&t.x>y&&t.xy&&(o.moveTo(t.x,t.y),i=1),e>0&&t.x>y&&t.xy&&(o.moveTo(a.x,a.y),t=1),e>0&&a.x>y&&a.xy&&(o.moveTo(a.x,a.y),t=1),e>0&&a.x>y&&a.x4&&void 0!==arguments[4]?arguments[4]:1,n=t.chartData.xAxisData,r=n.xAxisPoints,s=n.eachSpacing,l=Oo({},{type:"group",width:s/2,meterBorder:4,meterFillColor:"#FFFFFF",barBorderCircle:!1,barBorderRadius:[],seriesGap:2,linearType:"none",linearOpacity:1,customColor:[],colorStop:0,labelPosition:"outside"},t.extra.column),c=[];o.save();let h=-2,d=r.length+2;return t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&(o.translate(t._scrollDistance_,0),h=Math.floor(-t._scrollDistance_/s)-2,d=h+t.xAxis.itemCount+4),t.tooltip&&t.tooltip.textList&&t.tooltip.textList.length&&1===a&&$a(t.tooltip.offset.x,t,0,o,s),l.customColor=$o(l.linearType,l.customColor,e,i),e.forEach((function(n,u){let p,g,f;p=[].concat(t.chartData.yAxisData.ranges[n.index]),g=p.pop(),f=p.shift();let x=(t.height-t.area[0]-t.area[2])*(0-g)/(f-g),y=t.height-Math.round(x)-t.area[2];n.zeroPoints=y;var m=n.data;switch(l.type){case"group":var v=Aa(m,g,f,r,s,t,i,y,a),b=Ca(m,g,f,r,s,t,i,u,e,a);c.push(b),v=fa(v,s,e.length,u,0,t);for(let e=0;eh&&ey?y:i.y,a=i.width,n=Math.abs(y-i.y);l.barBorderCircle&&(l.barBorderRadius=[a/2,a/2,0,0]),i.y>y&&(l.barBorderRadius=[0,0,a/2,a/2]);let[r,s,c,h]=l.barBorderRadius,d=Math.min(a/2,n/2);r=r>d?d:r,s=s>d?d:s,c=c>d?d:c,h=h>d?d:h,r=r<0?0:r,s=s<0?0:s,c=c<0?0:c,h=h<0?0:h,o.arc(e+r,t+r,r,-Math.PI,-Math.PI/2),o.arc(e+a-s,t+s,s,-Math.PI/2,0),o.arc(e+a-c,t+n-c,c,0,Math.PI/2),o.arc(e+h,t+n-h,h,Math.PI/2,Math.PI)}else o.moveTo(S,i.y),o.lineTo(S+i.width,i.y),o.lineTo(S+i.width,y),o.lineTo(S,y),o.lineTo(S,i.y),o.setLineWidth(1),o.setStrokeStyle(A);o.setFillStyle(T),o.closePath(),o.fill()}}break;case"stack":v=Ca(m,g,f,r,s,t,i,u,e,a),c.push(v),v=ma(v,s,e.length,0,0,t);for(let e=0;eh&&e0&&(w-=P),o.setFillStyle(T),o.moveTo(S,i.y),o.fillRect(S,i.y,i.width,w),o.closePath(),o.fill()}}break;case"meter":v=wa(m,g,f,r,s,t,i,a),c.push(v),v=ya(v,s,e.length,u,0,t,l.meterBorder);for(let e=0;eh&&e0&&(o.setStrokeStyle(n.color),o.setLineWidth(l.meterBorder*t.pix)),0==u?o.setFillStyle(l.meterFillColor):o.setFillStyle(i.color||n.color),S=i.x-i.width/2,w=t.height-i.y-t.area[2],l.barBorderRadius&&4===l.barBorderRadius.length||!0===l.barBorderCircle){const e=S,t=i.y,a=i.width,n=y-i.y;l.barBorderCircle&&(l.barBorderRadius=[a/2,a/2,0,0]);let[r,s,c,h]=l.barBorderRadius,d=Math.min(a/2,n/2);r=r>d?d:r,s=s>d?d:s,c=c>d?d:c,h=h>d?d:h,r=r<0?0:r,s=s<0?0:s,c=c<0?0:c,h=h<0?0:h,o.arc(e+r,t+r,r,-Math.PI,-Math.PI/2),o.arc(e+a-s,t+s,s,-Math.PI/2,0),o.arc(e+a-c,t+n-c,c,0,Math.PI/2),o.arc(e+h,t+n-h,h,Math.PI/2,Math.PI),o.fill()}else o.moveTo(S,i.y),o.lineTo(S+i.width,i.y),o.lineTo(S+i.width,y),o.lineTo(S,y),o.lineTo(S,i.y),o.fill();0==u&&l.meterBorder>0&&(o.closePath(),o.stroke())}}}})),!1!==t.dataLabel&&1===a&&e.forEach((function(n,c){let h,d,u;h=[].concat(t.chartData.yAxisData.ranges[n.index]),d=h.pop(),u=h.shift();var p=n.data;switch(l.type){case"group":Ra(fa(Aa(p,d,u,r,s,t,i,a),s,e.length,c,0,t),n,i,o,t);break;case"stack":Ra(Ca(p,d,u,r,s,t,i,c,e,a),n,i,o,t);break;case"meter":Ra(wa(p,d,u,r,s,t,i,a),n,i,o,t)}})),o.restore(),{xAxisPoints:r,calPoints:c,eachSpacing:s}}(n,t,i,o,e),s=a.xAxisPoints,l=a.calPoints,c=a.eachSpacing;t.chartData.xAxisPoints=s,t.chartData.calPoints=l,t.chartData.eachSpacing=c,Va(0,t,i,o),!1!==t.enableMarkLine&&1===e&&ja(t,0,o),Ya(t.series,t,i,o,t.chartData),Ja(t,i,o,e),cn(0,o)},onAnimationFinish:function(){a.uevent.trigger("renderComplete")}});break;case"mount":this.animationInstance=new dn({timing:t.timing,duration:s,onProcess:function(e){o.clearRect(0,0,t.width,t.height),t.rotate&&Ia(o,t),Xa(0,t,0,o),Ka(r,t,i,o);var a=function(e,t,i,o){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,n=t.chartData.xAxisData,r=n.xAxisPoints,s=n.eachSpacing,l=Oo({},{type:"mount",widthRatio:1,borderWidth:1,barBorderCircle:!1,barBorderRadius:[],linearType:"none",linearOpacity:1,customColor:[],colorStop:0},t.extra.mount);l.widthRatio=l.widthRatio<=0?0:l.widthRatio,l.widthRatio=l.widthRatio>=2?2:l.widthRatio,o.save();let c,h,d,u=-2,p=r.length+2;t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&(o.translate(t._scrollDistance_,0),u=Math.floor(-t._scrollDistance_/s)-2,p=u+t.xAxis.itemCount+4),l.customColor=$o(l.linearType,l.customColor,e,i),c=[].concat(t.chartData.yAxisData.ranges[0]),h=c.pop(),d=c.shift();let g=(t.height-t.area[0]-t.area[2])*(0-h)/(d-h),f=t.height-Math.round(g)-t.area[2];var x=_a(e,h,d,r,s,t,l,f,a);switch(l.type){case"bar":for(let i=0;iu&&if?f:a.y,i=a.width,n=Math.abs(f-a.y);l.barBorderCircle&&(l.barBorderRadius=[i/2,i/2,0,0]),a.y>f&&(l.barBorderRadius=[0,0,i/2,i/2]);let[r,s,c,h]=l.barBorderRadius,d=Math.min(i/2,n/2);r=r>d?d:r,s=s>d?d:s,c=c>d?d:c,h=h>d?d:h,r=r<0?0:r,s=s<0?0:s,c=c<0?0:c,h=h<0?0:h,o.arc(e+r,t+r,r,-Math.PI,-Math.PI/2),o.arc(e+i-s,t+s,s,-Math.PI/2,0),o.arc(e+i-c,t+n-c,c,0,Math.PI/2),o.arc(e+h,t+n-h,h,Math.PI/2,Math.PI)}else o.moveTo(y,a.y),o.lineTo(y+a.width,a.y),o.lineTo(y+a.width,f),o.lineTo(y,f),o.lineTo(y,a.y);o.setStrokeStyle(b),o.setFillStyle(v),l.borderWidth>0&&(o.setLineWidth(l.borderWidth*t.pix),o.closePath(),o.stroke()),o.fill()}}break;case"triangle":for(let i=0;iu&&i0&&(o.setLineWidth(l.borderWidth*t.pix),o.stroke()),o.fill())}break;case"mount":for(let i=0;iu&&i0&&(o.setLineWidth(l.borderWidth*t.pix),o.stroke()),o.fill())}break;case"sharp":for(let i=0;iu&&i0&&(o.setLineWidth(l.borderWidth*t.pix),o.stroke()),o.fill())}}if(!1!==t.dataLabel&&1===a){let n,c,h;n=[].concat(t.chartData.yAxisData.ranges[0]),c=n.pop(),h=n.shift(),Na(x=_a(e,c,h,r,s,t,l,f,a),e,i,o,t,f)}return o.restore(),{xAxisPoints:r,calPoints:x,eachSpacing:s}}(n,t,i,o,e),s=a.xAxisPoints,l=a.calPoints,c=a.eachSpacing;t.chartData.xAxisPoints=s,t.chartData.calPoints=l,t.chartData.eachSpacing=c,Va(0,t,i,o),!1!==t.enableMarkLine&&1===e&&ja(t,0,o),Ya(t.series,t,i,o,t.chartData),Ja(t,i,o,e),cn(0,o)},onAnimationFinish:function(){a.uevent.trigger("renderComplete")}});break;case"bar":this.animationInstance=new dn({timing:t.timing,duration:s,onProcess:function(e){o.clearRect(0,0,t.width,t.height),t.rotate&&Ia(o,t),Ka(r,t,i,o);var a=function(e,t,i,o){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,n=[],r=(t.height-t.area[0]-t.area[2])/t.categories.length;for(let d=0;dc&&ed?d:r,l=l>d?d:l,c=c>d?d:c,h=h>d?d:h,r=r<0?0:r,l=l<0?0:l,c=c<0?0:c,h=h<0?0:h,o.arc(e+h,a+h,h,-Math.PI,-Math.PI/2),o.arc(i.x-r,a+r,r,-Math.PI/2,0),o.arc(i.x-l,a+t-l,l,0,Math.PI/2),o.arc(e+c,a+t-c,c,Math.PI/2,Math.PI)}else o.moveTo(v,b),o.lineTo(i.x,b),o.lineTo(i.x,b+i.width),o.lineTo(v,b+i.width),o.lineTo(v,b),o.setLineWidth(1),o.setStrokeStyle(w);o.setFillStyle(S),o.closePath(),o.fill()}}break;case"stack":y=ka(x,g,f,n,r,t,i,u,e,a),l.push(y),y=va(y,r,e.length,0,0,t);for(let e=0;ec&&e4&&void 0!==arguments[4]?arguments[4]:1,n=Oo({},{type:"straight",opacity:.2,addLine:!1,width:2,gradient:!1,activeType:"none"},t.extra.area);let r=t.chartData.xAxisData,s=r.xAxisPoints,l=r.eachSpacing,c=t.height-t.area[2],h=[];o.save();let d=0,u=t.width+l;return t._scrollDistance_&&0!==t._scrollDistance_&&!0===t.enableScroll&&(o.translate(t._scrollDistance_,0),d=-t._scrollDistance_-2*l+t.area[3],u=d+(t.xAxis.itemCount+4)*l),e.forEach((function(e,r){let p,g,f;p=[].concat(t.chartData.yAxisData.ranges[e.index]),g=p.pop(),f=p.shift();let x=wa(e.data,g,f,s,l,t,i,a);h.push(x);let y=aa(x,e);for(let i=0;i1){let e=a[0],t=a[a.length-1];o.moveTo(e.x,e.y);let i=0;if("curve"===n.type)for(let n=0;nd&&(o.moveTo(e.x,e.y),i=1),n>0&&e.x>d&&e.xd&&(o.moveTo(e.x,e.y),i=1),n>0&&e.x>d&&e.xd&&(o.moveTo(e.x,e.y),i=1),n>0&&e.x>d&&e.xd&&(o.moveTo(i.x,i.y),e=1),t>0&&i.x>d&&i.xd&&(o.moveTo(i.x,i.y),e=1),t>0&&i.x>d&&i.xd&&(o.moveTo(i.x,i.y),e=1),t>0&&i.x>d&&i.x4&&void 0!==arguments[4]?arguments[4]:1,n=Oo({},{type:"area",activeOpacity:.5,activeRadius:10,offsetAngle:0,labelWidth:15,border:!1,borderWidth:2,borderColor:"#FFFFFF",linearType:"none",customColor:[]},t.extra.rose);0==i.pieChartLinePadding&&(i.pieChartLinePadding=n.activeRadius*t.pix);var r={x:t.area[3]+(t.width-t.area[1]-t.area[3])/2,y:t.area[0]+(t.height-t.area[0]-t.area[2])/2},s=Math.min((t.width-t.area[1]-t.area[3])/2-i.pieChartLinePadding-i.pieChartTextPadding-i._pieTextMaxLength_,(t.height-t.area[0]-t.area[2])/2-i.pieChartLinePadding-i.pieChartTextPadding);s=s<10?10:s;var l=n.minRadius||.5*s;s4&&void 0!==arguments[4]?arguments[4]:1,n=Oo({},{gridColor:"#cccccc",gridType:"radar",gridEval:1,axisLabel:!1,axisLabelTofix:0,labelShow:!0,labelColor:"#666666",labelPointShow:!1,labelPointRadius:3,labelPointColor:"#cccccc",opacity:.2,gridCount:3,border:!1,borderWidth:2,linearType:"none",customColor:[]},t.extra.radar),r=Yo(t.categories.length),s={x:t.area[3]+(t.width-t.area[1]-t.area[3])/2,y:t.area[0]+(t.height-t.area[0]-t.area[2])/2},l=(t.width-t.area[1]-t.area[3])/2,c=(t.height-t.area[0]-t.area[2])/2,h=Math.min(l-(Vo(t.categories,i.fontSize,o)+i.radarLabelTextMargin),c-i.radarLabelTextMargin);h=(h-=i.radarLabelTextMargin*t.pix)<10?10:h,h=n.radius?n.radius:h,o.beginPath(),o.setLineWidth(1*t.pix),o.setStrokeStyle(n.gridColor),r.forEach((function(e,t){var i=Wo(h*Math.cos(e),h*Math.sin(e),s);o.moveTo(s.x,s.y),t%n.gridEval==0&&o.lineTo(i.x,i.y)})),o.stroke(),o.closePath();for(var d=function(e){var i={};if(o.beginPath(),o.setLineWidth(1*t.pix),o.setStrokeStyle(n.gridColor),"radar"==n.gridType)r.forEach((function(t,a){var r=Wo(h/n.gridCount*e*Math.cos(t),h/n.gridCount*e*Math.sin(t),s);0===a?(i=r,o.moveTo(r.x,r.y)):o.lineTo(r.x,r.y)})),o.lineTo(i.x,i.y);else{var a=Wo(h/n.gridCount*e*Math.cos(1.5),h/n.gridCount*e*Math.sin(1.5),s);o.arc(s.x,s.y,s.y-a.y,0,2*Math.PI,!1)}o.stroke(),o.closePath()},u=1;u<=n.gridCount;u++)d(u);n.customColor=$o(n.linearType,n.customColor,e,i);var p=sa(r,s,h,e,t,a);if(p.forEach((function(i,a){o.beginPath(),o.setLineWidth(n.borderWidth*t.pix),o.setStrokeStyle(i.color);var r,l=Ro(i.color,n.opacity);"custom"==n.linearType&&((r=o.createCircularGradient?o.createCircularGradient(s.x,s.y,h):o.createRadialGradient(s.x,s.y,0,s.x,s.y,h)).addColorStop(0,Ro(n.customColor[e[a].linearIndex],n.opacity)),r.addColorStop(1,Ro(i.color,n.opacity)),l=r),o.setFillStyle(l),i.data.forEach((function(e,t){0===t?o.moveTo(e.position.x,e.position.y):o.lineTo(e.position.x,e.position.y)})),o.closePath(),o.fill(),!0===n.border&&o.stroke(),o.closePath(),!1!==t.dataPointShape&&Ma(i.data.map((function(e){return e.position})),i.color,i.pointShape,o,t)})),!0===n.axisLabel){const i=Math.max(n.max,Math.max.apply(null,Go(e))),a=h/n.gridCount,r=t.fontSize*t.pix;for(o.setFontSize(r),o.setFillStyle(t.fontColor),o.setTextAlign("left"),u=0;u4&&void 0!==arguments[4]?arguments[4]:1,s=Oo({},{startAngle:.75,endAngle:.25,type:"default",direction:"cw",lineCap:"round",width:12,gap:2,linearType:"none",customColor:[]},t.extra.arcbar);e=da(e,s,r),a=s.centerX||s.centerY?{x:s.centerX?s.centerX:t.width/2,y:s.centerY?s.centerY:t.height/2}:{x:t.width/2,y:t.height/2},s.radius?n=s.radius:(n=Math.min(a.x,a.y),n-=5*t.pix,n-=s.width/2),n=n<10?10:n,s.customColor=$o(s.linearType,s.customColor,e,i);for(let h=0;h5&&void 0!==arguments[5]?arguments[5]:1,r=Oo({},{type:"default",startAngle:.75,endAngle:.25,width:15,labelOffset:13,splitLine:{fixRadius:0,splitNumber:10,width:15,color:"#FFFFFF",childNumber:5,childWidth:5},pointer:{width:15,color:"auto"}},i.extra.gauge);null==r.oldAngle&&(r.oldAngle=r.startAngle),null==r.oldData&&(r.oldData=0),e=pa(e,r.startAngle,r.endAngle);var s={x:i.width/2,y:i.height/2},l=Math.min(s.x,s.y);l-=5*i.pix;var c=(l=(l-=r.width/2)<10?10:l)-r.width,h=0;if("progress"==r.type){var d=l-3*r.width;a.beginPath();let e=a.createLinearGradient(s.x,s.y-d,s.x,s.y+d);e.addColorStop("0",Ro(t[0].color,.3)),e.addColorStop("1.0",Ro("#FFFFFF",.1)),a.setFillStyle(e),a.arc(s.x,s.y,d,0,2*Math.PI,!1),a.fill(),a.setLineWidth(r.width),a.setStrokeStyle(Ro(t[0].color,.3)),a.setLineCap("round"),a.beginPath(),a.arc(s.x,s.y,c,r.startAngle*Math.PI,r.endAngle*Math.PI,!1),a.stroke(),h=r.endAnglen/g?a.setStrokeStyle(Ro(t[0].color,1)):a.setStrokeStyle(Ro(t[0].color,.3)),a.setLineWidth(3*i.pix),a.moveTo(u,0),a.lineTo(p,0),a.stroke(),a.rotate(o*Math.PI);a.restore(),t=ua(t,r,n),a.setLineWidth(r.width),a.setStrokeStyle(t[0].color),a.setLineCap("round"),a.beginPath(),a.arc(s.x,s.y,c,r.startAngle*Math.PI,t[0]._proportion_*Math.PI,!1),a.stroke();let x=l-2.5*r.width;a.save(),a.translate(s.x,s.y),a.rotate((t[0]._proportion_-1)*Math.PI),a.beginPath(),a.setLineWidth(r.width/3);let y=a.createLinearGradient(0,.6*-x,0,.6*x);y.addColorStop("0",Ro("#FFFFFF",0)),y.addColorStop("0.5",Ro(t[0].color,1)),y.addColorStop("1.0",Ro("#FFFFFF",0)),a.setStrokeStyle(y),a.arc(0,0,x,.85*Math.PI,1.15*Math.PI,!1),a.stroke(),a.beginPath(),a.setLineWidth(1),a.setStrokeStyle(t[0].color),a.setFillStyle(t[0].color),a.moveTo(-x-r.width/3/2,-4),a.lineTo(-x-r.width/3/2-4,0),a.lineTo(-x-r.width/3/2,4),a.lineTo(-x-r.width/3/2,-4),a.stroke(),a.fill(),a.restore()}else{a.setLineWidth(r.width),a.setLineCap("butt");for(let t=0;t5&&void 0!==arguments[5]?arguments[5]:1,r=Oo({},{color:{},average:{}},i.extra.candle);r.color=Oo({},{upLine:"#f04864",upFill:"#f04864",downLine:"#2fc25b",downFill:"#2fc25b"},r.color),r.average=Oo({},{show:!1,name:[],day:[],color:o.color},r.average),i.extra.candle=r;let s=i.chartData.xAxisData,l=s.xAxisPoints,c=s.eachSpacing,h=[];a.save();let d=-2,u=l.length+2,p=0,g=i.width+c;return i._scrollDistance_&&0!==i._scrollDistance_&&!0===i.enableScroll&&(a.translate(i._scrollDistance_,0),d=Math.floor(-i._scrollDistance_/c)-2,u=d+i.xAxis.itemCount+4,p=-i._scrollDistance_-2*c+i.area[3],g=p+(i.xAxis.itemCount+4)*c),(r.average.show||t)&&t.forEach((function(e,t){let r,s,h;r=[].concat(i.chartData.yAxisData.ranges[e.index]),s=r.pop(),h=r.shift();var d=aa(wa(e.data,s,h,l,c,i,o,n),e);for(let i=0;ip&&(a.moveTo(o.x,o.y),e=1),i>0&&o.x>p&&o.xd&&o0?(a.setStrokeStyle(r.color.upLine),a.setFillStyle(r.color.upFill),a.setLineWidth(1*i.pix),a.moveTo(e[3].x,e[3].y),a.lineTo(e[1].x,e[1].y),a.lineTo(e[1].x-c/4,e[1].y),a.lineTo(e[0].x-c/4,e[0].y),a.lineTo(e[0].x,e[0].y),a.lineTo(e[2].x,e[2].y),a.lineTo(e[0].x,e[0].y),a.lineTo(e[0].x+c/4,e[0].y),a.lineTo(e[1].x+c/4,e[1].y),a.lineTo(e[1].x,e[1].y),a.moveTo(e[3].x,e[3].y)):(a.setStrokeStyle(r.color.downLine),a.setFillStyle(r.color.downFill),a.setLineWidth(1*i.pix),a.moveTo(e[3].x,e[3].y),a.lineTo(e[0].x,e[0].y),a.lineTo(e[0].x-c/4,e[0].y),a.lineTo(e[1].x-c/4,e[1].y),a.lineTo(e[1].x,e[1].y),a.lineTo(e[2].x,e[2].y),a.lineTo(e[1].x,e[1].y),a.lineTo(e[1].x+c/4,e[1].y),a.lineTo(e[0].x+c/4,e[0].y),a.lineTo(e[0].x,e[0].y),a.moveTo(e[3].x,e[3].y)),a.closePath(),a.fill(),a.stroke()}})),a.restore(),{xAxisPoints:l,calPoints:h,eachSpacing:c}}(n,l,t,i,o,e),s=a.xAxisPoints,c=a.calPoints,h=a.eachSpacing;t.chartData.xAxisPoints=s,t.chartData.calPoints=c,t.chartData.eachSpacing=h,Va(0,t,i,o),!1!==t.enableMarkLine&&1===e&&ja(t,0,o),Ya(l?0:t.series,t,i,o,t.chartData),Ja(t,i,o,e),cn(0,o)},onAnimationFinish:function(){a.uevent.trigger("renderComplete")}})}}function pn(){this.events={}}dn.prototype.stop=function(){this.isStop=!0},pn.prototype.addEventListener=function(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)},pn.prototype.delEventListener=function(e){this.events[e]=[]},pn.prototype.trigger=function(){for(var e=arguments.length,t=Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:{};this.opts=Oo({},this.opts,e),this.opts.updateData=!0;let t=e.scrollPosition||"current";switch(t){case"current":this.opts._scrollDistance_=this.scrollOption.currentOffset;break;case"left":this.opts._scrollDistance_=0,this.scrollOption={currentOffset:0,startTouchX:0,distance:0,lastMoveTime:0};break;case"right":let e=La(this.opts.series,this.opts,this.config,this.context).yAxisWidth;this.config.yAxisWidth=e;let t=0,i=ba(this.opts.categories,this.opts,this.config),o=i.xAxisPoints,a=i.startX;t=i.endX-a-i.eachSpacing*(o.length-1),this.scrollOption={currentOffset:t,startTouchX:t,distance:0,lastMoveTime:0},this.opts._scrollDistance_=t}un.call(this,this.opts.type,this.opts,this.config,this.context)},gn.prototype.zoom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.opts.xAxis.itemCount;if(!0!==this.opts.enableScroll)return void console.log("[uCharts] 请启用滚动条后使用");let t=Math.round(Math.abs(this.scrollOption.currentOffset)/this.opts.chartData.eachSpacing)+Math.round(this.opts.xAxis.itemCount/2);this.opts.animation=!1,this.opts.xAxis.itemCount=e.itemCount;let i=La(this.opts.series,this.opts,this.config,this.context),o=i.yAxisWidth;this.config.yAxisWidth=o;let a=0,n=ba(this.opts.categories,this.opts,this.config),r=n.xAxisPoints,s=n.startX,l=n.endX,c=n.eachSpacing,h=c*t,d=l-s,u=d-c*(r.length-1);a=d/2-h,a>0&&(a=0),a=this.opts.categories.length?this.opts.categories.length:r,this.opts.animation=!1,this.opts.xAxis.itemCount=r;let s=0,l=ba(this.opts.categories,this.opts,this.config),c=l.xAxisPoints,h=l.startX,d=l.endX,u=l.eachSpacing,p=u*this.scrollOption.moveCurrent1,g=d-h-u*(c.length-1);s=-p+Math.min(o[0].x,o[1].x)-this.opts.area[3]-u,s>0&&(s=0),s2*Math.PI&&(e-=2*Math.PI),e},r=Math.atan2(t.center.y-e.y,e.x-t.center.x);(r*=-1)<0&&(r+=2*Math.PI),t.angleList.map((function(e){return n(-1*e)})).forEach((function(e,t){var i=n(e-o/2),s=n(e+o/2);s=i&&r<=s||r+2*Math.PI>=i&&r+2*Math.PI<=s)&&(a=t)}))}return a}({x:i.x,y:i.y},this.opts.chartData.radarData,this.opts.categories.length):"funnel"===this.opts.type?function(e,t){for(var i=-1,o=0,a=t.series.length;on.funnelArea[0]&&e.xn.funnelArea[1]&&e.yn.area[0]&&e.xn.area[1]&&e.y4&&void 0!==arguments[4]?arguments[4]:0,n={index:-1,group:[]},r=i.chartData.eachSpacing/2;let s=i.chartData.yAxisPoints;return t&&t.length>0&&ia(e,i)&&s.forEach((function(t,i){e.y+a+r>t&&(n.index=i)})),n}({x:i.x,y:i.y},this.opts.chartData.calPoints,this.opts,this.config,Math.abs(this.scrollOption.currentOffset)):function(e,t,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n={index:-1,group:[]},r=i.chartData.eachSpacing/2;let s=[];if(t&&t.length>0){if(i.categories){for(let e=1;et&&(n.index=i)}));else{let i=Array(t.length);for(let n=0;nt.start.x&&e.xt.start.y&&e.yi[0]-0&&e.xi[1]-0&&e.y1&&void 0!==arguments[1]?arguments[1]:{},i=null;if(i=e.changedTouches?e.changedTouches[0]:e.mp.changedTouches[0]){Ko(i,this.opts,e);var o=this.getLegendDataIndex(e);o>=0&&("candle"==this.opts.type?this.opts.seriesMA[o].show=!this.opts.seriesMA[o].show:this.opts.series[o].show=!this.opts.series[o].show,this.opts.animation=!!t.animation,this.opts._scrollDistance_=this.scrollOption.currentOffset,un.call(this,this.opts.type,this.opts,this.config,this.context))}},gn.prototype.showToolTip=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null;(i=e.changedTouches?e.changedTouches[0]:e.mp.changedTouches[0])||console.log("[uCharts] 未获取到event坐标信息");var o=Ko(i,this.opts,e),a=this.scrollOption.currentOffset,n=Oo({},this.opts,{_scrollDistance_:a,animation:!1});if("line"===this.opts.type||"area"===this.opts.type||"column"===this.opts.type||"scatter"===this.opts.type||"bubble"===this.opts.type){var r=this.getCurrentDataIndex(e);if((u=null==t.index?r.index:t.index)>-1||u.length>0)if(0!==(l=Xo(this.opts.series,u,r.group)).length){var s=(d=Qo(l,this.opts,u,r.group,this.opts.categories,t)).textList;(c=d.offset).y=o.y,n.tooltip={textList:void 0!==t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u,group:r.group}}un.call(this,n.type,n,this.config,this.context)}if("mount"===this.opts.type){if((u=null==t.index?this.getCurrentDataIndex(e).index:t.index)>-1){n=Oo({},this.opts,{animation:!1});var l=Oo({},n._series_[u]),c=(s=[{text:t.formatter?t.formatter(l,void 0,u,n):l.name+": "+l.data,color:l.color,legendShape:"auto"==this.opts.extra.tooltip.legendShape?l.legendShape:this.opts.extra.tooltip.legendShape}],{x:n.chartData.calPoints[u].x,y:o.y});n.tooltip={textList:t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}un.call(this,n.type,n,this.config,this.context)}if("bar"===this.opts.type){r=this.getCurrentDataIndex(e);if((u=null==t.index?r.index:t.index)>-1||u.length>0)if(0!==(l=Xo(this.opts.series,u,r.group)).length){s=(d=Qo(l,this.opts,u,r.group,this.opts.categories,t)).textList;(c=d.offset).x=o.x,n.tooltip={textList:void 0!==t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}un.call(this,n.type,n,this.config,this.context)}if("mix"===this.opts.type){r=this.getCurrentDataIndex(e);if((u=null==t.index?r.index:t.index)>-1){a=this.scrollOption.currentOffset,n=Oo({},this.opts,{_scrollDistance_:a,animation:!1});if(0!==(l=Xo(this.opts.series,u)).length){var h=Zo(l,this.opts,u,this.opts.categories,t);s=h.textList;(c=h.offset).y=o.y,n.tooltip={textList:t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}}un.call(this,n.type,n,this.config,this.context)}if("candle"===this.opts.type){r=this.getCurrentDataIndex(e);if((u=null==t.index?r.index:t.index)>-1){a=this.scrollOption.currentOffset,n=Oo({},this.opts,{_scrollDistance_:a,animation:!1});if(0!==(l=Xo(this.opts.series,u)).length){var d;s=(d=ea(this.opts.series[0].data,l,this.opts,u,this.opts.categories,this.opts.extra.candle)).textList;(c=d.offset).y=o.y,n.tooltip={textList:t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}}un.call(this,n.type,n,this.config,this.context)}if("pie"===this.opts.type||"ring"===this.opts.type||"rose"===this.opts.type||"funnel"===this.opts.type){if((u=null==t.index?this.getCurrentDataIndex(e):t.index)>-1){n=Oo({},this.opts,{animation:!1}),l=Oo({},n._series_[u]),s=[{text:t.formatter?t.formatter(l,void 0,u,n):l.name+": "+l.data,color:l.color,legendShape:"auto"==this.opts.extra.tooltip.legendShape?l.legendShape:this.opts.extra.tooltip.legendShape}],c={x:o.x,y:o.y};n.tooltip={textList:t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}un.call(this,n.type,n,this.config,this.context)}if("map"===this.opts.type){if((u=null==t.index?this.getCurrentDataIndex(e):t.index)>-1){n=Oo({},this.opts,{animation:!1});(l=Oo({},this.opts.series[u])).name=l.properties.name;s=[{text:t.formatter?t.formatter(l,void 0,u,this.opts):l.name,color:l.color,legendShape:"auto"==this.opts.extra.tooltip.legendShape?l.legendShape:this.opts.extra.tooltip.legendShape}],c={x:o.x,y:o.y};n.tooltip={textList:t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}n.updateData=!1,un.call(this,n.type,n,this.config,this.context)}if("word"===this.opts.type){if((u=null==t.index?this.getCurrentDataIndex(e):t.index)>-1){n=Oo({},this.opts,{animation:!1}),l=Oo({},this.opts.series[u]),s=[{text:t.formatter?t.formatter(l,void 0,u,this.opts):l.name,color:l.color,legendShape:"auto"==this.opts.extra.tooltip.legendShape?l.legendShape:this.opts.extra.tooltip.legendShape}],c={x:o.x,y:o.y};n.tooltip={textList:t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}n.updateData=!1,un.call(this,n.type,n,this.config,this.context)}if("radar"===this.opts.type){var u;if((u=null==t.index?this.getCurrentDataIndex(e):t.index)>-1){n=Oo({},this.opts,{animation:!1});if(0!==(l=Xo(this.opts.series,u)).length){s=l.map((e=>({text:t.formatter?t.formatter(e,this.opts.categories[u],u,this.opts):e.name+": "+e.data,color:e.color,legendShape:"auto"==this.opts.extra.tooltip.legendShape?e.legendShape:this.opts.extra.tooltip.legendShape}))),c={x:o.x,y:o.y};n.tooltip={textList:t.textList?t.textList:s,offset:void 0!==t.offset?t.offset:c,option:t,index:u}}}un.call(this,n.type,n,this.config,this.context)}},gn.prototype.translate=function(e){this.scrollOption={currentOffset:e,startTouchX:e,distance:0,lastMoveTime:0};let t=Oo({},this.opts,{_scrollDistance_:e,animation:!1});un.call(this,this.opts.type,t,this.config,this.context)},gn.prototype.scrollStart=function(e){var t=null,i=Ko(t=e.changedTouches?e.changedTouches[0]:e.mp.changedTouches[0],this.opts,e);t&&!0===this.opts.enableScroll&&(this.scrollOption.startTouchX=i.x)},gn.prototype.scroll=function(e){0===this.scrollOption.lastMoveTime&&(this.scrollOption.lastMoveTime=Date.now());let t=this.opts.touchMoveLimit||60,i=Date.now();if(!(i-this.scrollOption.lastMoveTime{var i=new Date;i.setTime(1e3*e);var o=i.getFullYear(),a=i.getMonth()+1;a=a<10?"0"+a:a;var n=i.getDate();n=n<10?"0"+n:n;var r=i.getHours();r=r<10?"0"+r:r;var s=i.getMinutes(),l=i.getSeconds();return s=s<10?"0"+s:s,l=l<10?"0"+l:l,"full"==t?o+"-"+a+"-"+n+" "+r+":"+s+":"+l:"y-m-d"==t?o+"-"+a+"-"+n:"h:m"==t?r+":"+s:"h:m:s"==t?r+":"+s+":"+l:[o,a,n,r,s,l]})(e,"h:m")},seriesDemo1:function(e,t,i,o){return e+"元"},tooltipDemo1:function(e,t,i,o){return 0==i?"随便用"+e.data+"年":"其他我没改"+e.data+"天"},pieDemo:function(e,t,i,o){if(void 0!==t)return i[t].name+":"+i[t].data+"元"}},demotype:{type:"line",color:fn,padding:[15,10,0,15],xAxis:{disableGrid:!0},yAxis:{gridType:"dash",dashLength:2},legend:{},extra:{line:{type:"curve",width:2}}},pie:{type:"pie",color:fn,padding:[5,5,5,5],extra:{pie:{activeOpacity:.5,activeRadius:10,offsetAngle:0,labelWidth:15,border:!0,borderWidth:3,borderColor:"#FFFFFF"}}},ring:{type:"ring",color:fn,padding:[5,5,5,5],rotate:!1,dataLabel:!0,legend:{show:!0,position:"right",lineHeight:25},title:{name:"收益率",fontSize:15,color:"#666666"},subtitle:{name:"70%",fontSize:25,color:"#7cb5ec"},extra:{ring:{ringWidth:30,activeOpacity:.5,activeRadius:10,offsetAngle:0,labelWidth:15,border:!0,borderWidth:3,borderColor:"#FFFFFF"}}},rose:{type:"rose",color:fn,padding:[5,5,5,5],legend:{show:!0,position:"left",lineHeight:25},extra:{rose:{type:"area",minRadius:50,activeOpacity:.5,activeRadius:10,offsetAngle:0,labelWidth:15,border:!1,borderWidth:2,borderColor:"#FFFFFF"}}},word:{type:"word",color:fn,extra:{word:{type:"normal",autoColors:!1}}},funnel:{type:"funnel",color:fn,padding:[15,15,0,15],extra:{funnel:{activeOpacity:.3,activeWidth:10,border:!0,borderWidth:2,borderColor:"#FFFFFF",fillOpacity:1,labelAlign:"right"}}},map:{type:"map",color:fn,padding:[0,0,0,0],dataLabel:!0,extra:{map:{border:!0,borderWidth:1,borderColor:"#666666",fillOpacity:.6,activeBorderColor:"#F04864",activeFillColor:"#FACC14",activeFillOpacity:1}}},arcbar:{type:"arcbar",color:fn,title:{name:"百分比",fontSize:25,color:"#00FF00"},subtitle:{name:"默认标题",fontSize:15,color:"#666666"},extra:{arcbar:{type:"default",width:12,backgroundColor:"#E9E9E9",startAngle:.75,endAngle:.25,gap:2}}},line:{type:"line",color:fn,padding:[15,10,0,15],xAxis:{disableGrid:!0},yAxis:{gridType:"dash",dashLength:2},legend:{},extra:{line:{type:"straight",width:2,activeType:"hollow"}}},tline:{type:"line",color:fn,padding:[15,10,0,15],xAxis:{disableGrid:!1,boundaryGap:"justify"},yAxis:{gridType:"dash",dashLength:2,data:[{min:0,max:80}]},legend:{},extra:{line:{type:"curve",width:2,activeType:"hollow"}}},tarea:{type:"area",color:fn,padding:[15,10,0,15],xAxis:{disableGrid:!0,boundaryGap:"justify"},yAxis:{gridType:"dash",dashLength:2,data:[{min:0,max:80}]},legend:{},extra:{area:{type:"curve",opacity:.2,addLine:!0,width:2,gradient:!0,activeType:"hollow"}}},column:{type:"column",color:fn,padding:[15,15,0,5],xAxis:{disableGrid:!0},yAxis:{data:[{min:0}]},legend:{},extra:{column:{type:"group",width:30,activeBgColor:"#000000",activeBgOpacity:.08}}},mount:{type:"mount",color:fn,padding:[15,15,0,5],xAxis:{disableGrid:!0},yAxis:{data:[{min:0}]},legend:{},extra:{mount:{type:"mount",widthRatio:1.5}}},bar:{type:"bar",color:fn,padding:[15,30,0,5],xAxis:{boundaryGap:"justify",disableGrid:!1,min:0,axisLine:!1},yAxis:{},legend:{},extra:{bar:{type:"group",width:30,meterBorde:1,meterFillColor:"#FFFFFF",activeBgColor:"#000000",activeBgOpacity:.08}}},area:{type:"area",color:fn,padding:[15,15,0,15],xAxis:{disableGrid:!0},yAxis:{gridType:"dash",dashLength:2},legend:{},extra:{area:{type:"straight",opacity:.2,addLine:!0,width:2,gradient:!1,activeType:"hollow"}}},radar:{type:"radar",color:fn,padding:[5,5,5,5],dataLabel:!1,legend:{show:!0,position:"right",lineHeight:25},extra:{radar:{gridType:"radar",gridColor:"#CCCCCC",gridCount:3,opacity:.2,max:200,labelShow:!0}}},gauge:{type:"gauge",color:fn,title:{name:"66Km/H",fontSize:25,color:"#2fc25b",offsetY:50},subtitle:{name:"实时速度",fontSize:15,color:"#1890ff",offsetY:-50},extra:{gauge:{type:"default",width:30,labelColor:"#666666",startAngle:.75,endAngle:.25,startNumber:0,endNumber:100,labelFormat:"",splitLine:{fixRadius:0,splitNumber:10,width:30,color:"#FFFFFF",childNumber:5,childWidth:12},pointer:{width:24,color:"auto"}}}},candle:{type:"candle",color:fn,padding:[15,15,0,15],enableScroll:!0,enableMarkLine:!0,dataLabel:!1,xAxis:{labelCount:4,itemCount:40,disableGrid:!0,gridColor:"#CCCCCC",gridType:"solid",dashLength:4,scrollShow:!0,scrollAlign:"left",scrollColor:"#A6A6A6",scrollBackgroundColor:"#EFEBEF"},yAxis:{},legend:{},extra:{candle:{color:{upLine:"#f04864",upFill:"#f04864",downLine:"#2fc25b",downFill:"#2fc25b"},average:{show:!0,name:["MA5","MA10","MA30"],day:[5,10,20],color:["#1890ff","#2fc25b","#facc14"]}},markLine:{type:"dash",dashLength:5,data:[{value:2150,lineColor:"#f04864",showLabel:!0},{value:2350,lineColor:"#f04864",showLabel:!0}]}}},mix:{type:"mix",color:fn,padding:[15,15,0,15],xAxis:{disableGrid:!0},yAxis:{disabled:!1,disableGrid:!1,splitNumber:5,gridType:"dash",dashLength:4,gridColor:"#CCCCCC",padding:10,showTitle:!0,data:[]},legend:{},extra:{mix:{column:{width:20}}}},scatter:{type:"scatter",color:fn,padding:[15,15,0,15],dataLabel:!1,xAxis:{disableGrid:!1,gridType:"dash",splitNumber:5,boundaryGap:"justify",min:0},yAxis:{disableGrid:!1,gridType:"dash"},legend:{},extra:{scatter:{}}},bubble:{type:"bubble",color:fn,padding:[15,15,0,15],xAxis:{disableGrid:!1,gridType:"dash",splitNumber:5,boundaryGap:"justify",min:0,max:250},yAxis:{disableGrid:!1,gridType:"dash",data:[{min:0,max:150}]},legend:{},extra:{bubble:{border:2,opacity:.5}}}},yn=["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],mn={type:["pie","ring","rose","funnel","line","column","area","radar","gauge","candle","demotype"],categories:["line","column","area","radar","gauge","candle","demotype"],instance:{},option:{},formatter:{tooltipDemo1:function(e){let t="";for(let i in e){0==i&&(t+=e[i].axisValueLabel+"年销售额");let o="--";null!==e[i].data&&(o=e[i].data),t+="\n"+e[i].seriesName+":"+o+" 万元"}return t},legendFormat:function(e){return"自定义图例+"+e},yAxisFormatDemo:function(e,t){return e+"元"},seriesFormatDemo:function(e){return e.name+"年"+e.value+"元"}},demotype:{color:yn},column:{color:yn,title:{text:""},tooltip:{trigger:"axis"},grid:{top:30,bottom:50,right:15,left:40},legend:{bottom:"left"},toolbox:{show:!1},xAxis:{type:"category",axisLabel:{color:"#666666"},axisLine:{lineStyle:{color:"#CCCCCC"}},boundaryGap:!0,data:[]},yAxis:{type:"value",axisTick:{show:!1},axisLabel:{color:"#666666"},axisLine:{lineStyle:{color:"#CCCCCC"}}},seriesTemplate:{name:"",type:"bar",data:[],barwidth:20,label:{show:!0,color:"#666666",position:"top"}}},line:{color:yn,title:{text:""},tooltip:{trigger:"axis"},grid:{top:30,bottom:50,right:15,left:40},legend:{bottom:"left"},toolbox:{show:!1},xAxis:{type:"category",axisLabel:{color:"#666666"},axisLine:{lineStyle:{color:"#CCCCCC"}},boundaryGap:!0,data:[]},yAxis:{type:"value",axisTick:{show:!1},axisLabel:{color:"#666666"},axisLine:{lineStyle:{color:"#CCCCCC"}}},seriesTemplate:{name:"",type:"line",data:[],barwidth:20,label:{show:!0,color:"#666666",position:"top"}}},area:{color:yn,title:{text:""},tooltip:{trigger:"axis"},grid:{top:30,bottom:50,right:15,left:40},legend:{bottom:"left"},toolbox:{show:!1},xAxis:{type:"category",axisLabel:{color:"#666666"},axisLine:{lineStyle:{color:"#CCCCCC"}},boundaryGap:!0,data:[]},yAxis:{type:"value",axisTick:{show:!1},axisLabel:{color:"#666666"},axisLine:{lineStyle:{color:"#CCCCCC"}}},seriesTemplate:{name:"",type:"line",data:[],areaStyle:{},label:{show:!0,color:"#666666",position:"top"}}},pie:{color:yn,title:{text:""},tooltip:{trigger:"item"},grid:{top:40,bottom:30,right:15,left:15},legend:{bottom:"left"},seriesTemplate:{name:"",type:"pie",data:[],radius:"50%",label:{show:!0,color:"#666666",position:"top"}}},ring:{color:yn,title:{text:""},tooltip:{trigger:"item"},grid:{top:40,bottom:30,right:15,left:15},legend:{bottom:"left"},seriesTemplate:{name:"",type:"pie",data:[],radius:["40%","70%"],avoidLabelOverlap:!1,label:{show:!0,color:"#666666",position:"top"},labelLine:{show:!0}}},rose:{color:yn,title:{text:""},tooltip:{trigger:"item"},legend:{top:"bottom"},seriesTemplate:{name:"",type:"pie",data:[],radius:"55%",center:["50%","50%"],roseType:"area"}},funnel:{color:yn,title:{text:""},tooltip:{trigger:"item",formatter:"{b} : {c}%"},legend:{top:"bottom"},seriesTemplate:{name:"",type:"funnel",left:"10%",top:60,bottom:60,width:"80%",min:0,max:100,minSize:"0%",maxSize:"100%",sort:"descending",gap:2,label:{show:!0,position:"inside"},labelLine:{length:10,lineStyle:{width:1,type:"solid"}},itemStyle:{bordercolor:"#fff",borderwidth:1},emphasis:{label:{fontSize:20}},data:[]}},gauge:{color:yn,tooltip:{formatter:"{a}
{b} : {c}%"},seriesTemplate:{name:"业务指标",type:"gauge",detail:{formatter:"{value}%"},data:[{value:50,name:"完成率"}]}},candle:{xAxis:{data:[]},yAxis:{},color:yn,title:{text:""},dataZoom:[{type:"inside",xAxisIndex:[0,1],start:10,end:100},{show:!0,xAxisIndex:[0,1],type:"slider",bottom:10,start:10,end:100}],seriesTemplate:{name:"",type:"k",data:[]}}};var vn={},bn=null;function Sn(e={},...t){for(let i in t)for(let o in t[i])t[i].hasOwnProperty(o)&&(e[o]=t[i][o]&&"object"==typeof t[i][o]?Sn(Array.isArray(t[i][o])?[]:{},e[o],t[i][o]):t[i][o]);return e}function wn(e,t){for(let i in e)e.hasOwnProperty(i)&&null!==e[i]&&"object"==typeof e[i]?wn(e[i],t):"format"===i&&"string"==typeof e[i]&&(e.formatter=t[e[i]]?t[e[i]]:void 0);return e}const Tn={data:()=>({rid:null}),mounted(){bn={top:0,left:0};let e=document.querySelectorAll("uni-main")[0];void 0===e&&(e=document.querySelectorAll("uni-page-wrapper")[0]),bn={top:e.offsetTop,left:e.offsetLeft},setTimeout((()=>{null===this.rid&&this.$ownerInstance&&this.$ownerInstance.callMethod("getRenderType")}),200)},destroyed(){delete xn.option[this.rid],delete xn.instance[this.rid],delete mn.option[this.rid],delete mn.instance[this.rid]},methods:{ecinit(e,t,i,o){let a=JSON.stringify(e.id);this.rid=a,vn[a]=this.$ownerInstance||o;let n=JSON.parse(JSON.stringify(e)),r=n.type;r&&mn.type.includes(r)?mn.option[a]=Sn({},mn[r],n):mn.option[a]=Sn({},n);let s=n.chartData;if(s){mn.option[a].xAxis&&mn.option[a].xAxis.type&&"category"===mn.option[a].xAxis.type&&(mn.option[a].xAxis.data=s.categories),mn.option[a].yAxis&&mn.option[a].yAxis.type&&"category"===mn.option[a].yAxis.type&&(mn.option[a].yAxis.data=s.categories),mn.option[a].series=[];for(var l=0;l{let i=JSON.parse(JSON.stringify({x:t.event.offsetX,y:t.event.offsetY}));vn[e].callMethod("emitMsg",{name:"getIndex",params:{type:"getIndex",event:i,currentIndex:t.dataIndex,value:t.data,seriesName:t.seriesName,id:e}})})),mn.instance[e].on("highlight",(t=>{vn[e].callMethod("emitMsg",{name:"getHighlight",params:{type:"highlight",res:t,id:e}})}))),this.updataEChart(e,mn.option[e])):this.updataEChart(e,mn.option[e])},updataEChart(e,t){if((t=wn(t,mn.formatter)).tooltip&&(t.tooltip.show=!!t.tooltipShow,t.tooltip.position=this.tooltipPosition(),"string"==typeof t.tooltipFormat&&mn.formatter[t.tooltipFormat]&&(t.tooltip.formatter=t.tooltip.formatter?t.tooltip.formatter:mn.formatter[t.tooltipFormat])),t.series)for(let i in t.series){let e=t.series[i].linearGradient;e&&(t.series[i].color=new echarts.graphic.LinearGradient(e[0],e[1],e[2],e[3],e[4]))}mn.instance[e].setOption(t,t.notMerge),mn.instance[e].on("finished",(function(){vn[e].callMethod("emitMsg",{name:"complete",params:{type:"complete",complete:!0,id:e}}),mn.instance[e]&&mn.instance[e].off("finished")})),void 0!==vn[e].$el.children[0].clientWidth&&(Math.abs(vn[e].$el.children[0].clientWidth-mn.instance[e].getWidth())>3||Math.abs(vn[e].$el.children[0].clientHeight-mn.instance[e].getHeight())>3)&&this.ecresize()},tooltipPosition:()=>(e,t,i,o,a)=>{let n=e[0],r=e[1],s=a.viewSize[0],l=a.viewSize[1],c=a.contentSize[0],h=a.contentSize[1],d=n+30,u=r+30;return d+c>s&&(d=n-c-30),u+h>l&&(u=r-h-30),[d,u]},ucinit(e,t,i,o){if(JSON.stringify(e)==JSON.stringify(t))return;if(!e.canvasId)return;let a=JSON.parse(JSON.stringify(e.canvasId));this.rid=a,vn[a]=this.$ownerInstance||o,xn.option[a]=JSON.parse(JSON.stringify(e)),xn.option[a]=wn(xn.option[a],xn.formatter);let n=document.getElementById(a);n&&n.children[0]&&(xn.option[a].context=n.children[0].getContext("2d"),xn.instance[a]&&xn.option[a]&&!0===xn.option[a].update?this.updataUChart():setTimeout((()=>{xn.option[a].context.restore(),xn.option[a].context.save(),this.newUChart()}),100))},newUChart(){let e=this.rid;xn.instance[e]=new gn(xn.option[e]),xn.instance[e].addEventListener("renderComplete",(()=>{vn[e].callMethod("emitMsg",{name:"complete",params:{type:"complete",complete:!0,id:e,opts:xn.instance[e].opts}}),xn.instance[e].delEventListener("renderComplete")})),xn.instance[e].addEventListener("scrollLeft",(()=>{vn[e].callMethod("emitMsg",{name:"scrollLeft",params:{type:"scrollLeft",scrollLeft:!0,id:e,opts:xn.instance[e].opts}})})),xn.instance[e].addEventListener("scrollRight",(()=>{vn[e].callMethod("emitMsg",{name:"scrollRight",params:{type:"scrollRight",scrollRight:!0,id:e,opts:xn.instance[e].opts}})}))},updataUChart(){let e=this.rid;xn.instance[e].updateData(xn.option[e])},tooltipDefault(e,t,i,o){if(t){let i=e.data;return"object"==typeof e.data&&(i=e.data.value),t+" "+e.name+":"+i}return e.properties&&e.properties.name?e.properties.name:e.name+":"+e.data},showTooltip(e,t){let i=xn.option[t].tooltipCustom;if(i&&null!=i){let o;i.x>=0&&i.y>=0&&(o={x:i.x,y:i.y+10}),xn.instance[t].showToolTip(e,{index:i.index,offset:o,textList:i.textList,formatter:(e,i,o,a)=>"string"==typeof xn.option[t].tooltipFormat&&xn.formatter[xn.option[t].tooltipFormat]?xn.formatter[xn.option[t].tooltipFormat](e,i,o,a):this.tooltipDefault(e,i,o,a)})}else xn.instance[t].showToolTip(e,{formatter:(e,i,o,a)=>"string"==typeof xn.option[t].tooltipFormat&&xn.formatter[xn.option[t].tooltipFormat]?xn.formatter[xn.option[t].tooltipFormat](e,i,o,a):this.tooltipDefault(e,i,o,a)})},tap(e){let t=this.rid,i=xn.option[t].ontap,o=xn.option[t].tooltipShow,a=xn.option[t].tapLegend;if(0==i)return;let n=null,r=null,s=document.getElementById("UC"+t).getBoundingClientRect(),l={};l=e.detail.x?{x:e.detail.x-s.left,y:e.detail.y-s.top+bn.top}:{x:e.clientX-s.left,y:e.clientY-s.top+bn.top},e.changedTouches=[],e.changedTouches.unshift(l),n=xn.instance[t].getCurrentDataIndex(e),r=xn.instance[t].getLegendDataIndex(e),!0===a&&xn.instance[t].touchLegend(e),1==o&&this.showTooltip(e,t),vn[t].callMethod("emitMsg",{name:"getIndex",params:{type:"getIndex",event:l,currentIndex:n,legendIndex:r,id:t,opts:xn.instance[t].opts}})},touchStart(e){let t=this.rid;0!=xn.option[t].ontouch&&(!0===xn.option[t].enableScroll&&1==e.touches.length&&xn.instance[t].scrollStart(e),vn[t].callMethod("emitMsg",{name:"getTouchStart",params:{type:"touchStart",event:e.changedTouches[0],id:t,opts:xn.instance[t].opts}}))},touchMove(e){let t=this.rid,i=xn.option[t].ontouch;if(0!=i){if(!0===xn.option[t].enableScroll&&1==e.changedTouches.length&&xn.instance[t].scroll(e),!0===xn.option[t].ontap&&!1===xn.option[t].enableScroll&&!0===xn.option[t].onmovetip){let i=document.getElementById("UC"+t).getBoundingClientRect(),o={x:e.changedTouches[0].clientX-i.left,y:e.changedTouches[0].clientY-i.top+bn.top};e.changedTouches.unshift(o),!0===xn.option[t].tooltipShow&&this.showTooltip(e,t)}!0===i&&!0===xn.option[t].enableScroll&&!0===xn.option[t].onzoom&&2==e.changedTouches.length&&xn.instance[t].dobuleZoom(e),vn[t].callMethod("emitMsg",{name:"getTouchMove",params:{type:"touchMove",event:e.changedTouches[0],id:t,opts:xn.instance[t].opts}})}},touchEnd(e){let t=this.rid;0!=xn.option[t].ontouch&&(!0===xn.option[t].enableScroll&&0==e.touches.length&&xn.instance[t].scrollEnd(e),vn[t].callMethod("emitMsg",{name:"getTouchEnd",params:{type:"touchEnd",event:e.changedTouches[0],id:t,opts:xn.instance[t].opts}}))},mouseDown(e){let t=this.rid;if(0==xn.option[t].onmouse)return;let i=document.getElementById("UC"+t).getBoundingClientRect(),o={};o={x:e.clientX-i.left,y:e.clientY-i.top+bn.top},e.changedTouches=[],e.changedTouches.unshift(o),xn.instance[t].scrollStart(e),xn.option[t].mousedown=!0,vn[t].callMethod("emitMsg",{name:"getTouchStart",params:{type:"mouseDown",event:o,id:t,opts:xn.instance[t].opts}})},mouseMove(e){let t=this.rid,i=xn.option[t].onmouse,o=xn.option[t].tooltipShow;if(0==i)return;let a=document.getElementById("UC"+t).getBoundingClientRect(),n={};n={x:e.clientX-a.left,y:e.clientY-a.top+bn.top},e.changedTouches=[],e.changedTouches.unshift(n),xn.option[t].mousedown?(xn.instance[t].scroll(e),vn[t].callMethod("emitMsg",{name:"getTouchMove",params:{type:"mouseMove",event:n,id:t,opts:xn.instance[t].opts}})):xn.instance[t]&&1==o&&this.showTooltip(e,t)},mouseUp(e){let t=this.rid;if(0==xn.option[t].onmouse)return;let i=document.getElementById("UC"+t).getBoundingClientRect(),o={};o={x:e.clientX-i.left,y:e.clientY-i.top+bn.top},e.changedTouches=[],e.changedTouches.unshift(o),xn.instance[t].scrollEnd(e),xn.option[t].mousedown=!1,vn[t].callMethod("emitMsg",{name:"getTouchEnd",params:{type:"mouseUp",event:o,id:t,opts:xn.instance[t].opts}})}}},An=e=>{e.$renderjs||(e.$renderjs=[]),e.$renderjs.push("rdcharts"),e.mixins||(e.mixins=[]),e.mixins.push({beforeCreate(){this.rdcharts=this},mounted(){this.$ownerInstance=this.$gcd(this,!0)}}),e.mixins.push(Tn)};function _n(e={},...t){for(let i in t)for(let o in t[i])t[i].hasOwnProperty(o)&&(e[o]=t[i][o]&&"object"==typeof t[i][o]?_n(Array.isArray(t[i][o])?[]:{},e[o],t[i][o]):t[i][o]);return e}function Pn(e,t){for(let i in e)e.hasOwnProperty(i)&&null!==e[i]&&"object"==typeof e[i]?Pn(e[i],t):"format"===i&&"string"==typeof e[i]&&(e.formatter=t[e[i]]?t[e[i]]:void 0);return e}const Cn={name:"qiun-data-charts",mixins:[Lo.mixinDatacom],props:{type:{type:String,default:null},canvasId:{type:String,default:"uchartsid"},canvas2d:{type:Boolean,default:!1},background:{type:String,default:"rgba(0,0,0,0)"},animation:{type:Boolean,default:!0},chartData:{type:Object,default:()=>({categories:[],series:[]})},opts:{type:Object,default:()=>({})},eopts:{type:Object,default:()=>({})},loadingType:{type:Number,default:2},errorShow:{type:Boolean,default:!0},errorReload:{type:Boolean,default:!0},errorMessage:{type:String,default:null},inScrollView:{type:Boolean,default:!1},reshow:{type:Boolean,default:!1},reload:{type:Boolean,default:!1},disableScroll:{type:Boolean,default:!1},optsWatch:{type:Boolean,default:!0},onzoom:{type:Boolean,default:!1},ontap:{type:Boolean,default:!0},ontouch:{type:Boolean,default:!1},onmouse:{type:Boolean,default:!0},onmovetip:{type:Boolean,default:!1},echartsH5:{type:Boolean,default:!1},echartsApp:{type:Boolean,default:!1},tooltipShow:{type:Boolean,default:!0},tooltipFormat:{type:String,default:void 0},tooltipCustom:{type:Object,default:void 0},startDate:{type:String,default:void 0},endDate:{type:String,default:void 0},textEnum:{type:Array,default:()=>[]},groupEnum:{type:Array,default:()=>[]},pageScrollTop:{type:Number,default:0},directory:{type:String,default:"/"},tapLegend:{type:Boolean,default:!0},menus:{type:Array,default:()=>[]}},data:()=>({cid:"uchartsid",inWx:!1,inAli:!1,inTt:!1,inBd:!1,inH5:!1,inApp:!1,inWin:!1,type2d:!0,disScroll:!1,openmouse:!1,pixel:1,cWidth:375,cHeight:250,showchart:!1,echarts:!1,echartsResize:{state:!1},uchartsOpts:{},echartsOpts:{},drawData:{},lastDrawTime:null}),created(){if(this.cid=this.canvasId,"uchartsid"==this.canvasId||""==this.canvasId){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",t=e.length,i="";for(let o=0;o<32;o++)i+=e.charAt(Math.floor(Math.random()*t));this.cid=i}const e=m();"windows"!==e.platform&&"mac"!==e.platform||(this.inWin=!0),this.type2d=!1,this.disScroll=this.disableScroll},mounted(){this.inH5=!0,!0===this.inWin&&(this.openmouse=this.onmouse),!0===this.echartsH5&&(this.echarts=!0),this.$nextTick((()=>{this.beforeInit()}));const e=this.inH5?500:200,t=this;R(function(e,t){let i=!1;return function(){clearTimeout(i),i&&clearTimeout(i),i=setTimeout((()=>{i=!1,e.apply(this,arguments)}),t)}}((function(e){if(1==t.mixinDatacomLoading)return;let i=t.mixinDatacomErrorMessage;null!==i&&"null"!==i&&""!==i||(t.echarts?t.echartsResize.state=!t.echartsResize.state:t.resizeHandler())}),e))},destroyed(){!0===this.echarts?(delete mn.option[this.cid],delete mn.instance[this.cid]):(delete xn.option[this.cid],delete xn.instance[this.cid]),N((()=>{}))},watch:{chartDataProps:{handler(e,t){"object"==typeof e?JSON.stringify(e)!==JSON.stringify(t)&&(this._clearChart(),e.series&&e.series.length>0?this.beforeInit():(this.mixinDatacomLoading=!0,this.showchart=!1,this.mixinDatacomErrorMessage=null)):(this.mixinDatacomLoading=!1,this._clearChart(),this.showchart=!1,this.mixinDatacomErrorMessage="参数错误:chartData数据类型错误")},immediate:!1,deep:!0},localdata:{handler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&(e.length>0?this.beforeInit():(this.mixinDatacomLoading=!0,this._clearChart(),this.showchart=!1,this.mixinDatacomErrorMessage=null))},immediate:!1,deep:!0},optsProps:{handler(e,t){"object"==typeof e?JSON.stringify(e)!==JSON.stringify(t)&&!1===this.echarts&&1==this.optsWatch&&this.checkData(this.drawData):(this.mixinDatacomLoading=!1,this._clearChart(),this.showchart=!1,this.mixinDatacomErrorMessage="参数错误:opts数据类型错误")},immediate:!1,deep:!0},eoptsProps:{handler(e,t){"object"==typeof e?JSON.stringify(e)!==JSON.stringify(t)&&!0===this.echarts&&this.checkData(this.drawData):(this.mixinDatacomLoading=!1,this.showchart=!1,this.mixinDatacomErrorMessage="参数错误:eopts数据类型错误")},immediate:!1,deep:!0},reshow(e,t){!0===e&&!1===this.mixinDatacomLoading&&setTimeout((()=>{this.mixinDatacomErrorMessage=null,this.echartsResize.state=!this.echartsResize.state,this.checkData(this.drawData)}),200)},reload(e,t){!0===e&&(this.showchart=!1,this.mixinDatacomErrorMessage=null,this.reloading())},mixinDatacomErrorMessage(e,t){e&&(this.emitMsg({name:"error",params:{type:"error",errorShow:this.errorShow,msg:e,id:this.cid}}),this.errorShow&&console.log("[秋云图表组件]"+e))},errorMessage(e,t){e&&this.errorShow&&null!==e&&"null"!==e&&""!==e?(this.showchart=!1,this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e):(this.showchart=!1,this.mixinDatacomErrorMessage=null,this.reloading())}},computed:{optsProps(){return JSON.parse(JSON.stringify(this.opts))},eoptsProps(){return JSON.parse(JSON.stringify(this.eopts))},chartDataProps(){return JSON.parse(JSON.stringify(this.chartData))}},methods:{beforeInit(){this.mixinDatacomErrorMessage=null,"object"==typeof this.chartData&&null!=this.chartData&&void 0!==this.chartData.series&&this.chartData.series.length>0?(this.drawData=_n({},this.chartData),this.mixinDatacomLoading=!1,this.showchart=!0,this.checkData(this.chartData)):this.localdata.length>0?(this.mixinDatacomLoading=!1,this.showchart=!0,this.localdataInit(this.localdata)):""!==this.collection?(this.mixinDatacomLoading=!1,this.getCloudData()):this.mixinDatacomLoading=!0},localdataInit(e){if(this.groupEnum.length>0)for(let h=0;h0)for(let h=0;h0)o=this.chartData.categories;else if(this.startDate&&this.endDate){let e=new Date(this.startDate),t=new Date(this.endDate);for(;e<=t;)o.push((r=void 0,s=void 0,l=void 0,r=(n=e).getFullYear(),s=n.getMonth()+1,l=n.getDate(),s>=1&&s<=9&&(s="0"+s),l>=0&&l<=9&&(l="0"+l),r+"-"+s+"-"+l)),e=e.setDate(e.getDate()+1),e=new Date(e)}else{let t={};e.map((function(e,i){null==e.text||t[e.text]||(o.push(e.text),t[e.text]=!0)}))}i.categories=o}var n,r,s,l;let c={};if(e.map((function(e,t){null==e.group||c[e.group]||(a.push({name:e.group,data:[]}),c[e.group]=!0)})),0==a.length)if(a=[{name:"默认分组",data:[]}],!0===t)for(let h=0;h0)for(let t=0;t0&&(this.mixinDatacomErrorMessage=null,!0===this.echarts?(mn.option[t].chartData=i,this.$nextTick((()=>{this.init()}))):(xn.option[t].categories=i.categories,xn.option[t].series=i.series,this.$nextTick((()=>{this.init()}))))},resizeHandler(){let e=Date.now();e-(this.lastDrawTime?this.lastDrawTime:e-3e3)<1e3||z().in(this).select("#ChartBoxId"+this.cid).boundingClientRect((e=>{this.showchart=!0,e.width>0&&e.height>0&&(e.width===this.cWidth&&e.height===this.cHeight||this.checkData(this.drawData))})).exec()},getCloudData(){1!=this.mixinDatacomLoading&&(this.mixinDatacomLoading=!0,this.mixinDatacomGet().then((e=>{this.mixinDatacomResData=e.result.data,this.localdataInit(this.mixinDatacomResData)})).catch((e=>{this.mixinDatacomLoading=!1,this.showchart=!1,this.mixinDatacomErrorMessage="请求错误:"+e})))},onMixinDatacomPropsChange(e,t){1==e&&""!==this.collection&&(this.showchart=!1,this.mixinDatacomErrorMessage=null,this._clearChart(),this.getCloudData())},_clearChart(){let e=this.cid;if(!0!==this.echarts&&xn.option[e]&&xn.option[e].context){const t=xn.option[e].context;"object"!=typeof t||xn.option[e].update||(t.clearRect(0,0,this.cWidth*this.pixel,this.cHeight*this.pixel),t.draw())}},init(){let e=this.cid;z().in(this).select("#ChartBoxId"+e).boundingClientRect((t=>{t.width>0&&t.height>0?(this.mixinDatacomLoading=!1,this.showchart=!0,this.lastDrawTime=Date.now(),this.cWidth=t.width,this.cHeight=t.height,!0!==this.echarts&&(xn.option[e].background="rgba(0,0,0,0)"==this.background?"#FFFFFF":this.background,xn.option[e].canvas2d=this.type2d,xn.option[e].pixelRatio=this.pixel,xn.option[e].animation=this.animation,xn.option[e].width=t.width*this.pixel,xn.option[e].height=t.height*this.pixel,xn.option[e].onzoom=this.onzoom,xn.option[e].ontap=this.ontap,xn.option[e].ontouch=this.ontouch,xn.option[e].onmouse=this.openmouse,xn.option[e].onmovetip=this.onmovetip,xn.option[e].tooltipShow=this.tooltipShow,xn.option[e].tooltipFormat=this.tooltipFormat,xn.option[e].tooltipCustom=this.tooltipCustom,xn.option[e].inScrollView=this.inScrollView,xn.option[e].lastDrawTime=this.lastDrawTime,xn.option[e].tapLegend=this.tapLegend),this.inH5||this.inApp?1==this.echarts?(mn.option[e].ontap=this.ontap,mn.option[e].onmouse=this.openmouse,mn.option[e].tooltipShow=this.tooltipShow,mn.option[e].tooltipFormat=this.tooltipFormat,mn.option[e].tooltipCustom=this.tooltipCustom,mn.option[e].lastDrawTime=this.lastDrawTime,this.echartsOpts=_n({},mn.option[e])):(xn.option[e].rotateLock=xn.option[e].rotate,this.uchartsOpts=_n({},xn.option[e])):(xn.option[e]=Pn(xn.option[e],xn.formatter),this.mixinDatacomErrorMessage=null,this.mixinDatacomLoading=!1,this.showchart=!0,this.$nextTick((()=>{if(!0===this.type2d){z().in(this).select("#"+e).fields({node:!0,size:!0}).exec((i=>{if(i[0]){const o=i[0].node,a=o.getContext("2d");xn.option[e].context=a,xn.option[e].rotateLock=xn.option[e].rotate,xn.instance[e]&&xn.option[e]&&!0===xn.option[e].update?this._updataUChart(e):(o.width=t.width*this.pixel,o.height=t.height*this.pixel,o._width=t.width*this.pixel,o._height=t.height*this.pixel,setTimeout((()=>{xn.option[e].context.restore(),xn.option[e].context.save(),this._newChart(e)}),100))}else this.showchart=!1,this.mixinDatacomErrorMessage="参数错误:开启2d模式后,未获取到dom节点,canvas-id:"+e}))}else this.inAli&&(xn.option[e].rotateLock=xn.option[e].rotate),xn.option[e].context=B(e,this),xn.instance[e]&&xn.option[e]&&!0===xn.option[e].update?this._updataUChart(e):setTimeout((()=>{xn.option[e].context.restore(),xn.option[e].context.save(),this._newChart(e)}),100)})))):(this.mixinDatacomLoading=!1,this.showchart=!1,1==this.reshow&&(this.mixinDatacomErrorMessage="布局错误:未获取到父元素宽高尺寸!canvas-id:"+e))})).exec()},saveImage(){U({canvasId:this.cid,success:e=>{var t=document.createElement("a");t.href=e.tempFilePath,t.download=this.cid,t.target="_blank",t.click()}},this)},getImage(){if(0==this.type2d)U({canvasId:this.cid,success:e=>{this.emitMsg({name:"getImage",params:{type:"getImage",base64:e.tempFilePath}})}},this);else{z().in(this).select("#"+this.cid).fields({node:!0,size:!0}).exec((e=>{if(e[0]){const t=e[0].node;this.emitMsg({name:"getImage",params:{type:"getImage",base64:t.toDataURL("image/png")}})}}))}},_error(e){this.mixinDatacomErrorMessage=e.detail.errMsg},emitMsg(e){this.$emit(e.name,e.params)},getRenderType(){!0===this.echarts&&!1===this.mixinDatacomLoading&&this.beforeInit()},toJSON(){return this}}};An(Cn);const kn=G(Cn,[["render",function(e,t,i,o,a,n){const r=J(W("qiun-loading"),Io),s=I,l=J(W("qiun-error"),Mo),c=H;return C(),k(s,{class:"chartsview",id:"ChartBoxId"+a.cid},{default:D((()=>[e.mixinDatacomLoading?(C(),k(s,{key:0},{default:D((()=>[L(r,{loadingType:i.loadingType},null,8,["loadingType"])])),_:1})):F("",!0),e.mixinDatacomErrorMessage&&i.errorShow?(C(),k(s,{key:1,onClick:n.reloading},{default:D((()=>[L(l,{errorMessage:i.errorMessage},null,8,["errorMessage"])])),_:1},8,["onClick"])):F("",!0),a.echarts?j((C(),k(s,{key:2,style:q([{background:i.background},{width:"100%",height:"100%"}]),"data-directory":i.directory,id:"EC"+a.cid,prop:a.echartsOpts,"change:prop":e.rdcharts.ecinit,resize:a.echartsResize,"change:resize":e.rdcharts.ecresize},null,8,["style","data-directory","id","prop","change:prop","resize","change:resize"])),[[$,a.showchart]]):(C(),k(s,{key:3,onClick:e.rdcharts.tap,onMousemove:e.rdcharts.mouseMove,onMousedown:e.rdcharts.mouseDown,onMouseup:e.rdcharts.mouseUp,onTouchstart:e.rdcharts.touchStart,onTouchmove:e.rdcharts.touchMove,onTouchend:e.rdcharts.touchEnd,id:"UC"+a.cid,prop:a.uchartsOpts,"change:prop":e.rdcharts.ucinit},{default:D((()=>[j(L(c,{id:a.cid,canvasId:a.cid,style:q({width:a.cWidth+"px",height:a.cHeight+"px",background:i.background}),"disable-scroll":i.disableScroll,onError:n._error},null,8,["id","canvasId","style","disable-scroll","onError"]),[[$,a.showchart]])])),_:1},8,["onClick","onMousemove","onMousedown","onMouseup","onTouchstart","onTouchmove","onTouchend","id","prop","change:prop"]))])),_:1},8,["id"])}],["__scopeId","data-v-d3533eac"]]);export{kn as _};