| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).stageCustomSeriesInstaller=e(t.echarts)}(this,(function(t){"use strict";function e(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(a){if("default"!==a){var c=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,c.get?c:{enumerable:!0,get:function(){return t[a]}})}})),e.default=t,Object.freeze(e)}var a=e(t),c=function(e,c){var o,i=c.value(0),n=c.value(1),r=c.value(2),h=c.coord([i,r]),l=c.coord([n,r]),s=c.coord([0,0])[1]-c.coord([0,1])[1],d=c.visual("color"),p=e.itemPayload,x=p.itemStyle||{},f=x.borderRadius||8,u=t.zrUtil.retrieve2(null===(o=p.envelope)||void 0===o?void 0:o.externalRadius,6),y=t.zrUtil.retrieve2(x.verticalMargin,8),g=t.zrUtil.retrieve2(x.minHorizontalSize,3),v=[],w=e.context.boxes||[],m=l[0]-h[0],b=Math.max(m,g),M={x:h[0]-(b-m)/2,y:h[1]-s/2+5+14+y,width:b,height:s-14-5-2*y};v.push({type:"rect",shape:{x:M.x,y:M.y,width:M.width,height:M.height,r:f},style:{fill:d},z2:10}),w.push(M),e.context.boxes=w,e.context.renderedStages||(e.context.renderedStages=[]);var L=e.context.renderedStages;if(!L[r]){var z=p.axisLabel||{},S=c.ordinalRawValue(2);"function"==typeof z.formatter&&(S=z.formatter(S,r)),v.push({type:"text",style:{x:e.coordSys.x+5,y:h[1]-s/2+5+14,fill:z.color||"#8A8A8A",text:S,verticalAlign:"bottom"},z2:20}),L[r]=!0}if(e.dataIndex===e.dataInsideLength-1){for(var A=[],O=0;O<e.dataInsideLength;O++){var j=c.visual("color",O);A.indexOf(j)<0&&A.push(j)}var D=p.envelope||{};if(!1!==D.show&&w.length>1){var U=[],I=a.zrUtil.retrieve2(D.margin,2);w.sort((function(t,e){return t.x-e.x||t.y-e.y}));var P=D.color||"#888";if(A.length>0&&!D.color){var Z=[];for(O=0;O<A.length;O++)Z.push({offset:(2*O+1)/(2*A.length),color:A[O]});P={type:"linear",x:0,y:0,x2:0,y2:1,global:!1,colorStops:Z}}var R=t.zrUtil.retrieve2(D.opacity,.25);for(O=0;O<w.length;O++){var C=w[O];if(U.push({type:"rect",shape:{x:C.x-I,y:C.y-I,width:C.width+2*I,height:C.height+2*I,r:Math.min(f,C.width/2)+I}}),O>0){var T=w[O-1],k=T.y>C.y+C.height,q=k?T.y-C.y-C.height+2*f:C.y-T.y-T.height+2*f,E=k?C.y+C.height-f:T.y+T.height-f;if(C.x-I>=T.x+T.width+I)continue;if(k){if(C.x-I-T.x>0){var H=Math.ceil(C.x-I),V=T.y-I,B=Math.min((C.x-I-T.x)/2,u);U.push({type:"path",shape:{pathData:"M".concat(H-B," ").concat(V,"A").concat(B," ").concat(B," 0 0 0 ").concat(H," ").concat(V-B,"L").concat(H,",").concat(V+I,"L").concat(H-B,",").concat(V,"Z")}})}if(C.x+C.width-T.x-T.width-I>0){var F=C.y+C.height+I,G=Math.floor(T.x+T.width+I);B=Math.min((C.x+C.width-T.x-T.width-I)/2,u);U.push({type:"path",shape:{pathData:"M".concat(G+B," ").concat(F,"A").concat(B," ").concat(B," 0 0 0 ").concat(G," ").concat(F+B,"L").concat(G,",").concat(F-I,"L").concat(G+B,",").concat(F,"Z")}})}}else{if(C.x-I-T.x>0){H=Math.ceil(C.x-I);var J=T.y+T.height+I;B=Math.min((C.x-I-T.x)/2,u);U.push({type:"path",shape:{pathData:"M".concat(H," ").concat(J+B,"A").concat(B," ").concat(B," 0 0 0 ").concat(H-B," ").concat(J,"L").concat(H,",").concat(J-I,"L").concat(H,",").concat(J+B,"Z")}})}if(C.x+C.width-T.x-T.width-I>0){V=C.y-I,G=Math.floor(T.x+T.width+I),B=Math.min((C.x+C.width-T.x-T.width-I)/2,u);U.push({type:"path",shape:{pathData:"M".concat(G," ").concat(V-B,"A").concat(B," ").concat(B," 0 0 0 ").concat(G+B," ").concat(V,"L").concat(G,",").concat(V+I,"L").concat(G,",").concat(V-B,"Z")}})}}U.push({type:"rect",shape:{x:T.x+T.width+I,y:E+q,width:C.x-T.x-T.width-2*I,height:-q}})}}v.push({type:"compoundPath",shape:{paths:U},style:{fill:P,opacity:R},silent:!0})}}return{type:"group",children:v}};return{install:function(t){t.registerCustomSeries("stage",c)}}})); |