sunburst.js 24 KB

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