UNPKG

highcharts

Version:
15 lines 12.9 kB
!/** * Highcharts JS v13.0.1 (2026-08-17) * @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.SVGRenderer,t._Highcharts.Color,t._Highcharts.SVGElement,t._Highcharts.SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/modules/funnel3d",["highcharts/highcharts"],function(t){return e(t,t.SVGRenderer,t.Color,t.SVGElement,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/funnel3d"]=e(t._Highcharts,t._Highcharts.SVGRenderer,t._Highcharts.Color,t._Highcharts.SVGElement,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SVGRenderer,t.Highcharts.Color,t.Highcharts.SVGElement,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e,r,i,s)=>(()=>{"use strict";var o={620(t){t.exports=r},28(t){t.exports=i},540(t){t.exports=e},512(t){t.exports=s},944(e){e.exports=t}};let n={};function h(t){let e=n[t];if(void 0!==e)return e.exports;let r=n[t]={exports:{}};return o[t](r,r.exports,h),r.exports}h.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return h.d(e,{a:e}),e},h.d=(t,e)=>{if(Array.isArray(e))for(var r=0;r<e.length;){var i=e[r++],s=e[r++];h.o(t,i)?0===s&&r++:0===s?Object.defineProperty(t,i,{enumerable:!0,value:e[r++]}):Object.defineProperty(t,i,{enumerable:!0,get:s})}else for(var i in e)h.o(e,i)&&!h.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},h.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let d={};h.d(d,{default:()=>j});var a=h(944),l=h.n(a),p=h(540),g=h.n(p),c=h(620),f=h.n(c),u=h(28),y=h.n(u);let{parse:x}=f();class m extends y(){constructor(){super(...arguments),this.parts=["front","top","side"],this.pathType="cuboid"}initArgs(t){let e=this.renderer,r=e[this.pathType+"Path"](t),i=r.zIndexes;for(let t of this.parts){let s={class:"highcharts-3d-"+t,zIndex:i[t]||0};e.styledMode&&("top"===t?s.filter="url(#highcharts-brighter)":"side"===t&&(s.filter="url(#highcharts-darker)")),this[t]=e.path(r[t]).attr(s).add(this)}this.attr({"stroke-linejoin":"round",zIndex:i.group}),this.forcedSides=r.forcedSides}singleSetterForParts(t,e,r,i,s,o){let n={},h=[null,null,i||"attr",s,o],d=r?.zIndexes;if(r){for(let e of(d?.group&&this.attr({zIndex:d.group}),Object.keys(r)))n[e]={},n[e][t]=r[e],d&&(n[e].zIndex=r.zIndexes[e]||0);h[1]=n}else n[t]=e,h[0]=n;return this.processParts.apply(this,h)}processParts(t,e,r,i,s){for(let o of this.parts)e&&(t=(0,a.pick)(e[o],!1)),!1!==t&&this[o][r](t,i,s);return this}destroy(){return this.processParts(null,null,"destroy"),super.destroy()}attr(t,e,r,i){if("string"==typeof t&&void 0!==e){let r=t;(t={})[r]=e}return t.shapeArgs||(0,a.defined)(t.x)?this.singleSetterForParts("d",null,this.renderer[this.pathType+"Path"](t.shapeArgs||t)):super.attr(t,void 0,r,i)}animate(t,e,r){if((0,a.defined)(t.x)&&(0,a.defined)(t.y)){let i=this.renderer[this.pathType+"Path"](t),s=i.forcedSides;this.singleSetterForParts("d",null,i,"animate",e,r),this.attr({zIndex:i.zIndexes.group}),s!==this.forcedSides&&(this.forcedSides=s,this.renderer.styledMode||this.fillSetter(this.fill))}else super.animate(t,e,r);return this}fillSetter(t){return this.forcedSides=this.forcedSides||[],this.singleSetterForParts("fill",null,{front:t,top:x(t).brighten(this.forcedSides.indexOf("top")>=0?0:.1).get(),side:x(t).brighten(this.forcedSides.indexOf("side")>=0?0:-.1).get()}),this.color=this.fill=t,this}}m.types={base:m,cuboid:m};let w=m,{parse:b}=f(),{charts:S}=l(),z=class extends w{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=S[this.renderer.chartIndex],s="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:s},children:[{tagName:"feComponentTransfer",children:[{tagName:"feFuncA",attributes:{type:"table",tableValues:"0 "+e}}]}]}),this.sideGroups))this[t].attr({filter:"url(#"+s+")"});if(this.renderer.styledMode)for(let t of(i.renderer.definition({tagName:"style",textContent:".highcharts-"+s+" {filter:url(#"+s+")}"}),this.sideGroups))this[t].addClass("highcharts-"+s)}return this}fillSetter(t){let e=b(t),r=e.rgba[3],i={top:b(t).brighten(.1).get(),bottom:b(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,b(t).brighten(-.2).get()],[.5,t],[1,b(t).brighten(-.2).get()]]}),e.linearGradient)for(let t of this.sideGroups){let r=this[t].gradientBox,s=e.linearGradient,o=(0,a.merge)(e,{linearGradient:{x1:r.x+s.x1*r.width,y1:r.y+s.y1*r.height,x2:r.x+s.x2*r.width,y2:r.y+s.y2*r.height}});for(let e of this.sideParts[t])i[e]=o}else if((0,a.merge)(!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,s=Math.min(e.width,e.height);for(let e of this.sideParts[t])this[e].setRadialReference([r,i,s])}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 s of this.sideParts[e])t=this[s].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:A}=l();function k(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 L(t){this.getCylinderEnd||(0,a.error)("A required Highcharts module is missing: cylinder.js",!0,A[this.chartIndex]);let e=A[this.chartIndex],r=t.alphaCorrection=90-Math.abs(e.options.chart.options3d.alpha%180-90),i=this.cuboidPath.call(this,(0,a.merge)(t,{depth:t.width,width:(t.width+t.bottom.width)/2})),s=i.isTop,o=!i.isFront,n=!!t.middle,h=this.getCylinderEnd(e,(0,a.merge)(t,{x:t.x-t.width/2,z:t.z-t.width/2,alphaCorrection:r})),d=t.bottom.width,l=(0,a.merge)(t,{width:d,x:t.x-d/2,z:t.z-d/2,alphaCorrection:r}),p=this.getCylinderEnd(e,l,!0),g=d,c=l,f=p,u=p,y;n&&(g=t.middle.width,c=(0,a.merge)(t,{y:t.y+t.middle.fraction*t.height,width:g,x:t.x-g/2,z:t.z-g/2}),f=this.getCylinderEnd(e,c,!1),u=this.getCylinderEnd(e,c,!1));let x={top:h,bottom:p,frontUpper:this.getCylinderFront(h,f),zIndexes:{group:i.zIndexes.group,top:3*(0===s),bottom:3*(1===s),frontUpper:o?2:1,backUpper:o?1:2,rightUpper:o?2:1}};return x.backUpper=this.getCylinderBack(h,f),y=Math.min(g,t.width)/Math.max(g,t.width)!=1,x.rightUpper=this.getCylinderFront(this.getCylinderEnd(e,(0,a.merge)(t,{x:t.x-t.width/2,z:t.z-t.width/2,alphaCorrection:y?-r:0}),!1),this.getCylinderEnd(e,(0,a.merge)(c,{alphaCorrection:y?-r:0}),!n)),n&&(y=Math.min(g,d)/Math.max(g,d)!=1,(0,a.merge)(!0,x,{frontLower:this.getCylinderFront(u,p),backLower:this.getCylinderBack(u,p),rightLower:this.getCylinderFront(this.getCylinderEnd(e,(0,a.merge)(l,{alphaCorrection:y?-r:0}),!0),this.getCylinderEnd(e,(0,a.merge)(c,{alphaCorrection:y?-r:0}),!1)),zIndexes:{frontLower:o?2:1,backLower:o?1:2,rightLower:o?1:2}})),x}var v=h(512),C=h.n(v);let{seriesTypes:{column:G}}=C();class P extends G.prototype.pointClass{}(0,a.extend)(P.prototype,{shapeType:"funnel3d"});let{deg2rad:U}=l();function M(t,e,r,i){let s=e.options.chart.options3d,o=(0,a.pick)(i,!!r&&e.inverted),n={x:e.plotWidth/2,y:e.plotHeight/2,z:s.depth/2,vd:(0,a.pick)(s.depth,1)*(0,a.pick)(s.viewDistance,0)},h=e.scale3d||1,d=U*s.beta*(o?-1:1),l=U*s.alpha*(o?-1:1),p={cosA:Math.cos(l),cosB:Math.cos(-d),sinA:Math.sin(l),sinB:Math.sin(-d)};return r||(n.x+=e.plotLeft,n.y+=e.plotTop),t.map(function(t){var e,r,i;let s=(e=(o?t.y:t.x)-n.x,r=(o?t.x:t.y)-n.y,i=(t.z||0)-n.z,{x:p.cosB*e-p.sinB*i,y:-p.sinA*p.sinB*e+p.cosA*r-p.cosB*p.sinA*i,z:p.cosA*p.sinB*e+p.sinA*r+p.cosA*p.cosB*i}),d=F(s,n,n.vd);return d.x=d.x*h+n.x,d.y=d.y*h+n.y,d.z=s.z*h+n.z,{x:o?d.y:d.x,y:o?d.x:d.y,z:d.z}})}function F(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 H(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:I}=l(),{perspective:B}={perspective:M,perspective3D:F,pointCameraDistance:function(t,e){let r=e.options.chart.options3d,i={x:e.plotWidth/2,y:e.plotHeight/2,z:(0,a.pick)(r.depth,1)*(0,a.pick)(r.viewDistance,0)+r.depth};return Math.sqrt(Math.pow(i.x-(0,a.pick)(t.plotX,t.x),2)+Math.pow(i.y-(0,a.pick)(t.plotY,t.y),2)+Math.pow(i.z-(0,a.pick)(t.plotZ,t.z),2))},shapeArea:H,shapeArea3D:function(t,e,r){return H(M(t,e,r))}},{series:E,seriesTypes:{column:_}}=C();class O extends _{alignDataLabel(t,e,r){let i=t.dlBoxRaw,s=this.chart.inverted,o=t.plotY>(0,a.pick)(this.translatedThreshold,this.yAxis.len),n=(0,a.pick)(r.inside,!!this.options.stacking),h={x:i.x,y:i.y,height:0};r.align=(0,a.pick)(r.align,!s||n?"center":o?"right":"left"),r.verticalAlign=(0,a.pick)(r.verticalAlign,s||n?"middle":o?"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),n?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,_.prototype.alignDataLabel.apply(this,arguments)}bindAxes(){E.prototype.bindAxes.apply(this,arguments),(0,a.extend)(this.xAxis.options,{gridLineWidth:0,lineWidth:0,title:void 0,tickPositions:[]}),(0,a.merge)(!0,this.yAxis.options,{gridLineWidth:0,title:void 0,labels:{enabled:!1}})}translate(){E.prototype.translate.apply(this,arguments);let t=this.chart,e=this.options,r=e.reversed,i=e.ignoreHiddenPoint,s=t.plotWidth,o=t.plotHeight,n=e.center,h=(0,a.relativeLength)(n[0],s),d=(0,a.relativeLength)(n[1],o),l=(0,a.relativeLength)(e.width,s),p=(0,a.relativeLength)(e.height,o),g=(0,a.relativeLength)(e.neckWidth,s),c=(0,a.relativeLength)(e.neckHeight,o),f=d-p/2+p-c,u=this.points,y=0,x=0,m,w,b,S,z,A,k,L,v;for(let t of(this.getWidthAt=w=function(t){return t>f||p===c?g:g+(l-g)*(1-(t-(d-p/2))/(p-c))},this.center=[h,d,p],this.centerX=h,u))i&&!1===t.visible||(y+=t.y);for(let s of u)k=null,b=y?s.y/y:0,A=(z=d-p/2+x*p)+b*p,m=w(z),L=A-z,(v={gradientForSides:(0,a.pick)(s.options.gradientForSides,e.gradientForSides),x:h,y:z,height:L,width:m,z:1,top:{width:m}}).bottom={fraction:b,width:m=w(A)},z>=f?v.isCylinder=!0:A>f&&(k=A,m=w(f),A=f,v.bottom.width=m,v.middle={fraction:L?(f-z)/L:0,width:m}),r&&(v.y=z=d+p/2-(x+b)*p,v.middle&&(v.middle.fraction=1-(L?v.middle.fraction:0)),m=v.width,v.width=v.bottom.width,v.bottom.width=m),s.shapeArgs=(0,a.extend)(s.shapeArgs,v),s.percentage=100*b,s.plotX=h,r?s.plotY=d+p/2-(x+b/2)*p:s.plotY=(z+(k||A))/2,S=B([{x:h,y:s.plotY,z:r?-(l-w(s.plotY))/2:-w(s.plotY)/2}],t,!0)[0],s.tooltipPos=[S.x,S.y],s.dlBoxRaw={x:h,width:w(s.plotY),y:z,bottom:v.height||0,fullWidth:l},i&&!1===s.visible||(x+=b)}}O.compose=function(t){let e=t.prototype;e.funnel3d||(e.Element3D.types.funnel3d=z,(0,a.extend)(e,{funnel3d:k,funnel3dPath:L}))},O.defaultOptions=(0,a.merge)(_.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"}}),(0,a.extend)(O.prototype,{pointClass:P,translate3dShapes:I}),C().registerSeriesType("funnel3d",O),O.compose(g());let j=l();return d.default})());