UNPKG

highcharts

Version:
13 lines 6.4 kB
!/** * Highcharts JS v12.5.0 (2026-01-12) * @module highcharts/modules/funnel * @requires highcharts * * Highcharts funnel module * * (c) 2010-2026 Highsoft AS * Author: Torstein Honsi * * A commercial license may be required depending on use. * See www.highcharts.com/license */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/modules/funnel",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/funnel"]=e(t._Highcharts,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e)=>(()=>{"use strict";var i={512:t=>{t.exports=e},944:e=>{e.exports=t}},a={};function d(t){var e=a[t];if(void 0!==e)return e.exports;var s=a[t]={exports:{}};return i[t](s,s.exports,d),s.exports}d.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return d.d(e,{a:e}),e},d.d=(t,e)=>{for(var i in e)d.o(e,i)&&!d.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},d.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var s={};d.d(s,{default:()=>N});var o=d(944),r=d.n(o);let{defaultOptions:n}=r(),{noop:l}=r(),{addEvent:h,extend:p,isObject:c,merge:u,relativeLength:g}=r(),x={radius:0,scope:"stack",where:void 0};function y(t,e){return c(t)||(t={radius:t||0}),u(x,e,t)}var f=d(512),b=d.n(f);let{composed:L,noop:m}=r(),{column:v,pie:M}=b().seriesTypes,{addEvent:W,correctFloat:A,extend:C,fireEvent:H,isArray:w,merge:P,pick:k,pushUnique:O,relativeLength:S,splat:D}=r(),I=b().series.prototype.alignDataLabel;function R(t,e){return/%$/.test(t)?e*parseInt(t,10)/100:parseInt(t,10)}class Y extends M{alignDataLabel(t,e,i,a,d){let s=t.series,o=s.options.reversed,r=t.dlBox||t.shapeArgs,{align:n,padding:l=0,verticalAlign:h}=i,p=((s.options||{}).dataLabels||{}).inside,c=s.center[1],u=t.plotY||0,g=e.height??e.getBBox().height,x=s.getWidthAt((o?2*c-u:u)-r.height/2+g),y="middle"===h?(r.topWidth-r.bottomWidth)/4:(x-r.bottomWidth)/2,f=r.y,b=r.x;"middle"===h?f=r.y-r.height/2+g/2:"top"===h&&(f=r.y-r.height+g+l),("top"===h&&!o||"bottom"===h&&o||"middle"===h)&&("right"===n?b=r.x-l+y:"left"===n&&(b=r.x+l-y)),a={x:b,y:o?f-r.height:f,width:r.bottomWidth,height:r.height},i.verticalAlign="bottom",p&&(i.distance=void 0),p&&t.visible&&I.call(s,t,e,i,a,d),p&&(!t.visible&&t.dataLabel&&(t.dataLabel.placed=!1),t.contrastColor&&e.css({color:t.contrastColor}))}drawDataLabels(){(D(this.options.dataLabels||{})[0].inside?v:M).prototype.drawDataLabels.call(this)}getDataLabelPosition(t,e){let i=t.plotY||0,a=t.half?1:-1,d=this.getX(i,!!t.half,t);return{distance:e,natural:{x:0,y:i},computed:{},alignment:t.half?"right":"left",connectorPosition:{breakAt:{x:d+(e-5)*a,y:i},touchingSliceAt:{x:d+e*a,y:i}}}}translate(){let t=this,e=t.chart,i=t.options,a=i.reversed,d=i.ignoreHiddenPoint,s=y(i.borderRadius),o=e.plotWidth,r=e.plotHeight,n=i.center,l=R(n[0],o),h=R(n[1],r),p=R(i.width,o),c=R(i.height,r),u=R(i.neckWidth,o),g=R(i.neckHeight,r),x=h-c/2+c-g,f=t.points,b=S(s.radius,p),L=s.scope,v=+("left"===i.dataLabels.position),M=t=>{let e=Math.tan(t/2),i=Math.cos(D),d=Math.sin(D),s=b,o=s/e,r=Math.tan((Math.PI-t)/3.2104);return o>I&&(s=(o=I)*e),{dx:[o*i,(o-(r*=s))*i,o-r,o],dy:[o*d,(o-r)*d,o-r,o].map(t=>a?-t:t)}},W=0,C=0,w,P,O,D,I,Y,_,j,B,T,X,N;for(let e of(t.getWidthAt=function(t){let e=h-c/2;return t>x||c===g?u:u+(p-u)*(1-(t-e)/(c-g))},t.getX=function(e,i,d){return l+(i?-1:1)*(t.getWidthAt(a?2*h-e:e)/2+(d.dataLabel?.dataLabelPosition?.distance??S(this.options.dataLabels?.distance||0,p)))},t.center=[l,h,c],t.centerX=l,f))e.y&&e.isValid()&&(!d||!1!==e.visible)&&(W+=e.y);for(let e of f){if(N=null,O=W?e.y/W:0,T=(_=h-c/2+C*c)+O*c,j=(Y=l-(w=t.getWidthAt(_))/2)+w,X=(B=l-(w=t.getWidthAt(T))/2)+w,A(_)>=x?(Y=B=l-u/2,j=X=l+u/2):T>x&&(N=T,X=(B=l-(w=t.getWidthAt(x))/2)+w,T=x),a&&(_=2*h-_,T=2*h-T,null!==N&&(N=2*h-N)),b&&("point"===L||0===e.index||e.index===f.length-1||null!==N)){let t=Math.abs(T-_),i=j-X,a=X-B,d=Math.sqrt(i*i+t*t);D=Math.atan(0!==i?t/i:1/0),I=d/2,null!==N&&(I=Math.min(I,Math.abs(N-T)/2)),a>=1&&(I=Math.min(I,a/2));let s=M(D);if(P="stack"===L&&0!==e.index?[["M",Y,_],["L",j,_]]:[["M",Y+s.dx[0],_+s.dy[0]],["C",Y+s.dx[1],_+s.dy[1],Y+s.dx[2],_,Y+s.dx[3],_],["L",j-s.dx[3],_],["C",j-s.dx[2],_,j-s.dx[1],_+s.dy[1],j-s.dx[0],_+s.dy[0]]],null!==N){let t=M(Math.PI/2);s=M(Math.PI/2+D),P.push(["L",X+s.dx[0],T-s.dy[0]],["C",X+s.dx[1],T-s.dy[1],X,T+s.dy[2],X,T+s.dy[3]]),"stack"===L&&e.index!==f.length-1?P.push(["L",X,N],["L",B,N]):P.push(["L",X,N-t.dy[3]],["C",X,N-t.dy[2],X-t.dx[2],N,X-t.dx[3],N],["L",B+t.dx[3],N],["C",B+t.dx[2],N,B,N-t.dy[2],B,N-t.dy[3]]),P.push(["L",B,T+s.dy[3]],["C",B,T+s.dy[2],B-s.dx[1],T-s.dy[1],B-s.dx[0],T-s.dy[0]])}else a>=1?(s=M(Math.PI-D),"stack"===L&&0===e.index?P.push(["L",X,T],["L",B,T]):P.push(["L",X+s.dx[0],T-s.dy[0]],["C",X+s.dx[1],T-s.dy[1],X-s.dx[2],T,X-s.dx[3],T],["L",B+s.dx[3],T],["C",B+s.dx[2],T,B-s.dx[1],T-s.dy[1],B-s.dx[0],T-s.dy[0]])):(s=M(Math.PI-2*D),P.push(["L",B+s.dx[0],T-s.dy[0]],["C",B+s.dx[1],T-s.dy[1],B-s.dx[1],T-s.dy[1],B-s.dx[0],T-s.dy[0]]))}else P=[["M",Y,_],["L",j,_],["L",X,T]],null!==N&&P.push(["L",X,N],["L",B,N]),P.push(["L",B,T]);P.push(["Z"]),e.shapeType="path",e.shapeArgs={d:P},e.percentage=100*O,e.plotX=l,e.plotY=(_+(N||T))/2,e.tooltipPos=[l,e.plotY],e.dlBox={x:B,y:_,topWidth:j-Y,bottomWidth:X-B,height:Math.abs(k(N,T)-_),width:NaN},e.slice=m,e.half=v,e.isValid()&&(!d||!1!==e.visible)&&(C+=O)}H(t,"afterTranslate")}sortByAngle(t){t.sort((t,e)=>t.plotY-e.plotY)}}function _(){for(let t of this.series){let e=t.options&&t.options.dataLabels;w(e)&&(e=e[0]),t.is("pie")&&t.placeDataLabels&&e&&!e.inside&&t.placeDataLabels()}}Y.defaultOptions=P(M.defaultOptions,{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"}}}),C(Y.prototype,{animate:m}),(Y||(Y={})).compose=function(t){O(L,"FunnelSeries")&&W(t,"afterHideAllOverlappingLabels",_)},b().registerSeriesType("funnel",Y);let j=Y,{merge:B}=r();class T extends j{}T.defaultOptions=B(j.defaultOptions,{neckHeight:"0%",neckWidth:"0%",reversed:!0}),b().registerSeriesType("pyramid",T);let X=r();j.compose(X.Chart);let N=r();return s.default})());