UNPKG

highcharts

Version:
13 lines 4.16 kB
!/** * Highcharts JS v13.0.1 (2026-08-17) * @module highcharts/modules/variable-pie * @requires highcharts * * Variable Pie module for Highcharts * * (c) 2010-2026 Highsoft AS * Author: Grzegorz Blachliński * * 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/variable-pie",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/variable-pie"]=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}};let r={};function a(t){let e=r[t];if(void 0!==e)return e.exports;let s=r[t]={exports:{}};return i[t](s,s.exports,a),s.exports}a.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{if(Array.isArray(e))for(var i=0;i<e.length;){var r=e[i++],s=e[i++];a.o(t,r)?0===s&&i++:0===s?Object.defineProperty(t,r,{enumerable:!0,value:e[i++]}):Object.defineProperty(t,r,{enumerable:!0,get:s})}else for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let s={};a.d(s,{default:()=>d});var n=a(944),o=a.n(n),h=a(512),l=a.n(h);let{pie:p}=l().seriesTypes;class c extends p{calculateExtremes(){let t,e,i=this.chart,r=i.plotWidth,a=i.plotHeight,s=this.options,o=2*(s.slicedOffset||0),h=[...this.getColumn("z",!1,!0)],l=Math.min(r,a)-o,p={},c=this.center||this.getCenter();for(let t of["minPointSize","maxPointSize"]){let e=s[t],i=/%$/.test(e);e=parseInt(e,10),p[t]=i?l*e/100:2*e}this.minPxSize=c[3]+p.minPointSize,this.maxPxSize=(0,n.clamp)(c[2],c[3]+p.minPointSize,p.maxPointSize),h.length&&(t=(0,n.pick)(s.zMin,(0,n.arrayMin)(h.filter(this.zValEval))),e=(0,n.pick)(s.zMax,(0,n.arrayMax)(h.filter(this.zValEval))),this.getRadii(t,e,this.minPxSize,this.maxPxSize))}getRadii(t,e,i,r){let a,s,n,o=[...this.getColumn("z",!1,!0)],h=[],l="radius"!==this.options.sizeBy,p=e-t;for(let c=0;c<o.length;c++)(s=this.zValEval(o[c])?o[c]:t)<=t?n=i/2:s>=e?n=r/2:(a=p>0?(s-t)/p:.5,l&&(a=Math.sqrt(a)),n=Math.ceil(i+a*(r-i))/2),h.push(n);this.radii=h}redraw(){this.center=null,super.redraw()}getDataLabelPosition(t,e){let{center:i,options:r}=this,a=t.angle||0,s=this.radii[t.index],n=i[0]+Math.cos(a)*s,o=i[1]+Math.sin(a)*s,h=Math.min((r.slicedOffset||0)+(r.borderWidth||0),e/5);return{distance:e,natural:{x:n+Math.cos(a)*e,y:o+Math.sin(a)*e},computed:{},alignment:t.half?"right":"left",connectorPosition:{breakAt:{x:n+Math.cos(a)*h,y:o+Math.sin(a)*h},touchingSliceAt:{x:n,y:o}}}}translate(t){this.generatePoints();let e=this.options,i=e.slicedOffset,r=e.startAngle||0,a=Math.PI/180*(r-90),s=Math.PI/180*((0,n.pick)(e.endAngle,r+360)-90),o=s-a,h=this.points,l=e.ignoreHiddenPoint,p=0,c,d,u,g,f,y,M;this.startAngleRad=a,this.endAngleRad=s,this.calculateExtremes(),t||(this.center=t=this.getCenter());for(let e=0;e<h.length;e++)y=h[e],M=this.radii[e],c=a+p*o,(!l||y.visible)&&(p+=y.percentage/100),d=a+p*o,y.shapeType="arc",y.shapeArgs={x:t[0],y:t[1],r:M,innerR:t[3]/2,start:Math.round(1e3*c)/1e3,end:Math.round(1e3*d)/1e3},(u=(d+c)/2)>1.5*Math.PI?u-=2*Math.PI:u<-Math.PI/2&&(u+=2*Math.PI),y.slicedTranslation={translateX:Math.round(Math.cos(u)*i),translateY:Math.round(Math.sin(u)*i)},g=Math.cos(u)*t[2]/2,f=Math.sin(u)*t[2]/2,y.tooltipPos=[t[0]+.7*g,t[1]+.7*f],y.half=+(u<-Math.PI/2||u>Math.PI/2),y.angle=u;(0,n.fireEvent)(this,"afterTranslate")}zValEval(t){return!("number"!=typeof t||isNaN(t))||null}}c.defaultOptions=(0,n.merge)(p.defaultOptions,{minPointSize:"10%",maxPointSize:"100%",zMin:void 0,zMax:void 0,sizeBy:"area",tooltip:{pointFormat:'<span style="color:{point.color}">●</span> {series.name}<br/>Value: {point.y}<br/>Size: {point.z}<br/>'}}),(0,n.extend)(c.prototype,{pointArrayMap:["y","z"],parallelArrays:["x","y","z"]}),l().registerSeriesType("variablepie",c);let d=o();return s.default})());