/** * Highcharts JS v11.2.0 (2023-10-30) * Treegraph chart series type * * (c) 2010-2022 Pawel Lysy Grzegorz Blachlinski * * License: www.highcharts.com/license */!function(e){"object"==typeof module&&module.exports?(e.default=e,module.exports=e):"function"==typeof define&&define.amd?define("highcharts/modules/treegraph",["highcharts","highcharts/modules/treemap"],function(t){return e(t),e.Highcharts=t,e}):e("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){"use strict";var t=e?e._modules:{};function i(e,t,i,s){e.hasOwnProperty(t)||(e[t]=s.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}i(t,"Series/PathUtilities.js",[],function(){function e(e,t){let i=[];for(let s=0;s=0;e--)if(t[e]&&t[e].point.visible)return t[e]}}getLeftMostChild(){let e=this.children;for(let t=0;t=0;t--)if(e[t].point.visible)return e[t]}getParent(){return this.parentNode}getFirstChild(){let e=this.children;for(let t=0;t1){let o=s.level-i.level-1;for(;o>0;)s=t.createDummyNode(i,s,o,e),o--}++e}}}resetValues(e){for(let t of e)t.mod=0,t.ancestor=t,t.shift=0,t.thread=void 0,t.change=0,t.preX=0}calculateRelativeX(e,t){let i=e.children;for(let e=0,t=i.length;e=0;s--){let o=e.children[s];o.preX+=t,o.mod+=t,i+=o.change,t+=o.shift+i}}apportion(e,t){let i=e.getLeftSibling();if(i){let s=e,o=e,r=i,l=s.getLeftMostSibling(),n=s.mod,a=o.mod,h=r.mod,d=l.mod;for(;r&&r.nextRight()&&s&&s.nextLeft();){r=r.nextRight(),l=l.nextLeft(),s=s.nextLeft(),(o=o.nextRight()).ancestor=e;let i=r.preX+h-(s.preX+n)+1;i>0&&(this.moveSubtree(e.getAncestor(r,t),e,i),n+=i,a+=i),h+=r.mod,n+=s.mod,d+=l.mod,a+=o.mod}r&&r.nextRight()&&!o.nextRight()&&(o.thread=r.nextRight(),o.mod+=h-a),s&&s.nextLeft()&&!l.nextLeft()&&(l.thread=s.nextLeft(),l.mod+=n-d),t=e}return t}moveSubtree(e,t,i){let s=t.relativeXPosition-e.relativeXPosition;t.change-=i/s,t.shift+=i,t.preX+=i,t.mod+=i,e.change+=i/s}afterLayout(e){for(let t of e)t.oldParentNode&&(t.relativeXPosition=t.parentNode.relativeXPosition,t.parent=t.oldParentNode.parent,t.parentNode=t.oldParentNode,delete t.oldParentNode.children[t.relativeXPosition],t.oldParentNode.children[t.relativeXPosition]=t,t.oldParentNode=void 0)}}return t}),i(t,"Series/Treegraph/TreegraphSeriesDefaults.js",[],function(){return{reversed:!1,marker:{radius:10,lineWidth:0,symbol:"circle",fillOpacity:1,states:{}},link:{color:"#666666",lineWidth:1,radius:10,cursor:"default",type:"curved"},collapseButton:{onlyOnHover:!0,enabled:!0,lineWidth:1,x:0,y:0,height:18,width:18,shape:"circle",style:{cursor:"pointer",fontWeight:"bold",fontSize:"1em"}},fillSpace:!1,tooltip:{linkFormat:"{point.fromNode.id} → {point.toNode.id}",pointFormat:"{point.id}"},dataLabels:{defer:!0,linkTextPath:{attributes:{startOffset:"50%"}},enabled:!0,linkFormatter:()=>"",style:{textOverflow:"none"}}}}),i(t,"Series/Treegraph/TreegraphSeries.js",[t["Series/PathUtilities.js"],t["Core/Series/SeriesRegistry.js"],t["Core/Renderer/SVG/SVGRenderer.js"],t["Series/Treegraph/TreegraphNode.js"],t["Series/Treegraph/TreegraphPoint.js"],t["Series/TreeUtilities.js"],t["Core/Utilities.js"],t["Series/Treegraph/TreegraphLink.js"],t["Series/Treegraph/TreegraphLayout.js"],t["Series/Treegraph/TreegraphSeriesDefaults.js"]],function(e,t,i,s,o,r,l,n,a,h){let{getLinkPath:d}=e,{series:{prototype:p},seriesTypes:{treemap:c,column:u}}=t,{prototype:{symbols:f}}=i,{getLevelOptions:g}=r,{extend:v,merge:y,pick:m,relativeLength:k,splat:b}=l;class L extends c{constructor(){super(...arguments),this.data=void 0,this.options=void 0,this.points=void 0,this.layoutModifier=void 0,this.nodeMap=void 0,this.tree=void 0,this.nodeList=[],this.layoutAlgorythm=void 0,this.links=[],this.mapOptionsToLevel=void 0}init(){super.init.apply(this,arguments),this.layoutAlgorythm=new a}getLayoutModifiers(){let e=this.chart,t=this,i=e.plotSizeX,s=e.plotSizeY,o=1/0,r=-1/0,l=1/0,n=-1/0,a=0,h=0,d=0,p=0;this.points.forEach(e=>{if(this.options.fillSpace&&!e.visible)return;let c=e.node,u=t.mapOptionsToLevel[e.node.level]||{},f=y(this.options.marker,u.marker,e.options.marker),g=k(f.radius||0,Math.min(i,s)),v=f.symbol,m="circle"!==v&&f.height?k(f.height,s):2*g,b="circle"!==v&&f.width?k(f.width,i):2*g;c.nodeSizeX=b,c.nodeSizeY=m,c.xPosition<=o&&(o=c.xPosition,h=Math.max(b+(f.lineWidth||0),h)),c.xPosition>=r&&(r=c.xPosition,a=Math.max(b+(f.lineWidth||0),a)),c.yPosition<=l&&(l=c.yPosition,p=Math.max(m+(f.lineWidth||0),p)),c.yPosition>=n&&(n=c.yPosition,d=Math.max(m+(f.lineWidth||0),d))});let c=n===l?1:(s-(p+d)/2)/(n-l),u=n===l?s/2:-c*l+p/2,f=r===o?1:(i-(a+a)/2)/(r-o),g=r===o?i/2:-f*o+h/2;return{ax:f,bx:g,ay:c,by:u}}getLinks(){let e=this,t=[];return this.data.forEach((i,s)=>{let o=e.mapOptionsToLevel[i.node.level||0]||{};if(i.node.parent){let s=y(o,i.options);if(!i.linkToParent||i.linkToParent.destroyed){let t=new e.LinkClass().init(e,s,void 0,i);i.linkToParent=t}else i.collapsed=m(i.collapsed,(this.mapOptionsToLevel[i.node.level]||{}).collapsed),i.linkToParent.visible=i.linkToParent.toNode.visible;i.linkToParent.index=t.push(i.linkToParent)-1}else i.linkToParent&&(e.links.splice(i.linkToParent.index),i.linkToParent.destroy(),delete i.linkToParent)}),t}buildTree(e,t,i,s,o){let r=this.points[t];return i=r&&r.level||i,super.buildTree.call(this,e,t,i,s,o)}markerAttribs(){return{}}setCollapsedStatus(e,t){let i=e.point;i&&(i.collapsed=m(i.collapsed,(this.mapOptionsToLevel[e.level]||{}).collapsed),i.visible=t,t=!1!==t&&!i.collapsed),e.children.forEach(e=>{this.setCollapsedStatus(e,t)})}drawTracker(){u.prototype.drawTracker.apply(this,arguments),u.prototype.drawTracker.call(this,this.links)}translate(){let e=this.options,t=r.updateRootId(this),i;p.translate.call(this);let s=this.tree=this.getTree();i=this.nodeMap[t],""===t||i&&i.children.length||(this.setRootNode("",!1),t=this.rootNode,i=this.nodeMap[t]),this.mapOptionsToLevel=g({from:i.level+1,levels:e.levels,to:s.height,defaults:{levelIsConstant:this.options.levelIsConstant,colorByPoint:e.colorByPoint}}),this.setCollapsedStatus(s,!0),this.links=this.getLinks(),this.setTreeValues(s),this.layoutAlgorythm.calculatePositions(this),this.layoutModifier=this.getLayoutModifiers(),this.points.forEach(e=>{this.translateNode(e)}),this.points.forEach(e=>{e.linkToParent&&this.translateLink(e.linkToParent)}),e.colorByPoint||this.setColorRecursive(this.tree)}translateLink(e){let t=e.fromNode,i=e.toNode,s=this.options.link.lineWidth,o=Math.round(s)%2/2,r=m(this.options.link.curveFactor,.5),l=m(e.options.link&&e.options.link.type,this.options.link.type);if(t.shapeArgs&&i.shapeArgs){let n=t.shapeArgs.width||0,a=this.chart.inverted,h=Math.floor((t.shapeArgs.y||0)+(t.shapeArgs.height||0)/2)+o,p=Math.floor((i.shapeArgs.y||0)+(i.shapeArgs.height||0)/2)+o,c=Math.floor((t.shapeArgs.x||0)+n)+o,u=Math.floor(i.shapeArgs.x||0)+o;a&&(c-=n,u+=i.shapeArgs.width||0);let f=i.node.xPosition-t.node.xPosition;e.shapeType="path";let g=Math.abs(u-c)+n,v=g/f-n,y=v*r*(a?-1:1),m=Math.floor((u+c)/2)+o;e.plotX=m,e.plotY=p,e.shapeArgs={d:d[l]({x1:c,y1:h,x2:u,y2:p,width:v,offset:y,inverted:a,parentVisible:i.visible,radius:this.options.link.radius})},e.dlBox={x:(c+u)/2,y:(h+p)/2,height:s,width:0},e.tooltipPos=a?[(this.chart.plotSizeY||0)-e.dlBox.y,(this.chart.plotSizeX||0)-e.dlBox.x]:[e.dlBox.x,e.dlBox.y]}}drawNodeLabels(e){let t,i;let s=this.mapOptionsToLevel;for(let o of e)i=s[o.node.level],t={style:{}},i&&i.dataLabels&&(t=y(t,i.dataLabels),this.hasDataLabels=()=>!0),o.shapeArgs&&!b(this.options.dataLabels)[0].style.width&&(t.style.width=o.shapeArgs.width,o.dataLabel&&o.dataLabel.css({width:o.shapeArgs.width+"px"})),o.dlOptions=y(t,o.options.dataLabels);p.drawDataLabels.call(this,e)}alignDataLabel(e,t){let i=e.visible;e.visible=!0,super.alignDataLabel.apply(this,arguments),t.animate({opacity:!1===i?0:1},void 0,function(){i||t.hide()}),e.visible=i}drawDataLabels(){this.options.dataLabels&&(this.options.dataLabels=b(this.options.dataLabels),this.drawNodeLabels(this.points),p.drawDataLabels.call(this,this.links))}destroy(){if(this.links){for(let e of this.links)e.destroy();this.links.length=0}return p.destroy.apply(this,arguments)}pointAttribs(e,t){let i=e&&this.mapOptionsToLevel[e.node.level||0]||{},s=e&&e.options,o=i.states&&i.states[t]||{};e&&(e.options.marker=y(this.options.marker,i.marker,e.options.marker));let r=m(o&&o.link&&o.link.color,s&&s.link&&s.link.color,i&&i.link&&i.link.color,this.options.link&&this.options.link.color),l=m(o&&o.link&&o.link.lineWidth,s&&s.link&&s.link.lineWidth,i&&i.link&&i.link.lineWidth,this.options.link&&this.options.link.lineWidth),n=p.pointAttribs.call(this,e,t);return e&&(e.isLink&&(n.stroke=r,n["stroke-width"]=l,delete n.fill),e.visible||(n.opacity=0)),n}drawPoints(){c.prototype.drawPoints.apply(this,arguments),u.prototype.drawPoints.call(this,this.links)}translateNode(e){let t=this.chart,i=e.node,s=t.plotSizeY,o=t.plotSizeX,{ax:r,bx:l,ay:n,by:a}=this.layoutModifier,h=r*i.xPosition+l,d=n*i.yPosition+a,p=this.mapOptionsToLevel[i.level]||{},c=y(this.options.marker,p.marker,e.options.marker),u=c.symbol,g=i.nodeSizeY,k=i.nodeSizeX,b=this.options.reversed,L=i.x=t.inverted?o-k/2-h:h-k/2,P=i.y=b?d-g/2:s-d-g/2,T=m(e.options.borderRadius,p.borderRadius,this.options.borderRadius),x=f[u||"circle"];if(void 0===x?(e.hasImage=!0,e.shapeType="image",e.imageUrl=u.match(/^url\((.*?)\)$/)[1]):e.shapeType="path",!e.visible&&e.linkToParent){let t=e.linkToParent.fromNode;if(t){let i=t.shapeArgs||{},{x:s=0,y:o=0,width:r=0,height:l=0}=i;e.shapeArgs||(e.shapeArgs={}),e.hasImage||v(e.shapeArgs,{d:x(s,o,r,l,T?{r:T}:void 0)}),v(e.shapeArgs,{x:s,y:o}),e.plotX=t.plotX,e.plotY=t.plotY}}else e.plotX=L,e.plotY=P,e.shapeArgs={x:L,y:P,width:k,height:g,cursor:e.node.isLeaf?"default":"pointer"},e.hasImage||(e.shapeArgs.d=x(L,P,k,g,T?{r:T}:void 0));e.tooltipPos=t.inverted?[s-P-g/2,o-L-k/2]:[L+k/2,P]}}return L.defaultOptions=y(c.defaultOptions,h),v(L.prototype,{pointClass:o,NodeClass:s,LinkClass:n}),t.registerSeriesType("treegraph",L),L}),i(t,"masters/modules/treegraph.src.js",[],function(){})});//# sourceMappingURL=treegraph.js.map