highcharts
Version:
JavaScript charting framework
13 lines • 5.42 kB
JavaScript
!/**
* Highcharts JS v12.6.0 (2026-04-13)
* @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 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 a=i[t]={exports:{}};return r[t](a,a.exports,n),a.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 a={};n.d(a,{default:()=>M});var o=n(944),s=n.n(o),l=n(512),h=n.n(l);let{doc:c,win:p}=s();function f(t,e){let r;for(r in t||(t={}),e)t[r]=e[r];return t}function u(t){return d(t)&&"number"==typeof t.nodeType}function d(t,e){let r;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(r=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==r)}function g(){let t=arguments,e=t.length;for(let r=0;r<e;r++){let e=t[r];if(null!=e)return e}}Array.prototype.find;let{pie:y}=h().seriesTypes;class v extends y{calculateExtremes(){var t,e,r;let i,n,a=this.chart,o=a.plotWidth,s=a.plotHeight,l=this.options,h=2*(l.slicedOffset||0),c=this.getColumn("z"),p=Math.min(o,s)-h,f={},u=this.center||this.getCenter();for(let t of["minPointSize","maxPointSize"]){let e=l[t],r=/%$/.test(e);e=parseInt(e,10),f[t]=r?p*e/100:2*e}this.minPxSize=u[3]+f.minPointSize,this.maxPxSize=(t=u[2],e=u[3]+f.minPointSize,r=f.maxPointSize,t>e?t<r?t:r:e),c.length&&(i=g(l.zMin,function(t){let e=t.length,r=t[0];for(;e--;)t[e]<r&&(r=t[e]);return r}(c.filter(this.zValEval))),n=g(l.zMax,function(t){let e=t.length,r=t[0];for(;e--;)t[e]>r&&(r=t[e]);return r}(c.filter(this.zValEval))),this.getRadii(i,n,this.minPxSize,this.maxPxSize))}getRadii(t,e,r,i){let n,a,o,s=this.getColumn("z"),l=[],h="radius"!==this.options.sizeBy,c=e-t;for(let p=0;p<s.length;p++)(a=this.zValEval(s[p])?s[p]:t)<=t?o=r/2:a>=e?o=i/2:(n=c>0?(a-t)/c:.5,h&&(n=Math.sqrt(n)),o=Math.ceil(r+n*(i-r))/2),l.push(o);this.radii=l}redraw(){this.center=null,super.redraw()}getDataLabelPosition(t,e){let{center:r,options:i}=this,n=t.angle||0,a=this.radii[t.index],o=r[0]+Math.cos(n)*a,s=r[1]+Math.sin(n)*a,l=Math.min((i.slicedOffset||0)+(i.borderWidth||0),e/5);return{distance:e,natural:{x:o+Math.cos(n)*e,y:s+Math.sin(n)*e},computed:{},alignment:t.half?"right":"left",connectorPosition:{breakAt:{x:o+Math.cos(n)*l,y:s+Math.sin(n)*l},touchingSliceAt:{x:o,y:s}}}}translate(t){this.generatePoints();let e=this.options,r=e.slicedOffset,i=e.startAngle||0,n=Math.PI/180*(i-90),a=Math.PI/180*(g(e.endAngle,i+360)-90),o=a-n,l=this.points,h=e.ignoreHiddenPoint,p=0,u,d,y,v,M,m,P;this.startAngleRad=n,this.endAngleRad=a,this.calculateExtremes(),t||(this.center=t=this.getCenter());for(let e=0;e<l.length;e++)m=l[e],P=this.radii[e],u=n+p*o,(!h||m.visible)&&(p+=m.percentage/100),d=n+p*o,m.shapeType="arc",m.shapeArgs={x:t[0],y:t[1],r:P,innerR:t[3]/2,start:Math.round(1e3*u)/1e3,end:Math.round(1e3*d)/1e3},(y=(d+u)/2)>1.5*Math.PI?y-=2*Math.PI:y<-Math.PI/2&&(y+=2*Math.PI),m.slicedTranslation={translateX:Math.round(Math.cos(y)*r),translateY:Math.round(Math.sin(y)*r)},v=Math.cos(y)*t[2]/2,M=Math.sin(y)*t[2]/2,m.tooltipPos=[t[0]+.7*v,t[1]+.7*M],m.half=+(y<-Math.PI/2||y>Math.PI/2),m.angle=y;!function(t,e,r,i){if(r=r||{},c?.createEvent&&(t.dispatchEvent||t.fireEvent&&t!==s())){let i=c.createEvent("Events");i.initEvent(e,!0,!0),r=f(i,r),t.dispatchEvent?t.dispatchEvent(r):t.fireEvent(e,r)}else if(t.hcEvents){r.target||f(r,{preventDefault:function(){r.defaultPrevented=!0},target:t,type:e});let i=[],n=t,a=!1;for(;n.hcEvents;)Object.hasOwnProperty.call(n,"hcEvents")&&n.hcEvents[e]&&(i.length&&(a=!0),i.unshift.apply(i,n.hcEvents[e])),n=Object.getPrototypeOf(n);a&&i.sort((t,e)=>t.order-e.order),i.forEach(e=>{!1===e.fn.call(t,r,t)&&r.preventDefault()})}}(this,"afterTranslate")}zValEval(t){return!("number"!=typeof t||isNaN(t))||null}}v.defaultOptions=function(t,...e){let r,i=[t,...e],n={},a=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 n;!d(r,!0)||(n=r?.constructor,d(r,!0)&&!u(r)&&n?.name&&"Object"!==n.name)||u(r)?t[i]=e[i]:t[i]=a(t[i]||{},r)}}),t};!0===t&&(n=i[1],i=Array.prototype.slice.call(i,2));let o=i.length;for(r=0;r<o;r++)n=a(n,i[r]);return n}(y.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/>'}}),f(v.prototype,{pointArrayMap:["y","z"],parallelArrays:["x","y","z"]}),h().registerSeriesType("variablepie",v);let M=s();return a.default})());