UNPKG

highcharts

Version:
15 lines 11.3 kB
!/** * Highcharts JS v12.6.0 (2026-04-13) * @module highcharts/modules/funnel3d * @requires highcharts * @requires highcharts/highcharts-3d * @requires highcharts/modules/cylinder * * Highcharts funnel module * * (c) 2010-2026 Highsoft AS * Author: Kacper Madej * * 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.Color,t._Highcharts.RendererRegistry,t._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/modules/funnel3d",["highcharts/highcharts"],function(t){return e(t,t.Color,t.RendererRegistry,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/funnel3d"]=e(t._Highcharts,t._Highcharts.Color,t._Highcharts.RendererRegistry,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.Color,t.Highcharts.RendererRegistry,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e,r,i)=>(()=>{"use strict";var o={512:t=>{t.exports=i},608:t=>{t.exports=r},620:t=>{t.exports=e},944:e=>{e.exports=t}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var r=n[t]={exports:{}};return o[t](r,r.exports,s),r.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var h={};s.d(h,{default:()=>T});var a=s(944),d=s.n(a),l=s(620),p=s.n(l),c=s(608),g=s.n(c);let{doc:f,win:y}=d();function u(t,e){let r;for(r in t||(t={}),e)t[r]=e[r];return t}function x(t){return w(t)&&"number"==typeof t.nodeType}function w(t,e){let r;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(r=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==r)}function b(t,...e){let r,i=[t,...e],o={},n=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,r){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call((0,t[r]),t[r],r,t)}(e,function(r,i){if("__proto__"!==i&&"constructor"!==i){let o;!w(r,!0)||(o=r?.constructor,w(r,!0)&&!x(r)&&o?.name&&"Object"!==o.name)||x(r)?t[i]=e[i]:t[i]=n(t[i]||{},r)}}),t};!0===t&&(o=i[1],i=Array.prototype.slice.call(i,2));let s=i.length;for(r=0;r<s;r++)o=n(o,i[r]);return o}function m(){let t=arguments,e=t.length;for(let r=0;r<e;r++){let e=t[r];if(null!=e)return e}}function A(t,e,r){return/%$/.test(t)?e*parseFloat(t)/100+(r||0):parseFloat(t)}Array.prototype.find;let{parse:z}=p(),{charts:C}=d(),{Element3D:L}=g().getRendererType().prototype,v=class extends L{constructor(){super(...arguments),this.mainParts=["top","bottom"],this.parts=["top","bottom","frontUpper","backUpper","frontLower","backLower","rightUpper","rightLower"],this.sideGroups=["upperGroup","lowerGroup"],this.sideParts={upperGroup:["frontUpper","backUpper","rightUpper"],lowerGroup:["frontLower","backLower","rightLower"]},this.pathType="funnel3d"}opacitySetter(t){let e=parseFloat(t),r=this.parts,i=C[this.renderer.chartIndex],o="group-opacity-"+e+"-"+i.index;if(this.parts=this.mainParts,this.singleSetterForParts("opacity",e),this.parts=r,!i.renderer.filterId){for(let t of(i.renderer.definition({tagName:"filter",attributes:{id:o},children:[{tagName:"feComponentTransfer",children:[{tagName:"feFuncA",attributes:{type:"table",tableValues:"0 "+e}}]}]}),this.sideGroups))this[t].attr({filter:"url(#"+o+")"});if(this.renderer.styledMode)for(let t of(i.renderer.definition({tagName:"style",textContent:".highcharts-"+o+" {filter:url(#"+o+")}"}),this.sideGroups))this[t].addClass("highcharts-"+o)}return this}fillSetter(t){let e=z(t),r=e.rgba[3],i={top:z(t).brighten(.1).get(),bottom:z(t).brighten(-.2).get()};if(r<1?(e.rgba[3]=1,e=e.get("rgb"),this.attr({opacity:r})):e=t,e.linearGradient||e.radialGradient||!this.gradientForSides||(e={linearGradient:{x1:0,x2:1,y1:1,y2:1},stops:[[0,z(t).brighten(-.2).get()],[.5,t],[1,z(t).brighten(-.2).get()]]}),e.linearGradient)for(let t of this.sideGroups){let r=this[t].gradientBox,o=e.linearGradient,n=b(e,{linearGradient:{x1:r.x+o.x1*r.width,y1:r.y+o.y1*r.height,x2:r.x+o.x2*r.width,y2:r.y+o.y2*r.height}});for(let e of this.sideParts[t])i[e]=n}else if(b(!0,i,{frontUpper:e,backUpper:e,rightUpper:e,frontLower:e,backLower:e,rightLower:e}),e.radialGradient)for(let t of this.sideGroups){let e=this[t].gradientBox,r=e.x+e.width/2,i=e.y+e.height/2,o=Math.min(e.width,e.height);for(let e of this.sideParts[t])this[e].setRadialReference([r,i,o])}if(this.singleSetterForParts("fill",null,i),this.color=this.fill=t,e.linearGradient)for(let t of[this.frontLower,this.frontUpper]){let e=t.element,r=e&&this.renderer.gradients[e.gradient];r&&"userSpaceOnUse"!==r.attr("gradientUnits")&&r.attr({gradientUnits:"userSpaceOnUse"})}return this}adjustForGradient(){let t;for(let e of this.sideGroups){let r={x:Number.MAX_VALUE,y:Number.MAX_VALUE},i={x:-Number.MAX_VALUE,y:-Number.MAX_VALUE};for(let o of this.sideParts[e])t=this[o].getBBox(!0),r={x:Math.min(r.x,t.x),y:Math.min(r.y,t.y)},i={x:Math.max(i.x,t.x+t.width),y:Math.max(i.y,t.y+t.height)};this[e].gradientBox={x:r.x,width:i.x-r.x,y:r.y,height:i.y-r.y}}}zIndexSetter(){return this.finishedOnAdd&&this.adjustForGradient(),this.renderer.Element.prototype.zIndexSetter.apply(this,arguments)}onAdd(){this.adjustForGradient(),this.finishedOnAdd=!0}},{charts:U}=d();function G(t){let e=this.element3d("funnel3d",t),r=this.styledMode,i={"stroke-width":1,stroke:"none"};for(let t of(e.upperGroup=this.g("funnel3d-upper-group").attr({zIndex:e.frontUpper.zIndex}).add(e),[e.frontUpper,e.backUpper,e.rightUpper]))r||t.attr(i),t.add(e.upperGroup);for(let t of(e.lowerGroup=this.g("funnel3d-lower-group").attr({zIndex:e.frontLower.zIndex}).add(e),[e.frontLower,e.backLower,e.rightLower]))r||t.attr(i),t.add(e.lowerGroup);return e.gradientForSides=t.gradientForSides,e}function M(t){this.getCylinderEnd||(0,a.error)("A required Highcharts module is missing: cylinder.js",!0,U[this.chartIndex]);let e=U[this.chartIndex],r=t.alphaCorrection=90-Math.abs(e.options.chart.options3d.alpha%180-90),i=this.cuboidPath.call(this,b(t,{depth:t.width,width:(t.width+t.bottom.width)/2})),o=i.isTop,n=!i.isFront,s=!!t.middle,h=this.getCylinderEnd(e,b(t,{x:t.x-t.width/2,z:t.z-t.width/2,alphaCorrection:r})),d=t.bottom.width,l=b(t,{width:d,x:t.x-d/2,z:t.z-d/2,alphaCorrection:r}),p=this.getCylinderEnd(e,l,!0),c=d,g=l,f=p,y=p,u;s&&(c=t.middle.width,g=b(t,{y:t.y+t.middle.fraction*t.height,width:c,x:t.x-c/2,z:t.z-c/2}),f=this.getCylinderEnd(e,g,!1),y=this.getCylinderEnd(e,g,!1));let x={top:h,bottom:p,frontUpper:this.getCylinderFront(h,f),zIndexes:{group:i.zIndexes.group,top:3*(0===o),bottom:3*(1===o),frontUpper:n?2:1,backUpper:n?1:2,rightUpper:n?2:1}};return x.backUpper=this.getCylinderBack(h,f),u=Math.min(c,t.width)/Math.max(c,t.width)!=1,x.rightUpper=this.getCylinderFront(this.getCylinderEnd(e,b(t,{x:t.x-t.width/2,z:t.z-t.width/2,alphaCorrection:u?-r:0}),!1),this.getCylinderEnd(e,b(g,{alphaCorrection:u?-r:0}),!s)),s&&(u=Math.min(c,d)/Math.max(c,d)!=1,b(!0,x,{frontLower:this.getCylinderFront(y,p),backLower:this.getCylinderBack(y,p),rightLower:this.getCylinderFront(this.getCylinderEnd(e,b(l,{alphaCorrection:u?-r:0}),!0),this.getCylinderEnd(e,b(g,{alphaCorrection:u?-r:0}),!1)),zIndexes:{frontLower:n?2:1,backLower:n?1:2,rightLower:n?1:2}})),x}var k=s(512),S=s.n(k);let{seriesTypes:{column:F}}=S();class H extends F.prototype.pointClass{}u(H.prototype,{shapeType:"funnel3d"});let{deg2rad:B}=d();function R(t,e,r,i){let o=e.options.chart.options3d,n=m(i,!!r&&e.inverted),s={x:e.plotWidth/2,y:e.plotHeight/2,z:o.depth/2,vd:m(o.depth,1)*m(o.viewDistance,0)},h=e.scale3d||1,a=B*o.beta*(n?-1:1),d=B*o.alpha*(n?-1:1),l={cosA:Math.cos(d),cosB:Math.cos(-a),sinA:Math.sin(d),sinB:Math.sin(-a)};return r||(s.x+=e.plotLeft,s.y+=e.plotTop),t.map(function(t){var e,r,i;let o=(e=(n?t.y:t.x)-s.x,r=(n?t.x:t.y)-s.y,i=(t.z||0)-s.z,{x:l.cosB*e-l.sinB*i,y:-l.sinA*l.sinB*e+l.cosA*r-l.cosB*l.sinA*i,z:l.cosA*l.sinB*e+l.sinA*r+l.cosA*l.cosB*i}),a=_(o,s,s.vd);return a.x=a.x*h+s.x,a.y=a.y*h+s.y,a.z=o.z*h+s.z,{x:n?a.y:a.x,y:n?a.x:a.y,z:a.z}})}function _(t,e,r){let i=r>0&&r<1/0?r/(t.z+e.z+r):1;return{x:t.x*i,y:t.y*i}}function P(t){let e=0,r,i;for(r=0;r<t.length;r++)i=(r+1)%t.length,e+=t[r].x*t[i].y-t[i].x*t[r].y;return e/2}let{noop:j}=d(),{perspective:E}={perspective:R,perspective3D:_,pointCameraDistance:function(t,e){let r=e.options.chart.options3d,i={x:e.plotWidth/2,y:e.plotHeight/2,z:m(r.depth,1)*m(r.viewDistance,0)+r.depth};return Math.sqrt(Math.pow(i.x-m(t.plotX,t.x),2)+Math.pow(i.y-m(t.plotY,t.y),2)+Math.pow(i.z-m(t.plotZ,t.z),2))},shapeArea:P,shapeArea3D:function(t,e,r){return P(R(t,e,r))}},{series:I,seriesTypes:{column:O}}=S();class W extends O{alignDataLabel(t,e,r){let i=t.dlBoxRaw,o=this.chart.inverted,n=t.plotY>m(this.translatedThreshold,this.yAxis.len),s=m(r.inside,!!this.options.stacking),h={x:i.x,y:i.y,height:0};r.align=m(r.align,!o||s?"center":n?"right":"left"),r.verticalAlign=m(r.verticalAlign,o||s?"middle":n?"top":"bottom"),"top"!==r.verticalAlign&&(h.y+=i.bottom/("bottom"===r.verticalAlign?1:2)),h.width=this.getWidthAt(h.y),this.options.reversed&&(h.width=i.fullWidth-h.width),s?h.x-=h.width/2:"left"===r.align?(r.align="right",h.x-=1.5*h.width):"right"===r.align?(r.align="left",h.x+=h.width/2):h.x-=h.width/2,t.dlBox=h,O.prototype.alignDataLabel.apply(this,arguments)}bindAxes(){I.prototype.bindAxes.apply(this,arguments),u(this.xAxis.options,{gridLineWidth:0,lineWidth:0,title:void 0,tickPositions:[]}),b(!0,this.yAxis.options,{gridLineWidth:0,title:void 0,labels:{enabled:!1}})}translate(){I.prototype.translate.apply(this,arguments);let t=this.chart,e=this.options,r=e.reversed,i=e.ignoreHiddenPoint,o=t.plotWidth,n=t.plotHeight,s=e.center,h=A(s[0],o),a=A(s[1],n),d=A(e.width,o),l=A(e.height,n),p=A(e.neckWidth,o),c=A(e.neckHeight,n),g=a-l/2+l-c,f=this.points,y=0,x=0,w,b,z,C,L,v,U,G,M;for(let t of(this.getWidthAt=b=function(t){return t>g||l===c?p:p+(d-p)*(1-(t-(a-l/2))/(l-c))},this.center=[h,a,l],this.centerX=h,f))i&&!1===t.visible||(y+=t.y);for(let o of f)U=null,z=y?o.y/y:0,v=(L=a-l/2+x*l)+z*l,w=b(L),G=v-L,(M={gradientForSides:m(o.options.gradientForSides,e.gradientForSides),x:h,y:L,height:G,width:w,z:1,top:{width:w}}).bottom={fraction:z,width:w=b(v)},L>=g?M.isCylinder=!0:v>g&&(U=v,w=b(g),v=g,M.bottom.width=w,M.middle={fraction:G?(g-L)/G:0,width:w}),r&&(M.y=L=a+l/2-(x+z)*l,M.middle&&(M.middle.fraction=1-(G?M.middle.fraction:0)),w=M.width,M.width=M.bottom.width,M.bottom.width=w),o.shapeArgs=u(o.shapeArgs,M),o.percentage=100*z,o.plotX=h,r?o.plotY=a+l/2-(x+z/2)*l:o.plotY=(L+(U||v))/2,C=E([{x:h,y:o.plotY,z:r?-(d-b(o.plotY))/2:-b(o.plotY)/2}],t,!0)[0],o.tooltipPos=[C.x,C.y],o.dlBoxRaw={x:h,width:b(o.plotY),y:L,bottom:M.height||0,fullWidth:d},i&&!1===o.visible||(x+=z)}}W.compose=function(t){let e=t.prototype;e.funnel3d||(e.Element3D.types.funnel3d=v,u(e,{funnel3d:G,funnel3dPath:M}))},W.defaultOptions=b(O.defaultOptions,{center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,gradientForSides:!0,animation:!1,edgeWidth:0,colorByPoint:!0,showInLegend:!1,dataLabels:{align:"right",crop:!1,inside:!1,overflow:"allow"}}),u(W.prototype,{pointClass:H,translate3dShapes:j}),S().registerSeriesType("funnel3d",W),W.compose(g().getRendererType());let T=d();return h.default})());