9 lines
6.1 KiB
JavaScript
9 lines
6.1 KiB
JavaScript
|
!/**
|
||
|
* Highcharts JS v11.4.1 (2024-04-04)
|
||
|
*
|
||
|
* Highcharts funnel module
|
||
|
*
|
||
|
* (c) 2010-2024 Torstein Honsi
|
||
|
*
|
||
|
* License: www.highcharts.com/license
|
||
|
*/function(e){"object"==typeof module&&module.exports?(e.default=e,module.exports=e):"function"==typeof define&&define.amd?define("highcharts/modules/funnel",["highcharts"],function(t){return e(t),e.Highcharts=t,e}):e("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){"use strict";var t=e?e._modules:{};function i(e,t,i,s){e.hasOwnProperty(t)||(e[t]=s.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}i(t,"Series/Funnel/FunnelSeriesDefaults.js",[],function(){return{animation:!1,borderRadius:0,center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,size:!0,dataLabels:{connectorWidth:1,verticalAlign:"middle"},states:{select:{color:"#cccccc",borderColor:"#000000"}}}}),i(t,"Series/Funnel/FunnelSeries.js",[t["Series/Funnel/FunnelSeriesDefaults.js"],t["Core/Globals.js"],t["Extensions/BorderRadius.js"],t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(e,t,i,s,n){let{composed:a,noop:d}=t,{column:o,pie:l}=s.seriesTypes,{addEvent:r,correctFloat:h,extend:u,fireEvent:c,isArray:p,merge:y,pick:f,pushUnique:g,relativeLength:x,splat:b}=n,m=s.series.prototype.alignDataLabel;function L(e,t){return/%$/.test(e)?t*parseInt(e,10)/100:parseInt(e,10)}class S extends l{alignDataLabel(e,t,i,s,n){let a=e.series,d=a.options.reversed,o=e.dlBox||e.shapeArgs,{align:l,padding:r=0,verticalAlign:h}=i,u=((a.options||{}).dataLabels||{}).inside,c=a.center[1],p=e.plotY||0,y=t.height??t.getBBox().height,f=a.getWidthAt((d?2*c-p:p)-o.height/2+y),g="middle"===h?(o.topWidth-o.bottomWidth)/4:(f-o.bottomWidth)/2,x=o.y,b=o.x;"middle"===h?x=o.y-o.height/2+y/2:"top"===h&&(x=o.y-o.height+y+r),("top"===h&&!d||"bottom"===h&&d||"middle"===h)&&("right"===l?b=o.x-r+g:"left"===l&&(b=o.x+r-g)),s={x:b,y:d?x-o.height:x,width:o.bottomWidth,height:o.height},i.verticalAlign="bottom",u&&(i.distance=void 0),u&&e.visible&&m.call(a,e,t,i,s,n),u&&(!e.visible&&e.dataLabel&&(e.dataLabel.placed=!1),e.contrastColor&&t.css({color:e.contrastColor}))}drawDataLabels(){(b(this.options.dataLabels)[0].inside?o:l).prototype.drawDataLabels.call(this)}getDataLabelPosition(e,t){let i=e.plotY||0,s=e.half?1:-1,n=this.getX(i,!!e.half,e);return{distance:t,natural:{x:0,y:i},computed:{},alignment:e.half?"right":"left",connectorPosition:{breakAt:{x:n+(t-5)*s,y:i},touchingSliceAt:{x:n+t*s,y:i}}}}translate(){let e=this,t=e.chart,s=e.options,n=s.reversed,a=s.ignoreHiddenPoint,o=i.optionsToObject(s.borderRadius),l=t.plotWidth,r=t.plotHeight,u=s.center,p=L(u[0],l),y=L(u[1],r),g=L(s.width,l),b=L(s.height,r),m=L(s.neckWidth,l),S=L(s.neckHeight,r),C=y-b/2+b-S,M=e.points,j=x(o.radius,g),v=o.scope,P="left"===s.dataLabels.position?1:0,W=e=>{let t=Math.tan(e/2),i=Math.cos(H),s=Math.sin(H),a=j,d=a/t,o=Math.tan((Math.PI-e)/3.2104);return d>I&&(a=(d=I)*t),{dx:[d*i,(d-(o*=a))*i,d-o,d],dy:[d*s,(d-o)*s,d-o,d].map(e=>n?-e:e)}},A=0,D=0,F,k,w,H,I,O,B,T,Y,R,E,X;for(let t of(e.getWidthAt=function(e){let t=y-b/2;return e>C||b===S?m:m+(g-m)*(1-(e-t)/(b-S))},e.getX=function(t,i,s){return p+(i?-1:1)*(e.getWidthAt(n?2*y-t:t)/2+(s.dataLabel?.dataLabelPosition?.distance??x(this.options.dataLabels?.distance||0,g)))},e.center=[p,y,b],e.centerX=p,M))t.y&&t.isValid()&&(!a||!1!==t.visible)&&(A+=t.y);for(let t of M){if(X=null,w=A?t.y/A:0,R=(B=y-b/2+D*b)+w*b,T=(O=p-(F=e.getWidthAt(B))/2)+F,E=(Y=p-(F=e.getWidthAt(R))/2)+F,h(B)>=C?(O=Y=p-m/2,T=E=p+m/2):R>C&&(X=R,E=(Y=p-(F=e.getWidthAt(C))/2)+F,R=C),n&&(B=2*y-B,R=2*y-R,null!==X&&(X=2*y-X)),j&&("point"===v||0===t.index||t.index===M.length-1||null!==X)){let e=Math.abs(R-B),i=T-E,s=E-Y,n=Math.sqrt(i*i+e*e);H=Math.atan(0!==i?e/i:1/0),I=n/2,null!==X&&(I=Math.min(I,Math.abs(X-R)/2)),s>=1&&(I=Math.min(I,s/2));let a=W(H);if(k="stack"===v&&0!==t.index?[["M",O,B],["L",T,B]]:[["M",O+a.dx[0],B+a.dy[0]],["C",O+a.dx[1],B+a.dy[1],O+a.dx[2],B,O+a.dx[3],B],["L",T-a.dx[3],B],["C",T-a.dx[2],B,T-a.dx[1],B+a.dy[1],T-a.dx[0],B+a.dy[0]]],null!==X){let e=W(Math.PI/2);a=W(Math.PI/2+H),k.push(["L",E+a.dx[0],R-a.dy[0]],["C",E+a.dx[1],R-a.dy[1],E,R+a.dy[2],E,R+a.dy[3]])
|