62 lines
26 KiB
JavaScript
62 lines
26 KiB
JavaScript
/*
|
|
Highcharts JS v10.2.1 (2022-08-29)
|
|
|
|
(c) 2014-2021 Highsoft AS
|
|
Authors: Jon Arild Nygard / Oystein Moseng
|
|
|
|
License: www.highcharts.com/license
|
|
*/
|
|
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/treemap",["highcharts"],function(u){a(u);a.Highcharts=u;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function u(a,c,f,g){a.hasOwnProperty(c)||(a[c]=g.apply(null,f),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:c,module:a[c]}})))}a=a?a._modules:{};u(a,
|
|
"Series/ColorMapComposition.js",[a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,c){var f=a.seriesTypes.column.prototype,g=c.addEvent,e=c.defined,m;(function(a){function c(d){this.moveToTopOnHover&&this.graphic&&this.graphic.attr({zIndex:d&&"hover"===d.state?1:0})}var m=[];a.pointMembers={dataLabelOnNull:!0,moveToTopOnHover:!0,isValid:function(){return null!==this.value&&Infinity!==this.value&&-Infinity!==this.value&&(void 0===this.value||!isNaN(this.value))}};a.seriesMembers=
|
|
{colorKey:"value",axisTypes:["xAxis","yAxis","colorAxis"],parallelArrays:["x","y","value"],pointArrayMap:["value"],trackerGroups:["group","markerGroup","dataLabelsGroup"],colorAttribs:function(d){var b={};!e(d.color)||d.state&&"normal"!==d.state||(b[this.colorProp||"fill"]=d.color);return b},pointAttribs:f.pointAttribs};a.compose=function(d){var b=d.prototype.pointClass;-1===m.indexOf(b)&&(m.push(b),g(b,"afterSetState",c));return d}})(m||(m={}));return m});u(a,"Series/Treemap/TreemapAlgorithmGroup.js",
|
|
[],function(){return function(){function a(a,f,g,e){this.height=a;this.width=f;this.plot=e;this.startDirection=this.direction=g;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,g){return Math.max(a/g,g/a)}}}a.prototype.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/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH));this.elArr.push(a)};a.prototype.reset=function(){this.lW=this.nW=0;this.elArr=[];this.total=0};return a}()});u(a,"Series/DrawPointUtilities.js",[a["Core/Utilities.js"]],
|
|
function(a){function c(a){switch(a.series&&a.series.type){case "treemap":return f(a.plotY)&&null!==a.y;default:return!a.isNull}}var f=a.isNumber;return{draw:function(a,e){var f=e.animatableAttribs,g=e.onComplete,k=e.css,n=e.renderer,d=a.series&&a.series.chart.hasRendered?void 0:a.series&&a.series.options.animation,b=a.graphic;e.attribs=e.attribs||{};e.attribs["class"]=a.getClassName();if(c(a))b||(a.graphic=b="text"===e.shapeType?n.text():n[e.shapeType](e.shapeArgs||{}),b.add(e.group)),k&&b.css(k),
|
|
b.attr(e.attribs).animate(f,e.isNew?!1:d,g);else if(b){var y=function(){a.graphic=b=b&&b.destroy();"function"===typeof g&&g()};Object.keys(f).length?b.animate(f,void 0,function(){return y()}):y()}},shouldDraw:c}});u(a,"Series/Treemap/TreemapPoint.js",[a["Series/DrawPointUtilities.js"],a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,c,f){var g=this&&this.__extends||function(){var a=function(d,y){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,d){a.__proto__=
|
|
d}||function(a,d){for(var l in d)d.hasOwnProperty(l)&&(a[l]=d[l])};return a(d,y)};return function(d,y){function b(){this.constructor=d}a(d,y);d.prototype=null===y?Object.create(y):(b.prototype=y.prototype,new b)}}(),e=c.series.prototype.pointClass,m=c.seriesTypes;c=m.pie.prototype.pointClass;var v=f.extend,k=f.isNumber,n=f.pick;f=function(d){function b(){var a=null!==d&&d.apply(this,arguments)||this;a.name=void 0;a.node=void 0;a.options=void 0;a.series=void 0;a.value=void 0;return a}g(b,d);b.prototype.draw=
|
|
function(d){a.draw(this,d)};b.prototype.getClassName=function(){var a=e.prototype.getClassName.call(this),d=this.series,b=d.options;this.node.level<=d.nodeMap[d.rootNode].level?a+=" highcharts-above-level":this.node.isLeaf||n(b.interactByLeaf,!b.allowTraversingTree)?this.node.isLeaf||(a+=" highcharts-internal-node"):a+=" highcharts-internal-node-interactive";return a};b.prototype.isValid=function(){return!(!this.id&&!k(this.value))};b.prototype.setState=function(a){e.prototype.setState.call(this,
|
|
a);this.graphic&&this.graphic.attr({zIndex:"hover"===a?1:0})};b.prototype.shouldDraw=function(){return a.shouldDraw(this)};return b}(m.scatter.prototype.pointClass);v(f.prototype,{setVisible:c.prototype.setVisible});return f});u(a,"Series/Treemap/TreemapUtilities.js",[a["Core/Utilities.js"]],function(a){var c=a.objectEach,f;(function(a){function e(a,f,c){void 0===c&&(c=this);a=f.call(c,a);!1!==a&&e(a,f,c)}a.AXIS_MAX=100;a.isBoolean=function(a){return"boolean"===typeof a};a.eachObject=function(a,f,
|
|
e){e=e||this;c(a,function(c,d){f.call(e,c,d,a)})};a.recursive=e})(f||(f={}));return f});u(a,"Series/TreeUtilities.js",[a["Core/Color/Color.js"],a["Core/Utilities.js"]],function(a,c){function f(a,b){var d=b.before,e=b.idRoot,r=b.mapIdToNode[e],l=b.points[a.i],p=l&&l.options||{},w=[],x=0;a.levelDynamic=a.level-(!1!==b.levelIsConstant?0:r.level);a.name=n(l&&l.name,"");a.visible=e===a.id||!0===b.visible;"function"===typeof d&&(a=d(a,b));a.children.forEach(function(d,l){var p=g({},b);g(p,{index:l,siblings:a.children.length,
|
|
visible:a.visible});d=f(d,p);w.push(d);d.visible&&(x+=d.val)});d=n(p.value,x);a.visible=0<=d&&(0<x||a.visible);a.children=w;a.childrenTotal=x;a.isLeaf=a.visible&&!x;a.val=d;return a}var g=c.extend,e=c.isArray,m=c.isNumber,v=c.isObject,k=c.merge,n=c.pick;return{getColor:function(d,b){var e=b.index,f=b.mapOptionsToLevel,r=b.parentColor,l=b.parentColorIndex,p=b.series,w=b.colors,x=b.siblings,c=p.points,g=p.chart.options.chart,k;if(d){c=c[d.i];d=f[d.level]||{};if(f=c&&d.colorByPoint){var m=c.index%(w?
|
|
w.length:g.colorCount);var v=w&&w[m]}if(!p.chart.styledMode){w=c&&c.options.color;g=d&&d.color;if(k=r)k=(k=d&&d.colorVariation)&&"brightness"===k.key&&e&&x?a.parse(r).brighten(e/x*k.to).get():r;k=n(w,g,v,k,p.color)}var B=n(c&&c.options.colorIndex,d&&d.colorIndex,m,l,b.colorIndex)}return{color:k,colorIndex:B}},getLevelOptions:function(a){var b=null;if(v(a)){b={};var d=m(a.from)?a.from:1;var c=a.levels;var r={};var l=v(a.defaults)?a.defaults:{};e(c)&&(r=c.reduce(function(a,b){if(v(b)&&m(b.level)){var p=
|
|
k({},b);var c=n(p.levelIsConstant,l.levelIsConstant);delete p.levelIsConstant;delete p.level;b=b.level+(c?0:d-1);v(a[b])?k(!0,a[b],p):a[b]=p}return a},{}));c=m(a.to)?a.to:1;for(a=0;a<=c;a++)b[a]=k({},l,v(r[a])?r[a]:{})}return b},setTreeValues:f,updateRootId:function(a){if(v(a)){var b=v(a.options)?a.options:{};b=n(a.rootNode,b.rootId,"");v(a.userOptions)&&(a.userOptions.rootId=b);a.rootNode=b}return b}}});u(a,"Extensions/Breadcrumbs.js",[a["Core/Chart/Chart.js"],a["Core/Globals.js"],a["Core/DefaultOptions.js"],
|
|
a["Core/Utilities.js"],a["Core/FormatUtilities.js"]],function(a,c,f,g,e){var m=e.format;e=g.addEvent;var v=g.objectEach,k=g.extend,n=g.fireEvent,d=g.merge,b=g.pick,u=g.defined,B=g.isString;k(f.defaultOptions.lang,{mainBreadcrumb:"Main"});f=function(){function a(b,p){this.group=void 0;this.list=[];this.elementList={};this.isDirty=!0;this.level=0;this.options=void 0;p=d(b.options.drilldown&&b.options.drilldown.drillUpButton,a.defaultBreadcrumbsOptions,b.options.navigation&&b.options.navigation.breadcrumbs,
|
|
p);this.chart=b;this.options=p||{}}a.prototype.updateProperties=function(a){this.setList(a);this.setLevel();this.isDirty=!0};a.prototype.setList=function(a){this.list=a};a.prototype.setLevel=function(){this.level=this.list.length&&this.list.length-1};a.prototype.getLevel=function(){return this.level};a.prototype.getButtonText=function(a){var d=this.chart,l=this.options,c=d.options.lang,e=b(l.format,l.showFullPath?"{level.name}":"\u2190 {level.name}");c=c&&b(c.drillUpText,c.mainBreadcrumb);a=l.formatter&&
|
|
l.formatter(a)||m(e,{level:a.levelOptions},d)||"";(B(a)&&!a.length||"\u2190 "===a)&&u(c)&&(a=l.showFullPath?c:"\u2190 "+c);return a};a.prototype.redraw=function(){this.isDirty&&this.render();this.group&&this.group.align();this.isDirty=!1};a.prototype.render=function(){var a=this.chart,b=this.options;!this.group&&b&&(this.group=a.renderer.g("breadcrumbs-group").addClass("highcharts-no-tooltip highcharts-breadcrumbs").attr({zIndex:b.zIndex}).add());b.showFullPath?this.renderFullPathButtons():this.renderSingleButton();
|
|
this.alignBreadcrumbsGroup()};a.prototype.renderFullPathButtons=function(){this.destroySingleButton();this.resetElementListState();this.updateListElements();this.destroyListElements()};a.prototype.renderSingleButton=function(){var a=this.chart,b=this.list,d=this.options.buttonSpacing;this.destroyListElements();var c=this.group?this.group.getBBox().width:d;b=b[b.length-2];!a.drillUpButton&&0<this.level?a.drillUpButton=this.renderButton(b,c,d):a.drillUpButton&&(0<this.level?this.updateSingleButton():
|
|
this.destroySingleButton())};a.prototype.alignBreadcrumbsGroup=function(a){if(this.group){var c=this.options,l=c.buttonTheme,e=c.position,f="chart"===c.relativeTo||"spacingBox"===c.relativeTo?void 0:"scrollablePlotBox",g=this.group.getBBox();c=2*(l.padding||0)+c.buttonSpacing;e.width=g.width+c;e.height=g.height+c;g=d(e);a&&(g.x+=a);this.options.rtl&&(g.x+=e.width);g.y=b(g.y,this.yOffset,0);this.group.align(g,!0,f)}};a.prototype.renderButton=function(a,b,c){var l=this,e=this.chart,f=l.options,g=d(f.buttonTheme);
|
|
b=e.renderer.button(l.getButtonText(a),b,c,function(b){var c=f.events&&f.events.click,d;c&&(d=c.call(l,b,a));!1!==d&&(b.newLevel=f.showFullPath?a.level:l.level-1,n(l,"up",b))},g).addClass("highcharts-breadcrumbs-button").add(l.group);e.styledMode||b.attr(f.style);return b};a.prototype.renderSeparator=function(a,b){var c=this.chart,d=this.options.separator;a=c.renderer.label(d.text,a,b,void 0,void 0,void 0,!1).addClass("highcharts-breadcrumbs-separator").add(this.group);c.styledMode||a.css(d.style);
|
|
return a};a.prototype.update=function(a){d(!0,this.options,a);this.destroy();this.isDirty=!0};a.prototype.updateSingleButton=function(){var a=this.chart,b=this.list[this.level-1];a.drillUpButton&&a.drillUpButton.attr({text:this.getButtonText(b)})};a.prototype.destroy=function(){this.destroySingleButton();this.destroyListElements(!0);this.group&&this.group.destroy();this.group=void 0};a.prototype.destroyListElements=function(a){var b=this.elementList;v(b,function(c,d){if(a||!b[d].updated)c=b[d],c.button&&
|
|
c.button.destroy(),c.separator&&c.separator.destroy(),delete c.button,delete c.separator,delete b[d]});a&&(this.elementList={})};a.prototype.destroySingleButton=function(){this.chart.drillUpButton&&(this.chart.drillUpButton.destroy(),this.chart.drillUpButton=void 0)};a.prototype.resetElementListState=function(){v(this.elementList,function(a){a.updated=!1})};a.prototype.updateListElements=function(){var a=this,b=a.elementList,c=a.options.buttonSpacing,d=a.list,e=a.options.rtl,f=e?-1:1,g=function(a,
|
|
b){return f*a.getBBox().width+f*b},k=a.group?g(a.group,c):c,r;d.forEach(function(l,p){p=p===d.length-1;if(b[l.level]){r=b[l.level];var n=r.button;if(r.separator||p)r.separator&&p&&(r.separator.destroy(),delete r.separator);else{k+=f*c;r.separator=a.renderSeparator(k,c);if(e){var m=r.separator;m.translate(k-m.getBBox().width,c)}k+=g(r.separator,c)}b[l.level].updated=!0}else n=a.renderButton(l,k,c),e&&n.translate(k-n.getBBox().width,c),k+=g(n,c),p||(m=a.renderSeparator(k,c),e&&m.translate(k-m.getBBox().width,
|
|
c),k+=g(m,c)),b[l.level]={button:n,separator:m,updated:!0};n&&n.setState(p?2:0)})};a.defaultBreadcrumbsOptions={buttonTheme:{fill:"none",height:18,padding:2,"stroke-width":0,zIndex:7,states:{select:{fill:"none"}},style:{color:"#335cad"}},buttonSpacing:5,floating:!1,format:void 0,relativeTo:"plotBox",rtl:!1,position:{align:"left",verticalAlign:"top",x:0,y:void 0},separator:{text:"/",style:{color:"#666666"}},showFullPath:!0,style:{},useHTML:!1,zIndex:7};return a}();c.Breadcrumbs||(c.Breadcrumbs=f,e(a,
|
|
"getMargins",function(){var a=this.breadcrumbs;if(a&&!a.options.floating&&a.level){var b=a.options,c=b.buttonTheme;c=(c.height||0)+2*(c.padding||0)+b.buttonSpacing;b=b.position.verticalAlign;"bottom"===b?(this.marginBottom=(this.marginBottom||0)+c,a.yOffset=c):"middle"!==b?(this.plotTop+=c,a.yOffset=-c):a.yOffset=void 0}}),e(a,"redraw",function(){this.breadcrumbs&&this.breadcrumbs.redraw()}),e(a,"destroy",function(){this.breadcrumbs&&(this.breadcrumbs.destroy(),this.breadcrumbs=void 0)}),e(a,"afterShowResetZoom",
|
|
function(){if(this.breadcrumbs){var a=this.resetZoomButton&&this.resetZoomButton.getBBox(),b=this.breadcrumbs.options;a&&"right"===b.position.align&&"plotBox"===b.relativeTo&&this.breadcrumbs.alignBreadcrumbsGroup(-a.width-b.buttonSpacing)}}),e(a,"selection",function(a){!0===a.resetSelection&&this.breadcrumbs&&this.breadcrumbs.alignBreadcrumbsGroup()}));"";return f});u(a,"Series/Treemap/TreemapComposition.js",[a["Core/Series/SeriesRegistry.js"],a["Series/Treemap/TreemapUtilities.js"],a["Core/Utilities.js"]],
|
|
function(a,c,f){var g=f.addEvent,e=f.extend,m=!1;g(a.series,"afterBindAxes",function(){var a=this.xAxis,f=this.yAxis;if(a&&f)if(this.is("treemap")){var g={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,minPadding:0,max:c.AXIS_MAX,maxPadding:0,startOnTick:!1,title:void 0,tickPositions:[]};e(f.options,g);e(a.options,g);m=!0}else m&&(f.setOptions(f.userOptions),a.setOptions(a.userOptions),m=!1)})});u(a,"Series/Treemap/TreemapSeries.js",[a["Core/Color/Color.js"],a["Series/ColorMapComposition.js"],a["Core/Globals.js"],
|
|
a["Core/Legend/LegendSymbol.js"],a["Core/Series/SeriesRegistry.js"],a["Series/Treemap/TreemapAlgorithmGroup.js"],a["Series/Treemap/TreemapPoint.js"],a["Series/Treemap/TreemapUtilities.js"],a["Series/TreeUtilities.js"],a["Extensions/Breadcrumbs.js"],a["Core/Utilities.js"]],function(a,c,f,g,e,m,v,k,n,d,b){var u=this&&this.__extends||function(){var a=function(b,h){a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,h){a.__proto__=h}||function(a,h){for(var b in h)h.hasOwnProperty(b)&&
|
|
(a[b]=h[b])};return a(b,h)};return function(b,h){function q(){this.constructor=b}a(b,h);b.prototype=null===h?Object.create(h):(q.prototype=h.prototype,new q)}}(),B=a.parse;a=f.noop;var r=e.series;f=e.seriesTypes;var l=f.column,p=f.heatmap,w=f.scatter,x=n.getColor,L=n.getLevelOptions,M=n.updateRootId,C=b.addEvent,N=b.correctFloat,D=b.defined,O=b.error,F=b.extend,P=b.fireEvent,I=b.isArray,Q=b.isObject,H=b.isString,A=b.merge,z=b.pick,R=b.stableSort;n=function(a){function b(){var h=null!==a&&a.apply(this,
|
|
arguments)||this;h.axisRatio=void 0;h.data=void 0;h.mapOptionsToLevel=void 0;h.nodeMap=void 0;h.options=void 0;h.points=void 0;h.rootNode=void 0;h.tree=void 0;h.level=void 0;return h}u(b,a);b.prototype.algorithmCalcPoints=function(a,b,c,d){var h,q,t,e,f=c.lW,G=c.lH,g=c.plot,k=0,l=c.elArr.length-1;if(b)f=c.nW,G=c.nH;else var m=c.elArr[c.elArr.length-1];c.elArr.forEach(function(a){if(b||k<l)0===c.direction?(h=g.x,q=g.y,t=f,e=a/t):(h=g.x,q=g.y,e=G,t=a/e),d.push({x:h,y:q,width:t,height:N(e)}),0===c.direction?
|
|
g.y+=e:g.x+=t;k+=1});c.reset();0===c.direction?c.width-=f:c.height-=G;g.y=g.parent.y+(g.parent.height-c.height);g.x=g.parent.x+(g.parent.width-c.width);a&&(c.direction=1-c.direction);b||c.addElement(m)};b.prototype.algorithmFill=function(a,b,c){var h=[],q,d=b.direction,t=b.x,e=b.y,g=b.width,f=b.height,k,l,m,n;c.forEach(function(c){q=c.val/b.val*b.height*b.width;k=t;l=e;0===d?(n=f,m=q/n,g-=m,t+=m):(m=g,n=q/m,f-=n,e+=n);h.push({x:k,y:l,width:m,height:n});a&&(d=1-d)});return h};b.prototype.algorithmLowAspectRatio=
|
|
function(a,b,c){var h=[],q=this,d,t={x:b.x,y:b.y,parent:b},e=0,g=c.length-1,f=new m(b.height,b.width,b.direction,t);c.forEach(function(c){d=c.val/b.val*b.height*b.width;f.addElement(d);f.lP.nR>f.lP.lR&&q.algorithmCalcPoints(a,!1,f,h,t);e===g&&q.algorithmCalcPoints(a,!0,f,h,t);e+=1});return h};b.prototype.alignDataLabel=function(a,b,c){var h=c.style;h&&!D(h.textOverflow)&&b.text&&b.getBBox().width>b.text.textWidth&&b.css({textOverflow:"ellipsis",width:h.width+="px"});l.prototype.alignDataLabel.apply(this,
|
|
arguments);a.dataLabel&&a.dataLabel.attr({zIndex:(a.node.zIndex||0)+1})};b.prototype.buildNode=function(a,b,c,d,f){var h=this,q=[],t=h.points[b],e=0,g;(d[a]||[]).forEach(function(b){g=h.buildNode(h.points[b].id,b,c+1,d,a);e=Math.max(g.height+1,e);q.push(g)});b={id:a,i:b,children:q,height:e,level:c,parent:f,visible:!1};h.nodeMap[b.id]=b;t&&(t.node=b);return b};b.prototype.calculateChildrenAreas=function(a,b){var h=this,c=h.options,d=h.mapOptionsToLevel[a.level+1],q=z(h[d&&d.layoutAlgorithm]&&d.layoutAlgorithm,
|
|
c.layoutAlgorithm),e=c.alternateStartingDirection,f=[];a=a.children.filter(function(a){return!a.ignore});d&&d.layoutStartingDirection&&(b.direction="vertical"===d.layoutStartingDirection?0:1);f=h[q](b,a);a.forEach(function(a,c){c=f[c];a.values=A(c,{val:a.childrenTotal,direction:e?1-b.direction:b.direction});a.pointValues=A(c,{x:c.x/h.axisRatio,y:k.AXIS_MAX-c.y-c.height,width:c.width/h.axisRatio});a.children.length&&h.calculateChildrenAreas(a,a.values)})};b.prototype.createList=function(a){var b=this.chart,
|
|
h=[];if(b.breadcrumbs){var c=0;h.push({level:c,levelOptions:b.series[0]});b=a.target.nodeMap[a.newRootId];for(var d=[];b.parent||""===b.parent;)d.push(b),b=a.target.nodeMap[b.parent];d.reverse().forEach(function(a){h.push({level:++c,levelOptions:a})});1>=h.length&&(h.length=0)}return h};b.prototype.drawDataLabels=function(){var a=this,b=a.mapOptionsToLevel,c,d;a.points.filter(function(a){return a.node.visible}).forEach(function(h){d=b[h.node.level];c={style:{}};h.node.isLeaf||(c.enabled=!1);d&&d.dataLabels&&
|
|
(c=A(c,d.dataLabels),a._hasPointLabels=!0);h.shapeArgs&&(c.style.width=h.shapeArgs.width,h.dataLabel&&h.dataLabel.css({width:h.shapeArgs.width+"px"}));h.dlOptions=A(c,h.options.dataLabels)});r.prototype.drawDataLabels.call(this)};b.prototype.drawPoints=function(){var a=this,b=a.chart,c=b.renderer,d=b.styledMode,e=a.options,f=d?{}:e.shadow,g=e.borderRadius,k=b.pointCount<e.animationLimit,l=e.allowTraversingTree;a.points.forEach(function(b){var h=b.node.levelDynamic,q={},t={},K={},E="level-group-"+
|
|
b.node.level,J=!!b.graphic,m=k&&J,n=b.shapeArgs;b.shouldDraw()&&(b.isInside=!0,g&&(t.r=g),A(!0,m?q:t,J?n:{},d?{}:a.pointAttribs(b,b.selected?"select":void 0)),a.colorAttribs&&d&&F(K,a.colorAttribs(b)),a[E]||(a[E]=c.g(E).attr({zIndex:1E3-(h||0)}).add(a.group),a[E].survive=!0));b.draw({animatableAttribs:q,attribs:t,css:K,group:a[E],renderer:c,shadow:f,shapeArgs:n,shapeType:"rect"});l&&b.graphic&&(b.drillId=e.interactByLeaf?a.drillToByLeaf(b):a.drillToByGroup(b))})};b.prototype.drillToByGroup=function(a){var b=
|
|
!1;1!==a.node.level-this.nodeMap[this.rootNode].level||a.node.isLeaf||(b=a.id);return b};b.prototype.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};b.prototype.drillToNode=function(a,b){O(32,!1,void 0,{"treemap.drillToNode":"use treemap.setRootNode"});this.setRootNode(a,b)};b.prototype.drillUp=function(){var a=this.nodeMap[this.rootNode];a&&H(a.parent)&&this.setRootNode(a.parent,
|
|
!0,{trigger:"traverseUpButton"})};b.prototype.getExtremes=function(){var a=r.prototype.getExtremes.call(this,this.colorValueData),b=a.dataMax;this.valueMin=a.dataMin;this.valueMax=b;return r.prototype.getExtremes.call(this)};b.prototype.getListOfParents=function(a,b){a=I(a)?a:[];var c=I(b)?b:[];b=a.reduce(function(a,b,c){b=z(b.parent,"");"undefined"===typeof a[b]&&(a[b]=[]);a[b].push(c);return a},{"":[]});k.eachObject(b,function(a,b,h){""!==b&&-1===c.indexOf(b)&&(a.forEach(function(a){h[""].push(a)}),
|
|
delete h[b])});return b};b.prototype.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)};b.prototype.hasData=function(){return!!this.processedXData.length};b.prototype.init=function(a,b){var c=this,h=A(b.drillUpButton,b.breadcrumbs);var e=C(c,"setOptions",function(a){a=a.userOptions;D(a.allowDrillToNode)&&!D(a.allowTraversingTree)&&(a.allowTraversingTree=a.allowDrillToNode,delete a.allowDrillToNode);
|
|
D(a.drillUpButton)&&!D(a.traverseUpButton)&&(a.traverseUpButton=a.drillUpButton,delete a.drillUpButton)});r.prototype.init.call(c,a,b);delete c.opacity;c.eventsToUnbind.push(e);c.options.allowTraversingTree&&(c.eventsToUnbind.push(C(c,"click",c.onClickDrillToNode)),c.eventsToUnbind.push(C(c,"setRootNode",function(a){var b=c.chart;b.breadcrumbs&&b.breadcrumbs.updateProperties(c.createList(a))})),c.eventsToUnbind.push(C(c,"update",function(a,b){(b=this.chart.breadcrumbs)&&a.options.breadcrumbs&&b.update(a.options.breadcrumbs)})),
|
|
c.eventsToUnbind.push(C(c,"destroy",function(a){var b=this.chart;b.breadcrumbs&&(b.breadcrumbs.destroy(),a.keepEventsForUpdate||(b.breadcrumbs=void 0))})));a.breadcrumbs||(a.breadcrumbs=new d(a,h));c.eventsToUnbind.push(C(a.breadcrumbs,"up",function(a){a=this.level-a.newLevel;for(var b=0;b<a;b++)c.drillUp()}))};b.prototype.onClickDrillToNode=function(a){var b=(a=a.point)&&a.drillId;H(b)&&(a.setState(""),this.setRootNode(b,!0,{trigger:"click"}))};b.prototype.pointAttribs=function(a,b){var c=Q(this.mapOptionsToLevel)?
|
|
this.mapOptionsToLevel:{},h=a&&c[a.node.level]||{};c=this.options;var d=b&&c.states&&c.states[b]||{},e=a&&a.getClassName()||"";a={stroke:a&&a.borderColor||h.borderColor||d.borderColor||c.borderColor,"stroke-width":z(a&&a.borderWidth,h.borderWidth,d.borderWidth,c.borderWidth),dashstyle:a&&a.borderDashStyle||h.borderDashStyle||d.borderDashStyle||c.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")?
|
|
(b=z(d.opacity,c.opacity),a.fill=B(a.fill).setOpacity(b).get(),a.cursor="pointer"):-1!==e.indexOf("highcharts-internal-node")?a.fill="none":b&&(a.fill=B(a.fill).brighten(d.brightness).get());return a};b.prototype.setColorRecursive=function(a,b,c,d,e){var h=this,f=h&&h.chart;f=f&&f.options&&f.options.colors;if(a){var g=x(a,{colors:f,index:d,mapOptionsToLevel:h.mapOptionsToLevel,parentColor:b,parentColorIndex:c,series:h,siblings:e});if(b=h.points[a.i])b.color=g.color,b.colorIndex=g.colorIndex;(a.children||
|
|
[]).forEach(function(b,c){h.setColorRecursive(b,g.color,g.colorIndex,c,a.children.length)})}};b.prototype.setPointValues=function(){var a=this,b=a.xAxis,c=a.yAxis,d=a.chart.styledMode;a.points.forEach(function(h){var e=h.node,f=e.pointValues;e=e.visible;if(f&&e){e=f.height;var g=f.width,q=f.x,k=f.y,l=d?0:(a.pointAttribs(h)["stroke-width"]||0)%2/2;f=Math.round(b.toPixels(q,!0))-l;g=Math.round(b.toPixels(q+g,!0))-l;q=Math.round(c.toPixels(k,!0))-l;e=Math.round(c.toPixels(k+e,!0))-l;e={x:Math.min(f,
|
|
g),y:Math.min(q,e),width:Math.abs(g-f),height:Math.abs(e-q)};h.plotX=e.x+e.width/2;h.plotY=e.y+e.height/2;h.shapeArgs=e}else delete h.plotX,delete h.plotY})};b.prototype.setRootNode=function(a,b,c){a=F({newRootId:a,previousRootId:this.rootNode,redraw:z(b,!0),series:this},c);P(this,"setRootNode",a,function(a){var b=a.series;b.idPreviousRoot=a.previousRootId;b.rootNode=a.newRootId;b.isDirty=!0;a.redraw&&b.chart.redraw()})};b.prototype.setState=function(a){this.options.inactiveOtherPoints=!0;r.prototype.setState.call(this,
|
|
a,!1);this.options.inactiveOtherPoints=!1};b.prototype.setTreeValues=function(a){var b=this,c=b.options,h=b.nodeMap[b.rootNode];c=k.isBoolean(c.levelIsConstant)?c.levelIsConstant:!0;var d=0,e=[],f=b.points[a.i];a.children.forEach(function(a){a=b.setTreeValues(a);e.push(a);a.ignore||(d+=a.val)});R(e,function(a,b){return(a.sortIndex||0)-(b.sortIndex||0)});var g=z(f&&f.options.value,d);f&&(f.value=g);F(a,{children:e,childrenTotal:d,ignore:!(z(f&&f.visible,!0)&&0<g),isLeaf:a.visible&&!d,levelDynamic:a.level-
|
|
(c?0:h.level),name:z(f&&f.name,""),sortIndex:z(f&&f.sortIndex,-g),val:g});return a};b.prototype.sliceAndDice=function(a,b){return this.algorithmFill(!0,a,b)};b.prototype.squarified=function(a,b){return this.algorithmLowAspectRatio(!0,a,b)};b.prototype.strip=function(a,b){return this.algorithmLowAspectRatio(!1,a,b)};b.prototype.stripes=function(a,b){return this.algorithmFill(!1,a,b)};b.prototype.translate=function(){var a=this,b=a.options,c=M(a);r.prototype.translate.call(a);var d=a.tree=a.getTree();
|
|
var e=a.nodeMap[c];""===c||e&&e.children.length||(a.setRootNode("",!1),c=a.rootNode,e=a.nodeMap[c]);a.mapOptionsToLevel=L({from:e.level+1,levels:b.levels,to:d.height,defaults:{levelIsConstant:a.options.levelIsConstant,colorByPoint:b.colorByPoint}});k.recursive(a.nodeMap[a.rootNode],function(b){var c=!1,d=b.parent;b.visible=!0;if(d||""===d)c=a.nodeMap[d];return c});k.recursive(a.nodeMap[a.rootNode].children,function(a){var b=!1;a.forEach(function(a){a.visible=!0;a.children.length&&(b=(b||[]).concat(a.children))});
|
|
return b});a.setTreeValues(d);a.axisRatio=a.xAxis.len/a.yAxis.len;a.nodeMap[""].pointValues=c={x:0,y:0,width:k.AXIS_MAX,height:k.AXIS_MAX};a.nodeMap[""].values=c=A(c,{width:c.width*a.axisRatio,direction:"vertical"===b.layoutStartingDirection?0:1,val:d.val});a.calculateChildrenAreas(d,c);a.colorAxis||b.colorByPoint||a.setColorRecursive(a.tree);b.allowTraversingTree&&(b=e.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()};b.defaultOptions=A(w.defaultOptions,{allowTraversingTree:!1,animationLimit:250,borderRadius:0,showInLegend:!1,marker:void 0,colorByPoint:!1,dataLabels:{defer:!1,enabled:!0,formatter:function(){var a=this&&this.point?this.point:{};return H(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,traverseUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,colorKey:"colorValue",opacity:.15,states:{hover:{borderColor:"#999999",brightness:p?0:.1,halo:!1,opacity:.75,shadow:!1}}});return b}(w);F(n.prototype,{buildKDTree:a,colorAttribs:c.seriesMembers.colorAttribs,colorKey:"colorValue",directTouch:!0,drawLegendSymbol:g.drawRectangle,getExtremesFromAll:!0,getSymbol:a,optionalAxis:"colorAxis",parallelArrays:["x","y","value","colorValue"],pointArrayMap:["value"],
|
|
pointClass:v,trackerGroups:["group","dataLabelsGroup"],utils:{recursive:k.recursive}});c.compose(n);e.registerSeriesType("treemap",n);"";return n});u(a,"masters/modules/treemap.src.js",[a["Core/Globals.js"],a["Extensions/Breadcrumbs.js"]],function(a,c){a.Breadcrumbs=c})});
|
|
//# sourceMappingURL=treemap.js.map
|