highcharts
Version:
JavaScript charting framework
13 lines • 8.32 kB
JavaScript
!/**
* Highcharts JS v12.6.0 (2026-04-13)
* @module highcharts/modules/funnel
* @requires highcharts
*
* Highcharts funnel module
*
* (c) 2010-2026 Highsoft AS
* Author: Torstein Hønsi
*
* 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 r={512:t=>{t.exports=e},944:e=>{e.exports=t}},i={};function n(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={exports:{}};return r[t](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};n.d(o,{default:()=>_});var a=n(944),s=n.n(a);let{doc:l,win:d}=s();function h(t,e){let r;for(r in t||(t={}),e)t[r]=e[r];return t}function c(t){return u(t)&&"number"==typeof t.nodeType}function p(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function u(t,e){return!!t&&"object"==typeof t&&(!e||!p(t))}function f(t,...e){let r,i=[t,...e],n={},o=function(t,e){return"object"!=typeof t&&(t={}),y(e,function(r,i){if("__proto__"!==i&&"constructor"!==i){let n;!u(r,!0)||(n=r?.constructor,u(r,!0)&&!c(r)&&n?.name&&"Object"!==n.name)||c(r)?t[i]=e[i]:t[i]=o(t[i]||{},r)}}),t};!0===t&&(n=i[1],i=Array.prototype.slice.call(i,2));let a=i.length;for(r=0;r<a;r++)n=o(n,i[r]);return n}function y(t,e,r){for(let i in t)Object.hasOwnProperty.call(t,i)&&e.call(r||t[i],t[i],i,t)}function g(t,e,r){return/%$/.test(t)?e*parseFloat(t)/100+(r||0):parseFloat(t)}Array.prototype.find;let{defaultOptions:x}=s(),{noop:b}=s(),v={radius:0,scope:"stack",where:void 0};function L(t,e){return u(t)||(t={radius:t||0}),f(v,e,t)}var m=n(512),P=n.n(m);let{composed:E,noop:M}=s(),{column:O,pie:A}=P().seriesTypes,W=P().series.prototype.alignDataLabel;function j(t,e){return/%$/.test(t)?e*parseInt(t,10)/100:parseInt(t,10)}class w extends A{alignDataLabel(t,e,r,i,n){let o=t.series,a=o.options.reversed,s=t.dlBox||t.shapeArgs,{align:l,padding:d=0,verticalAlign:h}=r,c=((o.options||{}).dataLabels||{}).inside,p=o.center[1],u=t.plotY||0,f=e.height??e.getBBox().height,y=o.getWidthAt((a?2*p-u:u)-s.height/2+f),g="middle"===h?(s.topWidth-s.bottomWidth)/4:(y-s.bottomWidth)/2,x=s.y,b=s.x;"middle"===h?x=s.y-s.height/2+f/2:"top"===h&&(x=s.y-s.height+f+d),("top"===h&&!a||"bottom"===h&&a||"middle"===h)&&("right"===l?b=s.x-d+g:"left"===l&&(b=s.x+d-g)),i={x:b,y:a?x-s.height:x,width:s.bottomWidth,height:s.height},r.verticalAlign="bottom",c&&(r.distance=void 0),c&&t.visible&&W.call(o,t,e,r,i,n),c&&(!t.visible&&t.dataLabel&&(t.dataLabel.placed=!1),t.contrastColor&&e.css({color:t.contrastColor}))}drawDataLabels(){var t;((p(t=this.options.dataLabels||{})?t:[t])[0].inside?O:A).prototype.drawDataLabels.call(this)}getDataLabelPosition(t,e){let r=t.plotY||0,i=t.half?1:-1,n=this.getX(r,!!t.half,t);return{distance:e,natural:{x:0,y:r},computed:{},alignment:t.half?"right":"left",connectorPosition:{breakAt:{x:n+(e-5)*i,y:r},touchingSliceAt:{x:n+e*i,y:r}}}}translate(){let t=this,e=t.chart,r=t.options,i=r.reversed,n=r.ignoreHiddenPoint,o=L(r.borderRadius),a=e.plotWidth,d=e.plotHeight,c=r.center,p=j(c[0],a),u=j(c[1],d),f=j(r.width,a),y=j(r.height,d),x=j(r.neckWidth,a),b=j(r.neckHeight,d),v=u-y/2+y-b,m=t.points,P=g(o.radius,f),E=o.scope,O=+("left"===r.dataLabels.position),A=t=>{let e=Math.tan(t/2),r=Math.cos(S),n=Math.sin(S),o=P,a=o/e,s=Math.tan((Math.PI-t)/3.2104);return a>_&&(o=(a=_)*e),{dx:[a*r,(a-(s*=o))*r,a-s,a],dy:[a*n,(a-s)*n,a-s,a].map(t=>i?-t:t)}},W=0,w=0,C,k,H,S,_,D,I,T,R,Y,B,F;for(let e of(t.getWidthAt=function(t){let e=u-y/2;return t>v||y===b?x:x+(f-x)*(1-(t-e)/(y-b))},t.getX=function(e,r,n){return p+(r?-1:1)*(t.getWidthAt(i?2*u-e:e)/2+(n.dataLabel?.dataLabelPosition?.distance??g(this.options.dataLabels?.distance||0,f)))},t.center=[p,u,y],t.centerX=p,m))e.y&&e.isValid()&&(!n||!1!==e.visible)&&(W+=e.y);for(let e of m){var X;if(F=null,H=W?e.y/W:0,Y=(I=u-y/2+w*y)+H*y,T=(D=p-(C=t.getWidthAt(I))/2)+C,B=(R=p-(C=t.getWidthAt(Y))/2)+C,((X=I)>1e14?X:parseFloat(X.toPrecision(14)))>=v?(D=R=p-x/2,T=B=p+x/2):Y>v&&(F=Y,B=(R=p-(C=t.getWidthAt(v))/2)+C,Y=v),i&&(I=2*u-I,Y=2*u-Y,null!==F&&(F=2*u-F)),P&&("point"===E||0===e.index||e.index===m.length-1||null!==F)){let t=Math.abs(Y-I),r=T-B,i=B-R,n=Math.sqrt(r*r+t*t);S=Math.atan(0!==r?t/r:1/0),_=n/2,null!==F&&(_=Math.min(_,Math.abs(F-Y)/2)),i>=1&&(_=Math.min(_,i/2));let o=A(S);if(k="stack"===E&&0!==e.index?[["M",D,I],["L",T,I]]:[["M",D+o.dx[0],I+o.dy[0]],["C",D+o.dx[1],I+o.dy[1],D+o.dx[2],I,D+o.dx[3],I],["L",T-o.dx[3],I],["C",T-o.dx[2],I,T-o.dx[1],I+o.dy[1],T-o.dx[0],I+o.dy[0]]],null!==F){let t=A(Math.PI/2);o=A(Math.PI/2+S),k.push(["L",B+o.dx[0],Y-o.dy[0]],["C",B+o.dx[1],Y-o.dy[1],B,Y+o.dy[2],B,Y+o.dy[3]]),"stack"===E&&e.index!==m.length-1?k.push(["L",B,F],["L",R,F]):k.push(["L",B,F-t.dy[3]],["C",B,F-t.dy[2],B-t.dx[2],F,B-t.dx[3],F],["L",R+t.dx[3],F],["C",R+t.dx[2],F,R,F-t.dy[2],R,F-t.dy[3]]),k.push(["L",R,Y+o.dy[3]],["C",R,Y+o.dy[2],R-o.dx[1],Y-o.dy[1],R-o.dx[0],Y-o.dy[0]])}else i>=1?(o=A(Math.PI-S),"stack"===E&&0===e.index?k.push(["L",B,Y],["L",R,Y]):k.push(["L",B+o.dx[0],Y-o.dy[0]],["C",B+o.dx[1],Y-o.dy[1],B-o.dx[2],Y,B-o.dx[3],Y],["L",R+o.dx[3],Y],["C",R+o.dx[2],Y,R-o.dx[1],Y-o.dy[1],R-o.dx[0],Y-o.dy[0]])):(o=A(Math.PI-2*S),k.push(["L",R+o.dx[0],Y-o.dy[0]],["C",R+o.dx[1],Y-o.dy[1],R-o.dx[1],Y-o.dy[1],R-o.dx[0],Y-o.dy[0]]))}else k=[["M",D,I],["L",T,I],["L",B,Y]],null!==F&&k.push(["L",B,F],["L",R,F]),k.push(["L",R,Y]);k.push(["Z"]),e.shapeType="path",e.shapeArgs={d:k},e.percentage=100*H,e.plotX=p,e.plotY=(I+(F||Y))/2,e.tooltipPos=[p,e.plotY],e.dlBox={x:R,y:I,topWidth:T-D,bottomWidth:B-R,height:Math.abs(function(){let t=arguments,e=t.length;for(let r=0;r<e;r++){let e=t[r];if(null!=e)return e}}(F,Y)-I),width:NaN},e.slice=M,e.half=O,e.isValid()&&(!n||!1!==e.visible)&&(w+=H)}!function(t,e,r,i){if(r=r||{},l?.createEvent&&(t.dispatchEvent||t.fireEvent&&t!==s())){let i=l.createEvent("Events");i.initEvent(e,!0,!0),r=h(i,r),t.dispatchEvent?t.dispatchEvent(r):t.fireEvent(e,r)}else if(t.hcEvents){r.target||h(r,{preventDefault:function(){r.defaultPrevented=!0},target:t,type:e});let i=[],n=t,o=!1;for(;n.hcEvents;)Object.hasOwnProperty.call(n,"hcEvents")&&n.hcEvents[e]&&(i.length&&(o=!0),i.unshift.apply(i,n.hcEvents[e])),n=Object.getPrototypeOf(n);o&&i.sort((t,e)=>t.order-e.order),i.forEach(e=>{!1===e.fn.call(t,r,t)&&r.preventDefault()})}}(t,"afterTranslate")}sortByAngle(t){t.sort((t,e)=>t.plotY-e.plotY)}}function C(){for(let t of this.series){let e=t.options&&t.options.dataLabels;p(e)&&(e=e[0]),t.is("pie")&&t.placeDataLabels&&e&&!e.inside&&t.placeDataLabels()}}w.defaultOptions=f(A.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"}}}),h(w.prototype,{animate:M}),(w||(w={})).compose=function(t){0>E.indexOf("FunnelSeries")&&E.push("FunnelSeries")&&function(t,e,r,i={}){let n="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(n,"hcEvents")||(n.hcEvents={});let o=n.hcEvents;s().Point&&t instanceof s().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let a=t.addEventListener;a&&a.call(t,e,r,!!s().supportsPassiveEvents&&{passive:void 0===i.passive?-1!==e.indexOf("touch"):i.passive,capture:!1}),o[e]||(o[e]=[]);let l={fn:r,order:"number"==typeof i.order?i.order:1/0};o[e].push(l),o[e].sort((t,e)=>t.order-e.order)}(t,"afterHideAllOverlappingLabels",C)},P().registerSeriesType("funnel",w);let k=w;class H extends k{}H.defaultOptions=f(k.defaultOptions,{neckHeight:"0%",neckWidth:"0%",reversed:!0}),P().registerSeriesType("pyramid",H);let S=s();k.compose(S.Chart);let _=s();return o.default})());