sunburst.js 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. Highcharts JS v8.2.0 (2020-08-20)
  3. (c) 2016-2019 Highsoft AS
  4. Authors: Jon Arild Nygard
  5. License: www.highcharts.com/license
  6. */
  7. (function(b){"object"===typeof module&&module.exports?(b["default"]=b,module.exports=b):"function"===typeof define&&define.amd?define("highcharts/modules/sunburst",["highcharts"],function(v){b(v);b.Highcharts=v;return b}):b("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(b){function v(b,e,x,N){b.hasOwnProperty(e)||(b[e]=N.apply(null,x))}b=b?b._modules:{};v(b,"Mixins/DrawPoint.js",[],function(){var b=function(b){return"function"===typeof b},e=function(e){var x,l=this,m=l.graphic,g=e.animatableAttribs,
  8. A=e.onComplete,n=e.css,h=e.renderer,F=null===(x=l.series)||void 0===x?void 0:x.options.animation;if(l.shouldDraw())m||(l.graphic=m=h[e.shapeType](e.shapeArgs).add(e.group)),m.css(n).attr(e.attribs).animate(g,e.isNew?!1:F,A);else if(m){var G=function(){l.graphic=m=m.destroy();b(A)&&A()};Object.keys(g).length?m.animate(g,void 0,function(){G()}):G()}};return{draw:e,drawPoint:function(b){(b.attribs=b.attribs||{})["class"]=this.getClassName();e.call(this,b)},isFn:b}});v(b,"Mixins/TreeSeries.js",[b["Core/Color.js"],
  9. b["Core/Utilities.js"]],function(b,e){var x=e.extend,E=e.isArray,l=e.isNumber,m=e.isObject,g=e.merge,A=e.pick;return{getColor:function(n,h){var e=h.index,g=h.mapOptionsToLevel,m=h.parentColor,x=h.parentColorIndex,l=h.series,C=h.colors,O=h.siblings,u=l.points,B=l.chart.options.chart,D;if(n){u=u[n.i];n=g[n.level]||{};if(g=u&&n.colorByPoint){var E=u.index%(C?C.length:B.colorCount);var I=C&&C[E]}if(!l.chart.styledMode){C=u&&u.options.color;B=n&&n.color;if(D=m)D=(D=n&&n.colorVariation)&&"brightness"===
  10. D.key?b.parse(m).brighten(e/O*D.to).get():m;D=A(C,B,I,D,l.color)}var v=A(u&&u.options.colorIndex,n&&n.colorIndex,E,x,h.colorIndex)}return{color:D,colorIndex:v}},getLevelOptions:function(b){var h=null;if(m(b)){h={};var e=l(b.from)?b.from:1;var n=b.levels;var A={};var H=m(b.defaults)?b.defaults:{};E(n)&&(A=n.reduce(function(b,h){if(m(h)&&l(h.level)){var n=g({},h);var F="boolean"===typeof n.levelIsConstant?n.levelIsConstant:H.levelIsConstant;delete n.levelIsConstant;delete n.level;h=h.level+(F?0:e-1);
  11. m(b[h])?x(b[h],n):b[h]=n}return b},{}));n=l(b.to)?b.to:1;for(b=0;b<=n;b++)h[b]=g({},H,m(A[b])?A[b]:{})}return h},setTreeValues:function G(b,e){var h=e.before,g=e.idRoot,m=e.mapIdToNode[g],l=e.points[b.i],E=l&&l.options||{},u=0,F=[];x(b,{levelDynamic:b.level-(("boolean"===typeof e.levelIsConstant?e.levelIsConstant:1)?0:m.level),name:A(l&&l.name,""),visible:g===b.id||("boolean"===typeof e.visible?e.visible:!1)});"function"===typeof h&&(b=h(b,e));b.children.forEach(function(h,g){var m=x({},e);x(m,{index:g,
  12. siblings:b.children.length,visible:b.visible});h=G(h,m);F.push(h);h.visible&&(u+=h.val)});b.visible=0<u||b.visible;h=A(E.value,u);x(b,{children:F,childrenTotal:u,isLeaf:b.visible&&!u,val:h});return b},updateRootId:function(b){if(m(b)){var e=m(b.options)?b.options:{};e=A(b.rootNode,e.rootId,"");m(b.userOptions)&&(b.userOptions.rootId=e);b.rootNode=e}return e}}});v(b,"Series/TreemapSeries.js",[b["Core/Globals.js"],b["Mixins/TreeSeries.js"],b["Mixins/DrawPoint.js"],b["Core/Color.js"],b["Mixins/LegendSymbol.js"],
  13. b["Core/Series/Point.js"],b["Core/Utilities.js"]],function(b,e,x,v,l,m,g){var A=e.getColor,n=e.getLevelOptions,h=e.updateRootId,F=v.parse,G=g.addEvent,E=g.correctFloat,H=g.defined,N=g.error,C=g.extend,O=g.fireEvent,u=g.isArray,B=g.isNumber,D=g.isObject,K=g.isString,I=g.merge,P=g.objectEach,w=g.pick;e=g.seriesType;var Q=g.stableSort,L=b.seriesTypes;g=b.noop;var J=b.Series,f=function(a,c,d){d=d||this;P(a,function(r,k){c.call(d,r,k,a)})},p=function(a,c,d){d=d||this;a=c.call(d,a);!1!==a&&p(a,c,d)},y=
  14. !1;e("treemap","scatter",{allowTraversingTree:!1,animationLimit:250,showInLegend:!1,marker:!1,colorByPoint:!1,dataLabels:{defer:!1,enabled:!0,formatter:function(){var a=this&&this.point?this.point:{};return K(a.name)?a.name:""},inside:!0,verticalAlign:"middle"},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}<br/>"},ignoreHiddenPoint:!0,layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,drillUpButton:{position:{align:"right",
  15. x:-10,y:10}},traverseUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,colorKey:"colorValue",opacity:.15,states:{hover:{borderColor:"#999999",brightness:L.heatmap?0:.1,halo:!1,opacity:.75,shadow:!1}}},{pointArrayMap:["value"],directTouch:!0,optionalAxis:"colorAxis",getSymbol:g,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",trackerGroups:["group","dataLabelsGroup"],getListOfParents:function(a,c){a=u(a)?a:[];var d=u(c)?c:[];c=a.reduce(function(a,
  16. c,d){c=w(c.parent,"");"undefined"===typeof a[c]&&(a[c]=[]);a[c].push(d);return a},{"":[]});f(c,function(a,c,b){""!==c&&-1===d.indexOf(c)&&(a.forEach(function(a){b[""].push(a)}),delete b[c])});return c},getTree:function(){var a=this.data.map(function(a){return a.id});a=this.getListOfParents(this.data,a);this.nodeMap=[];return this.buildNode("",-1,0,a,null)},hasData:function(){return!!this.processedXData.length},init:function(a,c){var d=b.colorMapSeriesMixin;d&&(this.colorAttribs=d.colorAttribs);d=
  17. G(this,"setOptions",function(a){a=a.userOptions;H(a.allowDrillToNode)&&!H(a.allowTraversingTree)&&(a.allowTraversingTree=a.allowDrillToNode,delete a.allowDrillToNode);H(a.drillUpButton)&&!H(a.traverseUpButton)&&(a.traverseUpButton=a.drillUpButton,delete a.drillUpButton)});J.prototype.init.call(this,a,c);delete this.opacity;this.eventsToUnbind.push(d);this.options.allowTraversingTree&&this.eventsToUnbind.push(G(this,"click",this.onClickDrillToNode))},buildNode:function(a,c,d,b,k){var f=this,r=[],R=
  18. f.points[c],e=0,q;(b[a]||[]).forEach(function(c){q=f.buildNode(f.points[c].id,c,d+1,b,a);e=Math.max(q.height+1,e);r.push(q)});c={id:a,i:c,children:r,height:e,level:d,parent:k,visible:!1};f.nodeMap[c.id]=c;R&&(R.node=c);return c},setTreeValues:function(a){var c=this,d=c.options,b=c.nodeMap[c.rootNode];d="boolean"===typeof d.levelIsConstant?d.levelIsConstant:!0;var k=0,f=[],t=c.points[a.i];a.children.forEach(function(a){a=c.setTreeValues(a);f.push(a);a.ignore||(k+=a.val)});Q(f,function(a,c){return a.sortIndex-
  19. c.sortIndex});var e=w(t&&t.options.value,k);t&&(t.value=e);C(a,{children:f,childrenTotal:k,ignore:!(w(t&&t.visible,!0)&&0<e),isLeaf:a.visible&&!k,levelDynamic:a.level-(d?0:b.level),name:w(t&&t.name,""),sortIndex:w(t&&t.sortIndex,-e),val:e});return a},calculateChildrenAreas:function(a,c){var d=this,f=d.options,k=d.mapOptionsToLevel[a.level+1],b=w(d[k&&k.layoutAlgorithm]&&k.layoutAlgorithm,f.layoutAlgorithm),t=f.alternateStartingDirection,e=[];a=a.children.filter(function(a){return!a.ignore});k&&k.layoutStartingDirection&&
  20. (c.direction="vertical"===k.layoutStartingDirection?0:1);e=d[b](c,a);a.forEach(function(a,k){k=e[k];a.values=I(k,{val:a.childrenTotal,direction:t?1-c.direction:c.direction});a.pointValues=I(k,{x:k.x/d.axisRatio,y:100-k.y-k.height,width:k.width/d.axisRatio});a.children.length&&d.calculateChildrenAreas(a,a.values)})},setPointValues:function(){var a=this,c=a.xAxis,d=a.yAxis,f=a.chart.styledMode;a.points.forEach(function(k){var b=k.node,r=b.pointValues;b=b.visible;if(r&&b){b=r.height;var e=r.width,p=
  21. r.x,q=r.y,y=f?0:(a.pointAttribs(k)["stroke-width"]||0)%2/2;r=Math.round(c.toPixels(p,!0))-y;e=Math.round(c.toPixels(p+e,!0))-y;p=Math.round(d.toPixels(q,!0))-y;b=Math.round(d.toPixels(q+b,!0))-y;k.shapeArgs={x:Math.min(r,e),y:Math.min(p,b),width:Math.abs(e-r),height:Math.abs(b-p)};k.plotX=k.shapeArgs.x+k.shapeArgs.width/2;k.plotY=k.shapeArgs.y+k.shapeArgs.height/2}else delete k.plotX,delete k.plotY})},setColorRecursive:function(a,c,d,b,k){var f=this,r=f&&f.chart;r=r&&r.options&&r.options.colors;if(a){var e=
  22. A(a,{colors:r,index:b,mapOptionsToLevel:f.mapOptionsToLevel,parentColor:c,parentColorIndex:d,series:f,siblings:k});if(c=f.points[a.i])c.color=e.color,c.colorIndex=e.colorIndex;(a.children||[]).forEach(function(c,d){f.setColorRecursive(c,e.color,e.colorIndex,d,a.children.length)})}},algorithmGroup:function(a,c,d,b){this.height=a;this.width=c;this.plot=b;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(a,
  23. c){return Math.max(a/c,c/a)}};this.addElement=function(a){this.lP.total=this.elArr[this.elArr.length-1];this.total+=a;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/
  24. this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH));this.elArr.push(a)};this.reset=function(){this.lW=this.nW=0;this.elArr=[];this.total=0}},algorithmCalcPoints:function(a,c,d,b){var f,r,e,p,y=d.lW,q=d.lH,h=d.plot,n=0,g=d.elArr.length-1;if(c)y=d.nW,q=d.nH;else var m=d.elArr[d.elArr.length-1];d.elArr.forEach(function(a){if(c||n<g)0===d.direction?(f=h.x,r=h.y,e=y,p=a/e):(f=h.x,r=h.y,p=q,e=a/p),b.push({x:f,y:r,width:e,height:E(p)}),0===d.direction?h.y+=p:h.x+=e;n+=1});d.reset();0===d.direction?
  25. d.width-=y:d.height-=q;h.y=h.parent.y+(h.parent.height-d.height);h.x=h.parent.x+(h.parent.width-d.width);a&&(d.direction=1-d.direction);c||d.addElement(m)},algorithmLowAspectRatio:function(a,c,d){var b=[],f=this,e,p={x:c.x,y:c.y,parent:c},h=0,y=d.length-1,q=new this.algorithmGroup(c.height,c.width,c.direction,p);d.forEach(function(d){e=d.val/c.val*c.height*c.width;q.addElement(e);q.lP.nR>q.lP.lR&&f.algorithmCalcPoints(a,!1,q,b,p);h===y&&f.algorithmCalcPoints(a,!0,q,b,p);h+=1});return b},algorithmFill:function(a,
  26. c,d){var b=[],f,e=c.direction,p=c.x,h=c.y,y=c.width,q=c.height,n,g,m,l;d.forEach(function(d){f=d.val/c.val*c.height*c.width;n=p;g=h;0===e?(l=q,m=f/l,y-=m,p+=m):(m=y,l=f/m,q-=l,h+=l);b.push({x:n,y:g,width:m,height:l});a&&(e=1-e)});return b},strip:function(a,c){return this.algorithmLowAspectRatio(!1,a,c)},squarified:function(a,c){return this.algorithmLowAspectRatio(!0,a,c)},sliceAndDice:function(a,c){return this.algorithmFill(!0,a,c)},stripes:function(a,c){return this.algorithmFill(!1,a,c)},translate:function(){var a=
  27. this,c=a.options,d=h(a);J.prototype.translate.call(a);var b=a.tree=a.getTree();var f=a.nodeMap[d];a.renderTraverseUpButton(d);a.mapOptionsToLevel=n({from:f.level+1,levels:c.levels,to:b.height,defaults:{levelIsConstant:a.options.levelIsConstant,colorByPoint:c.colorByPoint}});""===d||f&&f.children.length||(a.setRootNode("",!1),d=a.rootNode,f=a.nodeMap[d]);p(a.nodeMap[a.rootNode],function(c){var d=!1,b=c.parent;c.visible=!0;if(b||""===b)d=a.nodeMap[b];return d});p(a.nodeMap[a.rootNode].children,function(a){var c=
  28. !1;a.forEach(function(a){a.visible=!0;a.children.length&&(c=(c||[]).concat(a.children))});return c});a.setTreeValues(b);a.axisRatio=a.xAxis.len/a.yAxis.len;a.nodeMap[""].pointValues=d={x:0,y:0,width:100,height:100};a.nodeMap[""].values=d=I(d,{width:d.width*a.axisRatio,direction:"vertical"===c.layoutStartingDirection?0:1,val:b.val});a.calculateChildrenAreas(b,d);a.colorAxis||c.colorByPoint||a.setColorRecursive(a.tree);c.allowTraversingTree&&(c=f.pointValues,a.xAxis.setExtremes(c.x,c.x+c.width,!1),
  29. a.yAxis.setExtremes(c.y,c.y+c.height,!1),a.xAxis.setScale(),a.yAxis.setScale());a.setPointValues()},drawDataLabels:function(){var a=this,c=a.mapOptionsToLevel,d,b;a.points.filter(function(a){return a.node.visible}).forEach(function(f){b=c[f.node.level];d={style:{}};f.node.isLeaf||(d.enabled=!1);b&&b.dataLabels&&(d=I(d,b.dataLabels),a._hasPointLabels=!0);f.shapeArgs&&(d.style.width=f.shapeArgs.width,f.dataLabel&&f.dataLabel.css({width:f.shapeArgs.width+"px"}));f.dlOptions=I(d,f.options.dataLabels)});
  30. J.prototype.drawDataLabels.call(this)},alignDataLabel:function(a,c,d){var f=d.style;!H(f.textOverflow)&&c.text&&c.getBBox().width>c.text.textWidth&&c.css({textOverflow:"ellipsis",width:f.width+="px"});L.column.prototype.alignDataLabel.apply(this,arguments);a.dataLabel&&a.dataLabel.attr({zIndex:(a.node.zIndex||0)+1})},pointAttribs:function(a,c){var d=D(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},f=a&&d[a.node.level]||{};d=this.options;var b=c&&d.states[c]||{},e=a&&a.getClassName()||"";a={stroke:a&&
  31. a.borderColor||f.borderColor||b.borderColor||d.borderColor,"stroke-width":w(a&&a.borderWidth,f.borderWidth,b.borderWidth,d.borderWidth),dashstyle:a&&a.borderDashStyle||f.borderDashStyle||b.borderDashStyle||d.borderDashStyle,fill:a&&a.color||this.color};-1!==e.indexOf("highcharts-above-level")?(a.fill="none",a["stroke-width"]=0):-1!==e.indexOf("highcharts-internal-node-interactive")?(c=w(b.opacity,d.opacity),a.fill=F(a.fill).setOpacity(c).get(),a.cursor="pointer"):-1!==e.indexOf("highcharts-internal-node")?
  32. a.fill="none":c&&(a.fill=F(a.fill).brighten(b.brightness).get());return a},drawPoints:function(){var a=this,c=a.chart,d=c.renderer,f=c.styledMode,b=a.options,e=f?{}:b.shadow,p=b.borderRadius,h=c.pointCount<b.animationLimit,y=b.allowTraversingTree;a.points.forEach(function(c){var r=c.node.levelDynamic,k={},n={},m={},g="level-group-"+r,q=!!c.graphic,T=h&&q,M=c.shapeArgs;c.shouldDraw()&&(p&&(n.r=p),I(!0,T?k:n,q?M:{},f?{}:a.pointAttribs(c,c.selected&&"select")),a.colorAttribs&&f&&C(m,a.colorAttribs(c)),
  33. a[g]||(a[g]=d.g(g).attr({zIndex:1E3-r}).add(a.group),a[g].survive=!0));c.draw({animatableAttribs:k,attribs:n,css:m,group:a[g],renderer:d,shadow:e,shapeArgs:M,shapeType:"rect"});y&&c.graphic&&(c.drillId=b.interactByLeaf?a.drillToByLeaf(c):a.drillToByGroup(c))})},onClickDrillToNode:function(a){var c=(a=a.point)&&a.drillId;K(c)&&(this.isDrillAllowed?this.isDrillAllowed(c):1)&&(a.setState(""),this.setRootNode(c,!0,{trigger:"click"}))},drillToByGroup:function(a){var c=!1;1!==a.node.level-this.nodeMap[this.rootNode].level||
  34. a.node.isLeaf||(c=a.id);return c},drillToByLeaf:function(a){var c=!1;if(a.node.parent!==this.rootNode&&a.node.isLeaf)for(a=a.node;!c;)a=this.nodeMap[a.parent],a.parent===this.rootNode&&(c=a.id);return c},drillUp:function(){var a=this.nodeMap[this.rootNode];a&&K(a.parent)&&this.setRootNode(a.parent,!0,{trigger:"traverseUpButton"})},drillToNode:function(a,c){N(32,!1,void 0,{"treemap.drillToNode":"use treemap.setRootNode"});this.setRootNode(a,c)},setRootNode:function(a,c,d){a=C({newRootId:a,previousRootId:this.rootNode,
  35. redraw:w(c,!0),series:this},d);O(this,"setRootNode",a,function(a){var c=a.series;c.idPreviousRoot=a.previousRootId;c.rootNode=a.newRootId;c.isDirty=!0;a.redraw&&c.chart.redraw()})},isDrillAllowed:function(a){var c=this.tree,d=c.children[0];return!(1===c.children.length&&(""===this.rootNode&&a===d.id||this.rootNode===d.id&&""===a))},renderTraverseUpButton:function(a){var c=this,d=c.nodeMap[a],f=c.options.traverseUpButton,b=w(f.text,d.name,"< Back");""!==a&&(!c.isDrillAllowed||K(d.parent)&&c.isDrillAllowed(d.parent))?
  36. this.drillUpButton?(this.drillUpButton.placed=!1,this.drillUpButton.attr({text:b}).align()):(d=(a=f.theme)&&a.states,this.drillUpButton=this.chart.renderer.button(b,null,null,function(){c.drillUp()},a,d&&d.hover,d&&d.select).addClass("highcharts-drillup-button").attr({align:f.position.align,zIndex:7}).add().align(f.position,!1,f.relativeTo||"plotBox")):c.drillUpButton&&(c.drillUpButton=c.drillUpButton.destroy())},buildKDTree:g,drawLegendSymbol:l.drawRectangle,getExtremes:function(){var a=J.prototype.getExtremes.call(this,
  37. this.colorValueData),c=a.dataMax;this.valueMin=a.dataMin;this.valueMax=c;return J.prototype.getExtremes.call(this)},getExtremesFromAll:!0,setState:function(a){this.options.inactiveOtherPoints=!0;J.prototype.setState.call(this,a,!1);this.options.inactiveOtherPoints=!1},utils:{recursive:p}},{draw:x.drawPoint,setVisible:L.pie.prototype.pointClass.prototype.setVisible,getClassName:function(){var a=m.prototype.getClassName.call(this),c=this.series,d=c.options;this.node.level<=c.nodeMap[c.rootNode].level?
  38. a+=" highcharts-above-level":this.node.isLeaf||w(d.interactByLeaf,!d.allowTraversingTree)?this.node.isLeaf||(a+=" highcharts-internal-node"):a+=" highcharts-internal-node-interactive";return a},isValid:function(){return this.id||B(this.value)},setState:function(a){m.prototype.setState.call(this,a);this.graphic&&this.graphic.attr({zIndex:"hover"===a?1:0})},shouldDraw:function(){return B(this.plotY)&&null!==this.y}});G(b.Series,"afterBindAxes",function(){var a=this.xAxis,c=this.yAxis;if(a&&c)if(this.is("treemap")){var d=
  39. {endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};C(c.options,d);C(a.options,d);y=!0}else y&&(c.setOptions(c.userOptions),a.setOptions(a.userOptions),y=!1)});""});v(b,"Series/SunburstSeries.js",[b["Core/Globals.js"],b["Core/Utilities.js"],b["Mixins/CenteredSeries.js"],b["Mixins/DrawPoint.js"],b["Mixins/TreeSeries.js"]],function(b,e,x,v,l){var m=e.correctFloat,g=e.error,A=e.extend,n=e.isNumber,h=e.isObject,
  40. F=e.isString,G=e.merge,E=e.seriesType,H=e.splat,N=l.getColor,C=l.getLevelOptions,O=l.setTreeValues,u=l.updateRootId,B=b.Series,D=x.getCenter,K=x.getStartAndEndRadians,I=180/Math.PI,P=b.seriesTypes,w=function(b,e){var f=[];if(n(b)&&n(e)&&b<=e)for(;b<=e;b++)f.push(b);return f},Q=function(b,e){e=h(e)?e:{};var f=0,a;if(h(b)){var c=G({},b);b=n(e.from)?e.from:0;var d=n(e.to)?e.to:0;var p=w(b,d);b=Object.keys(c).filter(function(a){return-1===p.indexOf(+a)});var k=a=n(e.diffRadius)?e.diffRadius:0;p.forEach(function(b){b=
  41. c[b];var d=b.levelSize.unit,e=b.levelSize.value;"weight"===d?f+=e:"percentage"===d?(b.levelSize={unit:"pixels",value:e/100*k},a-=b.levelSize.value):"pixels"===d&&(a-=e)});p.forEach(function(b){var d=c[b];"weight"===d.levelSize.unit&&(d=d.levelSize.value,c[b].levelSize={unit:"pixels",value:d/f*a})});b.forEach(function(a){c[a].levelSize={value:0,unit:"pixels"}})}return c},L=function(b){var f=b.level;return{from:0<f?f:1,to:f+b.height}},J=function(b,e){var f=e.mapIdToNode[b.parent],a=e.series,c=a.chart,
  42. d=a.points[b.i];f=N(b,{colors:a.options.colors||c&&c.options.colors,colorIndex:a.colorIndex,index:e.index,mapOptionsToLevel:e.mapOptionsToLevel,parentColor:f&&f.color,parentColorIndex:f&&f.colorIndex,series:e.series,siblings:e.siblings});b.color=f.color;b.colorIndex=f.colorIndex;d&&(d.color=b.color,d.colorIndex=b.colorIndex,b.sliced=b.id!==e.idRoot?d.sliced:!1);return b};E("sunburst","treemap",{center:["50%","50%"],colorByPoint:!1,opacity:1,dataLabels:{allowOverlap:!0,defer:!0,rotationMode:"auto",
  43. style:{textOverflow:"ellipsis"}},rootId:void 0,levelIsConstant:!0,levelSize:{value:1,unit:"weight"},slicedOffset:10},{drawDataLabels:b.noop,drawPoints:function(){var b=this,e=b.mapOptionsToLevel,y=b.shapeRoot,a=b.group,c=b.hasRendered,d=b.rootNode,r=b.idPreviousRoot,k=b.nodeMap,g=k[r],m=g&&g.shapeArgs;g=b.points;var l=b.startAndEndRadians,u=b.chart,q=u&&u.options&&u.options.chart||{},x="boolean"===typeof q.animation?q.animation:!0,v=b.center[3]/2,C=b.chart.renderer,w=!1,D=!1;if(q=!!(x&&c&&d!==r&&
  44. b.dataLabelsGroup)){b.dataLabelsGroup.attr({opacity:0});var F=function(){w=!0;b.dataLabelsGroup&&b.dataLabelsGroup.animate({opacity:1,visibility:"visible"})}}g.forEach(function(f){var p=f.node,g=e[p.level];var q=f.shapeExisting||{};var t=p.shapeArgs||{},M=!(!p.visible||!p.shapeArgs);if(c&&x){var w={};var E={end:t.end,start:t.start,innerR:t.innerR,r:t.r,x:t.x,y:t.y};M?!f.graphic&&m&&(w=d===f.id?{start:l.start,end:l.end}:m.end<=t.start?{start:l.end,end:l.end}:{start:l.start,end:l.start},w.innerR=w.r=
  45. v):f.graphic&&(r===f.id?E={innerR:v,r:v}:y&&(E=y.end<=q.start?{innerR:v,r:v,start:l.end,end:l.end}:{innerR:v,r:v,start:l.start,end:l.start}));q=w}else E=t,q={};w=[t.plotX,t.plotY];if(!f.node.isLeaf)if(d===f.id){var z=k[d];z=z.parent}else z=f.id;A(f,{shapeExisting:t,tooltipPos:w,drillId:z,name:""+(f.name||f.id||f.index),plotX:t.plotX,plotY:t.plotY,value:p.val,isNull:!M});z=f.options;p=h(t)?t:{};z=h(z)?z.dataLabels:{};g=H(h(g)?g.dataLabels:{})[0];g=G({style:{}},g,z);z=g.rotationMode;if(!n(g.rotation)){if("auto"===
  46. z||"circular"===z)if(1>f.innerArcLength&&f.outerArcLength>p.radius){var B=0;f.dataLabelPath&&"circular"===z&&(g.textPath={enabled:!0})}else 1<f.innerArcLength&&f.outerArcLength>1.5*p.radius?"circular"===z?g.textPath={enabled:!0,attributes:{dy:5}}:z="parallel":(f.dataLabel&&f.dataLabel.textPathWrapper&&"circular"===z&&(g.textPath={enabled:!1}),z="perpendicular");"auto"!==z&&"circular"!==z&&(B=p.end-(p.end-p.start)/2);g.style.width="parallel"===z?Math.min(2.5*p.radius,(f.outerArcLength+f.innerArcLength)/
  47. 2):p.radius;"perpendicular"===z&&f.series.chart.renderer.fontMetrics(g.style.fontSize).h>f.outerArcLength&&(g.style.width=1);g.style.width=Math.max(g.style.width-2*(g.padding||0),1);B=B*I%180;"parallel"===z&&(B-=90);90<B?B-=180:-90>B&&(B+=180);g.rotation=B}g.textPath&&(0===f.shapeExisting.innerR&&g.textPath.enabled?(g.rotation=0,g.textPath.enabled=!1,g.style.width=Math.max(2*f.shapeExisting.r-2*(g.padding||0),1)):f.dlOptions&&f.dlOptions.textPath&&!f.dlOptions.textPath.enabled&&"circular"===z&&(g.textPath.enabled=
  48. !0),g.textPath.enabled&&(g.rotation=0,g.style.width=Math.max((f.outerArcLength+f.innerArcLength)/2-2*(g.padding||0),1)));0===g.rotation&&(g.rotation=.001);f.dlOptions=g;if(!D&&M){D=!0;var S=F}f.draw({animatableAttribs:E,attribs:A(q,!u.styledMode&&b.pointAttribs(f,f.selected&&"select")),onComplete:S,group:a,renderer:C,shapeType:"arc",shapeArgs:t})});q&&D?(b.hasRendered=!1,b.options.dataLabels.defer=!0,B.prototype.drawDataLabels.call(b),b.hasRendered=!0,w&&F()):B.prototype.drawDataLabels.call(b)},pointAttribs:P.column.prototype.pointAttribs,
  49. layoutAlgorithm:function(b,e,g){var a=b.start,c=b.end-a,d=b.val,f=b.x,p=b.y,m=g&&h(g.levelSize)&&n(g.levelSize.value)?g.levelSize.value:0,l=b.r,y=l+m,u=g&&n(g.slicedOffset)?g.slicedOffset:0;return(e||[]).reduce(function(b,e){var g=1/d*e.val*c,h=a+g/2,k=f+Math.cos(h)*u;h=p+Math.sin(h)*u;e={x:e.sliced?k:f,y:e.sliced?h:p,innerR:l,r:y,radius:m,start:a,end:a+g};b.push(e);a=e.end;return b},[])},setShapeArgs:function(b,e,g){var a=[],c=g[b.level+1];b=b.children.filter(function(a){return a.visible});a=this.layoutAlgorithm(e,
  50. b,c);b.forEach(function(b,c){c=a[c];var d=c.start+(c.end-c.start)/2,f=c.innerR+(c.r-c.innerR)/2,e=c.end-c.start;f=0===c.innerR&&6.28<e?{x:c.x,y:c.y}:{x:c.x+Math.cos(d)*f,y:c.y+Math.sin(d)*f};var h=b.val?b.childrenTotal>b.val?b.childrenTotal:b.val:b.childrenTotal;this.points[b.i]&&(this.points[b.i].innerArcLength=e*c.innerR,this.points[b.i].outerArcLength=e*c.r);b.shapeArgs=G(c,{plotX:f.x,plotY:f.y+4*Math.abs(Math.cos(d))});b.values=G(c,{val:h});b.children.length&&this.setShapeArgs(b,b.values,g)},
  51. this)},translate:function(){var b=this,e=b.options,h=b.center=D.call(b),a=b.startAndEndRadians=K(e.startAngle,e.endAngle),c=h[3]/2,d=h[2]/2-c,m=u(b),k=b.nodeMap,l=k&&k[m],n={};b.shapeRoot=l&&l.shapeArgs;B.prototype.translate.call(b);var w=b.tree=b.getTree();b.renderTraverseUpButton(m);k=b.nodeMap;l=k[m];var v=F(l.parent)?l.parent:"";v=k[v];var q=L(l);var x=q.from,A=q.to;q=C({from:x,levels:b.options.levels,to:A,defaults:{colorByPoint:e.colorByPoint,dataLabels:e.dataLabels,levelIsConstant:e.levelIsConstant,
  52. levelSize:e.levelSize,slicedOffset:e.slicedOffset}});q=Q(q,{diffRadius:d,from:x,to:A});O(w,{before:J,idRoot:m,levelIsConstant:e.levelIsConstant,mapOptionsToLevel:q,mapIdToNode:k,points:b.points,series:b});e=k[""].shapeArgs={end:a.end,r:c,start:a.start,val:l.val,x:h[0],y:h[1]};this.setShapeArgs(v,e,q);b.mapOptionsToLevel=q;b.data.forEach(function(a){n[a.id]&&g(31,!1,b.chart);n[a.id]=!0});n={}},alignDataLabel:function(b,e,g){if(!g.textPath||!g.textPath.enabled)return P.treemap.prototype.alignDataLabel.apply(this,
  53. arguments)},animate:function(b){var e=this.chart,f=[e.plotWidth/2,e.plotHeight/2],a=e.plotLeft,c=e.plotTop;e=this.group;b?(b={translateX:f[0]+a,translateY:f[1]+c,scaleX:.001,scaleY:.001,rotation:10,opacity:.01},e.attr(b)):(b={translateX:a,translateY:c,scaleX:1,scaleY:1,rotation:0,opacity:1},e.animate(b,this.options.animation))},utils:{calculateLevelSizes:Q,getLevelFromAndTo:L,range:w}},{draw:v.drawPoint,shouldDraw:function(){return!this.isNull},isValid:function(){return!0},getDataLabelPath:function(b){var e=
  54. this.series.chart.renderer,f=this.shapeExisting,a=f.start,c=f.end,d=a+(c-a)/2;d=0>d&&d>-Math.PI||d>Math.PI;var g=f.r+(b.options.distance||0);a===-Math.PI/2&&m(c)===m(1.5*Math.PI)&&(a=-Math.PI+Math.PI/360,c=-Math.PI/360,d=!0);if(c-a>Math.PI){d=!1;var h=!0}this.dataLabelPath&&(this.dataLabelPath=this.dataLabelPath.destroy());this.dataLabelPath=e.arc({open:!0,longArc:h?1:0}).add(b);this.dataLabelPath.attr({start:d?a:c,end:d?c:a,clockwise:+d,x:f.x,y:f.y,r:(g+f.innerR)/2});return this.dataLabelPath}})});
  55. v(b,"masters/modules/sunburst.src.js",[],function(){})});
  56. //# sourceMappingURL=sunburst.js.map