sunburst.js 20 KB
/*
 Highcharts JS v6.2.0 (2018-10-17)

 (c) 2016 Highsoft AS
 Authors: Jon Arild Nygard

 License: www.highcharts.com/license
*/
(function(F){"object"===typeof module&&module.exports?module.exports=F:"function"===typeof define&&define.amd?define(function(){return F}):F(Highcharts)})(function(F){var P=function(){return function(c){var t=this,f=t.graphic,y=c.animate,e=c.attr,w=c.onComplete,J=c.css,E=c.group,r=c.renderer,z=c.shapeArgs;c=c.shapeType;t.shouldDraw()?(f||(t.graphic=f=r[c](z).add(E)),f.css(J).attr(e).animate(y,void 0,w)):f&&f.animate(y,void 0,function(){t.graphic=f=f.destroy();"function"===typeof w&&w()});f&&f.addClass(t.getClassName(),
!0)}}(),M=function(c){var t=c.each,f=c.extend,y=c.isArray,e=c.isObject,w=c.isNumber,J=c.merge,E=c.pick,r=c.reduce;return{getColor:function(z,v){var x=v.index,m=v.mapOptionsToLevel,f=v.parentColor,w=v.parentColorIndex,r=v.series,l=v.colors,H=v.siblings,C=r.points,e,y,t,A;if(z){C=C[z.i];z=m[z.level]||{};if(e=C&&z.colorByPoint)t=C.index%(l?l.length:r.chart.options.chart.colorCount),y=l&&l[t];l=C&&C.options.color;e=z&&z.color;if(m=f)m=(m=z&&z.colorVariation)&&"brightness"===m.key?c.color(f).brighten(x/
H*m.to).get():f;e=E(l,e,y,m,r.color);A=E(C&&C.options.colorIndex,z&&z.colorIndex,t,w,v.colorIndex)}return{color:e,colorIndex:A}},getLevelOptions:function(c){var v=null,x,m,G,t;if(e(c))for(v={},G=w(c.from)?c.from:1,t=c.levels,m={},x=e(c.defaults)?c.defaults:{},y(t)&&(m=r(t,function(c,l){var m,v;e(l)&&w(l.level)&&(v=J({},l),m="boolean"===typeof v.levelIsConstant?v.levelIsConstant:x.levelIsConstant,delete v.levelIsConstant,delete v.level,l=l.level+(m?0:G-1),e(c[l])?f(c[l],v):c[l]=v);return c},{})),t=
w(c.to)?c.to:1,c=0;c<=t;c++)v[c]=J({},x,e(m[c])?m[c]:{});return v},setTreeValues:function v(c,m){var r=m.before,e=m.idRoot,w=m.mapIdToNode[e],l=m.points[c.i],x=l&&l.options||{},C=0,y=[];f(c,{levelDynamic:c.level-(("boolean"===typeof m.levelIsConstant?m.levelIsConstant:1)?0:w.level),name:E(l&&l.name,""),visible:e===c.id||("boolean"===typeof m.visible?m.visible:!1)});"function"===typeof r&&(c=r(c,m));t(c.children,function(l,r){var e=f({},m);f(e,{index:r,siblings:c.children.length,visible:c.visible});
l=v(l,e);y.push(l);l.visible&&(C+=l.val)});c.visible=0<C||c.visible;r=E(x.value,C);f(c,{children:y,childrenTotal:C,isLeaf:c.visible&&!C,val:r});return c},updateRootId:function(c){var r;e(c)&&(r=e(c.options)?c.options:{},r=E(c.rootNode,r.rootId,""),e(c.userOptions)&&(c.userOptions.rootId=r),c.rootNode=r);return r}}}(F);(function(c,t){var f=c.seriesType,y=c.seriesTypes,e=c.map,w=c.merge,J=c.extend,E=c.noop,r=c.each,z=t.getColor,v=t.getLevelOptions,x=c.grep,m=c.isArray,G=c.isNumber,I=c.isObject,F=c.isString,
l=c.pick,H=c.Series,C=c.stableSort,K=c.Color,O=function(a,b,d){d=d||this;c.objectEach(a,function(p,c){b.call(d,p,c,a)})},L=c.reduce,A=function(a,b,d){d=d||this;a=b.call(d,a);!1!==a&&A(a,b,d)},N=t.updateRootId;f("treemap","scatter",{showInLegend:!1,marker:!1,colorByPoint:!1,dataLabels:{enabled:!0,defer:!1,verticalAlign:"middle",formatter:function(){return this.point.name||this.point.id},inside:!0},tooltip:{headerFormat:"",pointFormat:"\x3cb\x3e{point.name}\x3c/b\x3e: {point.value}\x3cbr/\x3e"},ignoreHiddenPoint:!0,
layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,drillUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,opacity:.15,states:{hover:{borderColor:"#999999",brightness:y.heatmap?0:.1,halo:!1,opacity:.75,shadow:!1}}},{pointArrayMap:["value"],directTouch:!0,optionalAxis:"colorAxis",getSymbol:E,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",trackerGroups:["group","dataLabelsGroup"],getListOfParents:function(a,
b){a=m(a)?a:[];var d=m(b)?b:[];b=L(a,function(b,a,d){a=l(a.parent,"");void 0===b[a]&&(b[a]=[]);b[a].push(d);return b},{"":[]});O(b,function(b,a,q){""!==a&&-1===c.inArray(a,d)&&(r(b,function(b){q[""].push(b)}),delete q[a])});return b},getTree:function(){var a=e(this.data,function(b){return b.id}),a=this.getListOfParents(this.data,a);this.nodeMap=[];return this.buildNode("",-1,0,a,null)},init:function(a,b){var d=c.colorSeriesMixin;c.colorSeriesMixin&&(this.translateColors=d.translateColors,this.colorAttribs=
d.colorAttribs,this.axisTypes=d.axisTypes);H.prototype.init.call(this,a,b);this.options.allowDrillToNode&&c.addEvent(this,"click",this.onClickDrillToNode)},buildNode:function(a,b,d,c,h){var p=this,g=[],k=p.points[b],u=0,n;r(c[a]||[],function(b){n=p.buildNode(p.points[b].id,b,d+1,c,a);u=Math.max(n.height+1,u);g.push(n)});b={id:a,i:b,children:g,height:u,level:d,parent:h,visible:!1};p.nodeMap[b.id]=b;k&&(k.node=b);return b},setTreeValues:function(a){var b=this,d=b.options,c=b.nodeMap[b.rootNode],d="boolean"===
typeof d.levelIsConstant?d.levelIsConstant:!0,h=0,q=[],g,k=b.points[a.i];r(a.children,function(a){a=b.setTreeValues(a);q.push(a);a.ignore||(h+=a.val)});C(q,function(b,a){return b.sortIndex-a.sortIndex});g=l(k&&k.options.value,h);k&&(k.value=g);J(a,{children:q,childrenTotal:h,ignore:!(l(k&&k.visible,!0)&&0<g),isLeaf:a.visible&&!h,levelDynamic:a.level-(d?0:c.level),name:l(k&&k.name,""),sortIndex:l(k&&k.sortIndex,-g),val:g});return a},calculateChildrenAreas:function(a,b){var d=this,c=d.options,h=d.mapOptionsToLevel[a.level+
1],q=l(d[h&&h.layoutAlgorithm]&&h.layoutAlgorithm,c.layoutAlgorithm),g=c.alternateStartingDirection,k=[];a=x(a.children,function(b){return!b.ignore});h&&h.layoutStartingDirection&&(b.direction="vertical"===h.layoutStartingDirection?0:1);k=d[q](b,a);r(a,function(a,c){c=k[c];a.values=w(c,{val:a.childrenTotal,direction:g?1-b.direction:b.direction});a.pointValues=w(c,{x:c.x/d.axisRatio,width:c.width/d.axisRatio});a.children.length&&d.calculateChildrenAreas(a,a.values)})},setPointValues:function(){var a=
this,b=a.xAxis,d=a.yAxis;r(a.points,function(c){var p=c.node,q=p.pointValues,g,k,u;u=(a.pointAttribs(c)["stroke-width"]||0)%2/2;q&&p.visible?(p=Math.round(b.translate(q.x,0,0,0,1))-u,g=Math.round(b.translate(q.x+q.width,0,0,0,1))-u,k=Math.round(d.translate(q.y,0,0,0,1))-u,q=Math.round(d.translate(q.y+q.height,0,0,0,1))-u,c.shapeType="rect",c.shapeArgs={x:Math.min(p,g),y:Math.min(k,q),width:Math.abs(g-p),height:Math.abs(q-k)},c.plotX=c.shapeArgs.x+c.shapeArgs.width/2,c.plotY=c.shapeArgs.y+c.shapeArgs.height/
2):(delete c.plotX,delete c.plotY)})},setColorRecursive:function(a,b,d,c,h){var p=this,g=p&&p.chart,g=g&&g.options&&g.options.colors,k;if(a){k=z(a,{colors:g,index:c,mapOptionsToLevel:p.mapOptionsToLevel,parentColor:b,parentColorIndex:d,series:p,siblings:h});if(b=p.points[a.i])b.color=k.color,b.colorIndex=k.colorIndex;r(a.children||[],function(b,d){p.setColorRecursive(b,k.color,k.colorIndex,d,a.children.length)})}},algorithmGroup:function(a,b,d,c){this.height=a;this.width=b;this.plot=c;this.startDirection=
this.direction=d;this.lH=this.nH=this.lW=this.nW=this.total=0;this.elArr=[];this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(b,a){return Math.max(b/a,a/b)}};this.addElement=function(b){this.lP.total=this.elArr[this.elArr.length-1];this.total+=b;0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=
this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH));this.elArr.push(b)};this.reset=function(){this.lW=this.nW=0;this.elArr=[];this.total=0}},algorithmCalcPoints:function(a,b,d,c){var p,q,g,k,u=d.lW,n=d.lH,B=d.plot,l,m=0,e=d.elArr.length-1;b?(u=d.nW,n=d.nH):l=d.elArr[d.elArr.length-1];r(d.elArr,function(a){if(b||m<e)0===d.direction?(p=B.x,q=B.y,
g=u,k=a/g):(p=B.x,q=B.y,k=n,g=a/k),c.push({x:p,y:q,width:g,height:k}),0===d.direction?B.y+=k:B.x+=g;m+=1});d.reset();0===d.direction?d.width-=u:d.height-=n;B.y=B.parent.y+(B.parent.height-d.height);B.x=B.parent.x+(B.parent.width-d.width);a&&(d.direction=1-d.direction);b||d.addElement(l)},algorithmLowAspectRatio:function(a,b,d){var c=[],h=this,q,g={x:b.x,y:b.y,parent:b},k=0,l=d.length-1,n=new this.algorithmGroup(b.height,b.width,b.direction,g);r(d,function(d){q=d.val/b.val*b.height*b.width;n.addElement(q);
n.lP.nR>n.lP.lR&&h.algorithmCalcPoints(a,!1,n,c,g);k===l&&h.algorithmCalcPoints(a,!0,n,c,g);k+=1});return c},algorithmFill:function(a,b,d){var c=[],h,q=b.direction,g=b.x,k=b.y,l=b.width,n=b.height,B,m,e,f;r(d,function(d){h=d.val/b.val*b.height*b.width;B=g;m=k;0===q?(f=n,e=h/f,l-=e,g+=e):(e=l,f=h/e,n-=f,k+=f);c.push({x:B,y:m,width:e,height:f});a&&(q=1-q)});return c},strip:function(a,b){return this.algorithmLowAspectRatio(!1,a,b)},squarified:function(a,b){return this.algorithmLowAspectRatio(!0,a,b)},
sliceAndDice:function(a,b){return this.algorithmFill(!0,a,b)},stripes:function(a,b){return this.algorithmFill(!1,a,b)},translate:function(){var a=this,b=a.options,d=N(a),c,h;H.prototype.translate.call(a);h=a.tree=a.getTree();c=a.nodeMap[d];a.mapOptionsToLevel=v({from:c.level+1,levels:b.levels,to:h.height,defaults:{levelIsConstant:a.options.levelIsConstant,colorByPoint:b.colorByPoint}});""===d||c&&c.children.length||(a.drillToNode("",!1),d=a.rootNode,c=a.nodeMap[d]);A(a.nodeMap[a.rootNode],function(b){var d=
!1,c=b.parent;b.visible=!0;if(c||""===c)d=a.nodeMap[c];return d});A(a.nodeMap[a.rootNode].children,function(b){var a=!1;r(b,function(b){b.visible=!0;b.children.length&&(a=(a||[]).concat(b.children))});return a});a.setTreeValues(h);a.axisRatio=a.xAxis.len/a.yAxis.len;a.nodeMap[""].pointValues=d={x:0,y:0,width:100,height:100};a.nodeMap[""].values=d=w(d,{width:d.width*a.axisRatio,direction:"vertical"===b.layoutStartingDirection?0:1,val:h.val});a.calculateChildrenAreas(h,d);a.colorAxis?a.translateColors():
b.colorByPoint||a.setColorRecursive(a.tree);b.allowDrillToNode&&(b=c.pointValues,a.xAxis.setExtremes(b.x,b.x+b.width,!1),a.yAxis.setExtremes(b.y,b.y+b.height,!1),a.xAxis.setScale(),a.yAxis.setScale());a.setPointValues()},drawDataLabels:function(){var a=this,b=a.mapOptionsToLevel,c=x(a.points,function(b){return b.node.visible}),p,h;r(c,function(c){h=b[c.node.level];p={style:{}};c.node.isLeaf||(p.enabled=!1);h&&h.dataLabels&&(p=w(p,h.dataLabels),a._hasPointLabels=!0);c.shapeArgs&&(p.style.width=c.shapeArgs.width,
c.dataLabel&&c.dataLabel.css({width:c.shapeArgs.width+"px"}));c.dlOptions=w(p,c.options.dataLabels)});H.prototype.drawDataLabels.call(this)},alignDataLabel:function(a){y.column.prototype.alignDataLabel.apply(this,arguments);a.dataLabel&&a.dataLabel.attr({zIndex:(a.node.zIndex||0)+1})},pointAttribs:function(a,b){var c=I(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},p=a&&c[a.node.level]||{},c=this.options,h=b&&c.states[b]||{},q=a&&a.getClassName()||"";a={stroke:a&&a.borderColor||p.borderColor||
h.borderColor||c.borderColor,"stroke-width":l(a&&a.borderWidth,p.borderWidth,h.borderWidth,c.borderWidth),dashstyle:a&&a.borderDashStyle||p.borderDashStyle||h.borderDashStyle||c.borderDashStyle,fill:a&&a.color||this.color};-1!==q.indexOf("highcharts-above-level")?(a.fill="none",a["stroke-width"]=0):-1!==q.indexOf("highcharts-internal-node-interactive")?(b=l(h.opacity,c.opacity),a.fill=K(a.fill).setOpacity(b).get(),a.cursor="pointer"):-1!==q.indexOf("highcharts-internal-node")?a.fill="none":b&&(a.fill=
K(a.fill).brighten(h.brightness).get());return a},drawPoints:function(){var a=this,b=x(a.points,function(b){return b.node.visible});r(b,function(b){var c="level-group-"+b.node.levelDynamic;a[c]||(a[c]=a.chart.renderer.g(c).attr({zIndex:1E3-b.node.levelDynamic}).add(a.group));b.group=a[c]});y.column.prototype.drawPoints.call(this);a.options.allowDrillToNode&&r(b,function(b){b.graphic&&(b.drillId=a.options.interactByLeaf?a.drillToByLeaf(b):a.drillToByGroup(b))})},onClickDrillToNode:function(a){var b=
(a=a.point)&&a.drillId;F(b)&&(a.setState(""),this.drillToNode(b))},drillToByGroup:function(a){var b=!1;1!==a.node.level-this.nodeMap[this.rootNode].level||a.node.isLeaf||(b=a.id);return b},drillToByLeaf:function(a){var b=!1;if(a.node.parent!==this.rootNode&&a.node.isLeaf)for(a=a.node;!b;)a=this.nodeMap[a.parent],a.parent===this.rootNode&&(b=a.id);return b},drillUp:function(){var a=this.nodeMap[this.rootNode];a&&F(a.parent)&&this.drillToNode(a.parent)},drillToNode:function(a,b){var c=this.nodeMap[a];
this.idPreviousRoot=this.rootNode;this.rootNode=a;""===a?this.drillUpButton=this.drillUpButton.destroy():this.showDrillUpButton(c&&c.name||a);this.isDirty=!0;l(b,!0)&&this.chart.redraw()},showDrillUpButton:function(a){var b=this;a=a||"\x3c Back";var c=b.options.drillUpButton,p,h;c.text&&(a=c.text);this.drillUpButton?(this.drillUpButton.placed=!1,this.drillUpButton.attr({text:a}).align()):(h=(p=c.theme)&&p.states,this.drillUpButton=this.chart.renderer.button(a,null,null,function(){b.drillUp()},p,h&&
h.hover,h&&h.select).addClass("highcharts-drillup-button").attr({align:c.position.align,zIndex:7}).add().align(c.position,!1,c.relativeTo||"plotBox"))},buildKDTree:E,drawLegendSymbol:c.LegendSymbolMixin.drawRectangle,getExtremes:function(){H.prototype.getExtremes.call(this,this.colorValueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;H.prototype.getExtremes.call(this)},getExtremesFromAll:!0,bindAxes:function(){var a={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,
max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};H.prototype.bindAxes.call(this);c.extend(this.yAxis.options,a);c.extend(this.xAxis.options,a)},utils:{recursive:A,reduce:L}},{getClassName:function(){var a=c.Point.prototype.getClassName.call(this),b=this.series,d=b.options;this.node.level<=b.nodeMap[b.rootNode].level?a+=" highcharts-above-level":this.node.isLeaf||l(d.interactByLeaf,!d.allowDrillToNode)?this.node.isLeaf||(a+=" highcharts-internal-node"):a+=" highcharts-internal-node-interactive";
return a},isValid:function(){return this.id||G(this.value)},setState:function(a){c.Point.prototype.setState.call(this,a);this.graphic&&this.graphic.attr({zIndex:"hover"===a?1:0})},setVisible:y.pie.prototype.pointClass.prototype.setVisible})})(F,M);(function(c,t,f){var y=c.CenteredSeriesMixin,e=c.Series,w=c.each,F=c.extend,E=y.getCenter,r=f.getColor,z=f.getLevelOptions,v=y.getStartAndEndRadians,x=c.grep,m=c.inArray,G=c.isNumber,I=c.isObject,M=c.isString,l=c.keys,H=c.merge,C=180/Math.PI,y=c.seriesType,
K=f.setTreeValues,O=c.reduce,L=f.updateRootId,A=function(b,a){var c=[];if(G(b)&&G(a)&&b<=a)for(;b<=a;b++)c.push(b);return c},N=function(b,a){var c;a=I(a)?a:{};var d=0,q,g,k,e;I(b)&&(c=H({},b),b=G(a.from)?a.from:0,e=G(a.to)?a.to:0,g=A(b,e),b=x(l(c),function(b){return-1===m(+b,g)}),q=k=G(a.diffRadius)?a.diffRadius:0,w(g,function(b){b=c[b];var a=b.levelSize.unit,g=b.levelSize.value;"weight"===a?d+=g:"percentage"===a?(b.levelSize={unit:"pixels",value:g/100*q},k-=b.levelSize.value):"pixels"===a&&(k-=g)}),
w(g,function(b){var a=c[b];"weight"===a.levelSize.unit&&(a=a.levelSize.value,c[b].levelSize={unit:"pixels",value:a/d*k})}),w(b,function(b){c[b].levelSize={value:0,unit:"pixels"}}));return c},a=function(b,a){var c=a.mapIdToNode[b.parent],d=a.series,q=d.chart,g=d.points[b.i],c=r(b,{colors:q&&q.options&&q.options.colors,colorIndex:d.colorIndex,index:a.index,mapOptionsToLevel:a.mapOptionsToLevel,parentColor:c&&c.color,parentColorIndex:c&&c.colorIndex,series:a.series,siblings:a.siblings});b.color=c.color;
b.colorIndex=c.colorIndex;g&&(g.color=b.color,g.colorIndex=b.colorIndex,b.sliced=b.id!==a.idRoot?g.sliced:!1);return b};y("sunburst","treemap",{center:["50%","50%"],colorByPoint:!1,dataLabels:{allowOverlap:!0,defer:!0,style:{textOverflow:"ellipsis"},rotationMode:"auto"},rootId:void 0,levelIsConstant:!0,levelSize:{value:1,unit:"weight"},slicedOffset:10},{drawDataLabels:c.noop,drawPoints:function(){var b=this,a=b.mapOptionsToLevel,c=b.shapeRoot,h=b.group,q=b.hasRendered,g=b.rootNode,k=b.idPreviousRoot,
l=b.nodeMap,n=l[k],r=n&&n.shapeArgs,n=b.points,m=b.startAndEndRadians,f=b.chart,f=f&&f.options&&f.options.chart||{},v="boolean"===typeof f.animation?f.animation:!0,t=b.center[3]/2,y=b.chart.renderer,z,x=!1,E=!1;if(f=!!(v&&q&&g!==k&&b.dataLabelsGroup))b.dataLabelsGroup.attr({opacity:0}),z=function(){x=!0;b.dataLabelsGroup&&b.dataLabelsGroup.animate({opacity:1,visibility:"visible"})};w(n,function(d){var p,f,n=d.node,e=a[n.level];p=d.shapeExisting||{};var u=n.shapeArgs||{},B,w=!(!n.visible||!n.shapeArgs);
if(q&&v){var x={};f={end:u.end,start:u.start,innerR:u.innerR,r:u.r,x:u.x,y:u.y};w?!d.graphic&&r&&(x=g===d.id?{start:m.start,end:m.end}:r.end<=u.start?{start:m.end,end:m.end}:{start:m.start,end:m.start},x.innerR=x.r=t):d.graphic&&(k===d.id?f={innerR:t,r:t}:c&&(f=c.end<=p.start?{innerR:t,r:t,start:m.end,end:m.end}:{innerR:t,r:t,start:m.start,end:m.start}));p=x}else f=u,p={};var x=[u.plotX,u.plotY],D;d.node.isLeaf||(g===d.id?(D=l[g],D=D.parent):D=d.id);F(d,{shapeExisting:u,tooltipPos:x,drillId:D,name:""+
(d.name||d.id||d.index),plotX:u.plotX,plotY:u.plotY,value:n.val,isNull:!w});D=d.options;n=I(u)?u:{};D=I(D)?D.dataLabels:{};var e=I(e)?e.dataLabels:{},e=H({style:{}},e,D),A;D=e.rotationMode;G(e.rotation)||("auto"===D&&(1>d.innerArcLength&&d.outerArcLength>n.radius?A=0:D=1<d.innerArcLength&&d.outerArcLength>1.5*n.radius?"parallel":"perpendicular"),"auto"!==D&&(A=n.end-(n.end-n.start)/2),e.style.width="parallel"===D?Math.min(2.5*n.radius,(d.outerArcLength+d.innerArcLength)/2):n.radius,"perpendicular"===
D&&d.series.chart.renderer.fontMetrics(e.style.fontSize).h>d.outerArcLength&&(e.style.width=1),e.style.width=Math.max(e.style.width-2*(e.padding||0),1),A=A*C%180,"parallel"===D&&(A-=90),90<A?A-=180:-90>A&&(A+=180),e.rotation=A);0===e.rotation&&(e.rotation=.001);d.dlOptions=e;!E&&w&&(E=!0,B=z);d.draw({animate:f,attr:F(p,b.pointAttribs&&b.pointAttribs(d,d.selected&&"select")),onComplete:B,group:h,renderer:y,shapeType:"arc",shapeArgs:u})});f&&E?(b.hasRendered=!1,b.options.dataLabels.defer=!0,e.prototype.drawDataLabels.call(b),
b.hasRendered=!0,x&&z()):e.prototype.drawDataLabels.call(b)},pointAttribs:c.seriesTypes.column.prototype.pointAttribs,layoutAlgorithm:function(b,a,c){var d=b.start,e=b.end-d,g=b.val,k=b.x,p=b.y,n=c&&I(c.levelSize)&&G(c.levelSize.value)?c.levelSize.value:0,l=b.r,f=l+n,m=c&&G(c.slicedOffset)?c.slicedOffset:0;return O(a||[],function(a,b){var c=1/g*b.val*e,h=d+c/2,q=k+Math.cos(h)*m,h=p+Math.sin(h)*m;b={x:b.sliced?q:k,y:b.sliced?h:p,innerR:l,r:f,radius:n,start:d,end:d+c};a.push(b);d=b.end;return a},[])},
setShapeArgs:function(b,a,c){var d=[],e=c[b.level+1];b=x(b.children,function(b){return b.visible});d=this.layoutAlgorithm(a,b,e);w(b,function(b,a){a=d[a];var e=a.start+(a.end-a.start)/2,h=a.innerR+(a.r-a.innerR)/2,g=a.end-a.start,h=0===a.innerR&&6.28<g?{x:a.x,y:a.y}:{x:a.x+Math.cos(e)*h,y:a.y+Math.sin(e)*h},k=b.val?b.childrenTotal>b.val?b.childrenTotal:b.val:b.childrenTotal;this.points[b.i]&&(this.points[b.i].innerArcLength=g*a.innerR,this.points[b.i].outerArcLength=g*a.r);b.shapeArgs=H(a,{plotX:h.x,
plotY:h.y+4*Math.abs(Math.cos(e))});b.values=H(a,{val:k});b.children.length&&this.setShapeArgs(b,b.values,c)},this)},translate:function(){var b=this.options,c=this.center=E.call(this),l=this.startAndEndRadians=v(b.startAngle,b.endAngle),h=c[3]/2,m=c[2]/2-h,g=L(this),k=this.nodeMap,f,n=k&&k[g],r,t;this.shapeRoot=n&&n.shapeArgs;e.prototype.translate.call(this);t=this.tree=this.getTree();k=this.nodeMap;n=k[g];f=M(n.parent)?n.parent:"";r=k[f];f=z({from:0<n.level?n.level:1,levels:this.options.levels,to:t.height,
defaults:{colorByPoint:b.colorByPoint,dataLabels:b.dataLabels,levelIsConstant:b.levelIsConstant,levelSize:b.levelSize,slicedOffset:b.slicedOffset}});f=N(f,{diffRadius:m,from:0<n.level?n.level:1,to:t.height});K(t,{before:a,idRoot:g,levelIsConstant:b.levelIsConstant,mapOptionsToLevel:f,mapIdToNode:k,points:this.points,series:this});b=k[""].shapeArgs={end:l.end,r:h,start:l.start,val:n.val,x:c[0],y:c[1]};this.setShapeArgs(r,b,f);this.mapOptionsToLevel=f},animate:function(a){var b=this.chart,c=[b.plotWidth/
2,b.plotHeight/2],e=b.plotLeft,f=b.plotTop,b=this.group;a?(a={translateX:c[0]+e,translateY:c[1]+f,scaleX:.001,scaleY:.001,rotation:10,opacity:.01},b.attr(a)):(a={translateX:e,translateY:f,scaleX:1,scaleY:1,rotation:0,opacity:1},b.animate(a,this.options.animation),this.animate=null)},utils:{calculateLevelSizes:N,range:A}},{draw:t,shouldDraw:function(){return!this.isNull}})})(F,P,M)});
//# sourceMappingURL=sunburst.js.map