highcharts
Version:
JavaScript charting framework
13 lines • 5.97 kB
JavaScript
!/**
* Highcharts JS v13.0.1 (2026-08-17)
* @module highcharts/modules/item-series
* @requires highcharts
*
* Item series type for Highcharts
*
* (c) 2019-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/item-series",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/item-series"]=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 s(t){let e=r[t];if(void 0!==e)return e.exports;let o=r[t]={exports:{}};return i[t](o,o.exports,s),o.exports}s.n=t=>{let e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{if(Array.isArray(e))for(var i=0;i<e.length;){var r=e[i++],o=e[i++];s.o(t,r)?0===o&&i++:0===o?Object.defineProperty(t,r,{enumerable:!0,value:e[i++]}):Object.defineProperty(t,r,{enumerable:!0,get:o})}else 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);let o={};s.d(o,{default:()=>m});var a=s(944),n=s.n(a),l=s(512),h=s.n(l);let{series:{prototype:{pointClass:d}},seriesTypes:{pie:{prototype:{pointClass:c}}}}=h();class p extends c{}(0,a.extend)(p.prototype,{haloPath:d.prototype.haloPath});let u={endAngle:void 0,innerSize:"40%",itemPadding:.1,layout:"vertical",marker:(0,a.merge)({lineWidth:2,allowPointSelect:!1,crisp:!0,showCheckbox:!1,animation:{duration:1e3},enableMouseTracking:!0,events:{},marker:{enabledThreshold:2,lineColor:"var(--highcharts-background-color)",lineWidth:0,radius:4,states:{normal:{animation:!0},hover:{animation:{duration:150},enabled:!0,radiusPlus:2,lineWidthPlus:1},select:{fillColor:"var(--highcharts-neutral-color-20)",lineColor:"var(--highcharts-neutral-color-100)",lineWidth:2}}},point:{events:{}},dataLabels:{animation:{},align:"center",borderWidth:0,defer:!0,distance:4,formatter:function(){let{numberFormatter:t}=this.series.chart;return"number"!=typeof this.y?"":t(this.y,-1)},padding:[1,3],style:{fontSize:"0.7em",fontWeight:"bold",color:"contrast",textOutline:"1px contrast"},verticalAlign:"bottom",x:0,y:0},cropThreshold:300,opacity:1,pointRange:0,softThreshold:!0,states:{normal:{animation:!0},hover:{animation:{duration:150},lineWidthPlus:1,marker:{},halo:{size:10,opacity:.25}},select:{animation:{duration:0}},inactive:{animation:{duration:150},opacity:.2}},stickyTracking:!0,turboThreshold:1e3,findNearestPointBy:"x"}.marker,{radius:null}),rows:void 0,crisp:!1,showInLegend:!0,startAngle:void 0},{pie:g}=h().seriesTypes;class f extends g{animate(t){let e=this.group;e&&(t?e.attr({opacity:0}):e.animate({opacity:1},this.options.animation))}drawDataLabels(){if(this.center&&this.slots)super.drawDataLabels();else for(let t of this.points)t.destroyElements({dataLabel:1})}drawPoints(){let t=this.options,e=this.chart.renderer,i=t.marker,r=this.borderWidth%2?.5:1,s=this.getRows(),o=Math.ceil(this.total/s),n=this.chart.plotWidth/o,l=this.chart.plotHeight/s,h=this.itemSize||Math.min(n,l),d=0;for(let c of this.points){let p,u,g,f,m,y,b=c.marker||{},v=b.symbol||i.symbol,w=(0,a.pick)(b.radius,i.radius),x=(0,a.defined)(w)?2*w:h,M=x*t.itemPadding;if(c.graphics=u=c.graphics||[],this.chart.styledMode||(g=this.pointAttribs(c,c.selected&&"select")),!c.isNull&&c.visible){c.graphic||(c.graphic=e.g("point").add(this.group));for(let i=0;i<(c.y||0);++i){if(this.center&&this.slots){let t=this.slots.shift();f=t.x-h/2,m=t.y-h/2}else"horizontal"===t.layout?(f=d%o*n,m=l*Math.floor(d/o)):(f=n*Math.floor(d/s),m=d%s*l);f+=M,m+=M,y=Math.round(x-2*M),this.options.crisp&&(f=Math.round(f)-r,m=Math.round(m)+r),p={x:f,y:m,width:y,height:y},void 0!==w&&(p.r=w),g&&(0,a.extend)(p,g);let b=u[i];b?b.animate(p):b=e.symbol(v,void 0,void 0,void 0,void 0,{backgroundSize:"within"}).attr(p).add(c.graphic),b.isActive=!0,u[i]=b,++d}}for(let t=0;t<u.length;t++){let e=u[t];if(!e)return;e.isActive?e.isActive=!1:(e.destroy(),u.splice(t,1),t--)}}}getRows(){let t=this.chart,e=this.total||0,i=this.options.rows,r;if(!i)if(r=t.plotWidth/t.plotHeight,i=Math.sqrt(e),r>1)for(i=Math.ceil(i);i>1&&!(e/i/i>r);)i--;else for(i=Math.floor(i);i<e&&!(e/i/i<r);)i++;return i}getSlots(){let t=this.center,e=t[2],i=this.slots=this.slots||[],r=this.endAngleRad-this.startAngleRad,s=this.options.rows,o=r%(2*Math.PI)==0,a=this.total||0,n=t[3],l,h,d,c,p,u,g,f,m=0,y,b=Number.MAX_VALUE,v,w,x,M=(e-n)/e;for(;b>a+(w&&o?w.length:0);){v=b,i.length=0,b=0,w=x,x=[],y=e/++m/2,s?(n=(y-s)/y*e)>=0?y=s:(n=0,M=1):y=Math.floor(y*M);for(let t=y;t>0;t--)p=Math.ceil((c=r*(d=(n+t/y*(e-n-m))/2))/m),x.push({rowRadius:d,rowLength:c,colCount:p}),b+=p+1}if(!w)return;let A=v-this.total-(o?w.length:0),P=t=>{A>0&&(t.row.colCount--,A--)};for(;A>0;)w.map(t=>({angle:t.colCount/t.rowLength,row:t})).sort((t,e)=>e.angle-t.angle).slice(0,Math.min(A,Math.ceil(w.length/2))).forEach(P);for(let e of w){let s=e.rowRadius,o=e.colCount;for(f=0,u=o?r/o:0;f<=o;f+=1)g=this.startAngleRad+f*u,l=t[0]+Math.cos(g)*s,h=t[1]+Math.sin(g)*s,i.push({x:l,y:h,angle:g})}return i.sort((t,e)=>t.angle-e.angle),this.itemSize=m,i}translate(t){0===this.total&&(0,a.isNumber)(this.options.startAngle)&&(0,a.isNumber)(this.options.endAngle)&&(this.center=this.getCenter()),this.slots||(this.slots=[]),(0,a.isNumber)(this.options.startAngle)&&(0,a.isNumber)(this.options.endAngle)?(super.translate(t),this.slots=this.getSlots()):(this.generatePoints(),(0,a.fireEvent)(this,"afterTranslate"))}}f.defaultOptions=(0,a.merge)(g.defaultOptions,u),(0,a.extend)(f.prototype,{markerAttribs:void 0,pointClass:p}),h().registerSeriesType("item",f);let m=n();return o.default})());