UNPKG

highcharts

Version:
13 lines 7.01 kB
!/** * Highcharts JS v12.6.0 (2026-04-13) * @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}},o={};function r(t){var e=o[t];if(void 0!==e)return e.exports;var s=o[t]={exports:{}};return i[t](s,s.exports,r),s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var s={};r.d(s,{default:()=>x});var n=r(944),a=r.n(n),l=r(512),h=r.n(l);let{doc:c,win:d}=a();function p(t,e){let i;for(i in t||(t={}),e)t[i]=e[i];return t}function f(t){return g(t)&&"number"==typeof t.nodeType}function u(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function g(t,e){let i;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(i=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==i)}function y(t,...e){let i,o=[t,...e],r={},s=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,i){for(let i in t)Object.hasOwnProperty.call(t,i)&&e.call((0,t[i]),t[i],i,t)}(e,function(i,o){if("__proto__"!==o&&"constructor"!==o){let r;!g(i,!0)||(r=i?.constructor,g(i,!0)&&!f(i)&&r?.name&&"Object"!==r.name)||f(i)?t[o]=e[o]:t[o]=s(t[o]||{},i)}}),t};!0===t&&(r=o[1],o=Array.prototype.slice.call(o,2));let n=o.length;for(i=0;i<n;i++)r=s(r,o[i]);return r}Array.prototype.find;let{series:{prototype:{pointClass:m}},seriesTypes:{pie:{prototype:{pointClass:v}}}}=h();class b extends v{}p(b.prototype,{haloPath:m.prototype.haloPath});let w={endAngle:void 0,innerSize:"40%",itemPadding:.1,layout:"vertical",marker:y({lineWidth:2,allowPointSelect:!1,crisp:!0,showCheckbox:!1,animation:{duration:1e3},enableMouseTracking:!0,events:{},marker:{enabledThreshold:2,lineColor:"#ffffff",lineWidth:0,radius:4,states:{normal:{animation:!0},hover:{animation:{duration:150},enabled:!0,radiusPlus:2,lineWidthPlus:1},select:{fillColor:"#cccccc",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:{animation:{},align:"center",borderWidth:0,defer:!0,formatter:function(){let{numberFormatter:t}=this.series.chart;return"number"!=typeof this.y?"":t(this.y,-1)},padding:5,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:A}=h().seriesTypes;class M extends A{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,o=this.borderWidth%2?.5:1,r=this.getRows(),s=Math.ceil(this.total/r),n=this.chart.plotWidth/s,a=this.chart.plotHeight/r,l=this.itemSize||Math.min(n,a),h=0;for(let c of this.points){let d,f,u,g,y,m,v=c.marker||{},b=v.symbol||i.symbol,w=function(){let t=arguments,e=t.length;for(let i=0;i<e;i++){let e=t[i];if(null!=e)return e}}(v.radius,i.radius),A=null!=w?2*w:l,M=A*t.itemPadding;if(c.graphics=f=c.graphics||[],this.chart.styledMode||(u=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();g=t.x-l/2,y=t.y-l/2}else"horizontal"===t.layout?(g=h%s*n,y=a*Math.floor(h/s)):(g=n*Math.floor(h/r),y=h%r*a);g+=M,y+=M,m=Math.round(A-2*M),this.options.crisp&&(g=Math.round(g)-o,y=Math.round(y)+o),d={x:g,y:y,width:m,height:m},void 0!==w&&(d.r=w),u&&p(d,u);let v=f[i];v?v.animate(d):v=e.symbol(b,void 0,void 0,void 0,void 0,{backgroundSize:"within"}).attr(d).add(c.graphic),v.isActive=!0,f[i]=v,++h}}for(let t=0;t<f.length;t++){let e=f[t];if(!e)return;e.isActive?e.isActive=!1:(e.destroy(),f.splice(t,1),t--)}}}getRows(){let t=this.chart,e=this.total||0,i=this.options.rows,o;if(!i)if(o=t.plotWidth/t.plotHeight,i=Math.sqrt(e),o>1)for(i=Math.ceil(i);i>1&&!(e/i/i>o);)i--;else for(i=Math.floor(i);i<e&&!(e/i/i<o);)i++;return i}getSlots(){let t=this.center,e=t[2],i=this.slots=this.slots||[],o=this.endAngleRad-this.startAngleRad,r=this.options.rows,s=o%(2*Math.PI)==0,n=this.total||0,a=t[3],l,h,c,d,p,f,u,g,y=0,m,v=Number.MAX_VALUE,b,w,A,M=(e-a)/e;for(;v>n+(w&&s?w.length:0);){b=v,i.length=0,v=0,w=A,A=[],m=e/++y/2,r?(a=(m-r)/m*e)>=0?m=r:(a=0,M=1):m=Math.floor(m*M);for(let t=m;t>0;t--)p=Math.ceil((d=o*(c=(a+t/m*(e-a-y))/2))/y),A.push({rowRadius:c,rowLength:d,colCount:p}),v+=p+1}if(!w)return;let x=b-this.total-(s?w.length:0),E=t=>{x>0&&(t.row.colCount--,x--)};for(;x>0;)w.map(t=>({angle:t.colCount/t.rowLength,row:t})).sort((t,e)=>e.angle-t.angle).slice(0,Math.min(x,Math.ceil(w.length/2))).forEach(E);for(let e of w){let r=e.rowRadius,s=e.colCount;for(g=0,f=s?o/s:0;g<=s;g+=1)u=this.startAngleRad+g*f,l=t[0]+Math.cos(u)*r,h=t[1]+Math.sin(u)*r,i.push({x:l,y:h,angle:u})}return i.sort((t,e)=>t.angle-e.angle),this.itemSize=y,i}translate(t){0===this.total&&u(this.options.startAngle)&&u(this.options.endAngle)&&(this.center=this.getCenter()),this.slots||(this.slots=[]),u(this.options.startAngle)&&u(this.options.endAngle)?(super.translate(t),this.slots=this.getSlots()):(this.generatePoints(),function(t,e,i,o){if(i=i||{},c?.createEvent&&(t.dispatchEvent||t.fireEvent&&t!==a())){let o=c.createEvent("Events");o.initEvent(e,!0,!0),i=p(o,i),t.dispatchEvent?t.dispatchEvent(i):t.fireEvent(e,i)}else if(t.hcEvents){i.target||p(i,{preventDefault:function(){i.defaultPrevented=!0},target:t,type:e});let o=[],r=t,s=!1;for(;r.hcEvents;)Object.hasOwnProperty.call(r,"hcEvents")&&r.hcEvents[e]&&(o.length&&(s=!0),o.unshift.apply(o,r.hcEvents[e])),r=Object.getPrototypeOf(r);s&&o.sort((t,e)=>t.order-e.order),o.forEach(e=>{!1===e.fn.call(t,i,t)&&i.preventDefault()})}}(this,"afterTranslate"))}}M.defaultOptions=y(A.defaultOptions,w),p(M.prototype,{markerAttribs:void 0,pointClass:b}),h().registerSeriesType("item",M);let x=a();return s.default})());