8 lines
17 KiB
JavaScript
8 lines
17 KiB
JavaScript
|
!/**
|
||
|
* Highcharts JS v11.4.1 (2024-04-04)
|
||
|
* Treegraph chart series type
|
||
|
*
|
||
|
* (c) 2010-2024 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<e.length;s++){let o=e[s][1],r=e[s][2];if("number"==typeof o&&"number"==typeof r){if(0===s)i.push(["M",o,r]);else if(s===e.length-1)i.push(["L",o,r]);else if(t){let l=e[s-1],n=e[s+1];if(l&&n){let e=l[1],s=l[2],a=n[1],h=n[2];if("number"==typeof e&&"number"==typeof a&&"number"==typeof s&&"number"==typeof h&&e!==a&&s!==h){let l=e<a?1:-1,n=s<h?1:-1;i.push(["L",o-l*Math.min(Math.abs(o-e),t),r-n*Math.min(Math.abs(r-s),t)],["C",o,r,o,r,o+l*Math.min(Math.abs(o-a),t),r+n*Math.min(Math.abs(r-h),t)])}}}else i.push(["L",o,r])}}return i}return{applyRadius:e,getLinkPath:{default:function(t){let{x1:i,y1:s,x2:o,y2:r,width:l=0,inverted:n=!1,radius:a,parentVisible:h}=t,d=[["M",i,s],["L",i,s],["C",i,s,i,r,i,r],["L",i,r],["C",i,s,i,r,i,r],["L",i,r]];return h?e([["M",i,s],["L",i+l*(n?-.5:.5),s],["L",i+l*(n?-.5:.5),r],["L",o,r]],a):d},straight:function(e){let{x1:t,y1:i,x2:s,y2:o,width:r=0,inverted:l=!1,parentVisible:n}=e;return n?[["M",t,i],["L",t+r*(l?-1:1),o],["L",s,o]]:[["M",t,i],["L",t,o],["L",t,o]]},curved:function(e){let{x1:t,y1:i,x2:s,y2:o,offset:r=0,width:l=0,inverted:n=!1,parentVisible:a}=e;return a?[["M",t,i],["C",t+r,i,t-r+l*(n?-1:1),o,t+l*(n?-1:1),o],["L",s,o]]:[["M",t,i],["C",t,i,t,o,t,o],["L",s,o]]}}}}),i(t,"Series/Treegraph/TreegraphNode.js",[t["Core/Series/SeriesRegistry.js"]],function(e){let{seriesTypes:{treemap:{prototype:{NodeClass:t}}}}=e;return class extends t{constructor(){super(...arguments),this.mod=0,this.shift=0,this.change=0,this.children=[],this.preX=0,this.hidden=!1,this.wasVisited=!1,this.collapsed=!1}nextLeft(){return this.getLeftMostChild()||this.thread}nextRight(){return this.getRightMostChild()||this.thread}getAncestor(e,t){return e.ancestor.children[0]===this.children[0]?e.ancestor:t}getLeftMostSibling(){let e=this.getParent();if(e){for(let t of e.children)if(t&&t.point.visible)return t}}hasChildren(){let e=this.children;for(let t=0;t<e.length;t++)if(e[t].point.visible)return!0;return!1}getLeftSibling(){let e=this.getParent();if(e){let t=e.children;for(let e=this.relativeXPosition-1;e>=0;e--)if(t[e]&&t[e].point.visible)return t[e]}}getLeftMostChild(){let e=this.children;for(let t=0;t<e.length;t++)if(e[t].point.visible)return e[t]}getRightMostChild(){let e=this.children;for(let t=e.length-1;t>=0;t--)if(e[t].point.visible)return e[t]}getParent(){return this.parentNode}getFirstChild(){let e=this.children;for(let t=0;t<e.length;t++)if(e[t].point.visible)return e[t]}}}),i(t,"Series/Treegraph/TreegraphPoint.js",[t["Core/Series/Point.js"],t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(e,t,i){let{seriesTypes:{treemap:{prototype:{pointClass:s}}}}=t,{addEvent:o,fireEvent:r,merge:l}=i;class n extends s{constructor(){super(...arguments),this.dataLabelOnHidden=!0,this.isLink=!1,this.setState=e.prototype.setState}draw(){super.draw.apply(this,arguments);let e=this.graphic;e&&e.animate({visibility:this.visible?"inherit":"hidden"}),this.renderCollapseButton()}renderCollapseButton(){let e=this.series,t=this.graphic&&this.graphic.parentGroup,i=e.mapOptionsToLevel[this.node.level||0]||{},s=l(e.options.collapseButton,i.collapseButton,this.options.collapseButton),{width:o,height:r,shape:n,style:a}=s,h=this.series.chart,d=this.visible&&(this.collapsed||!s.onlyOnHover||"hover"===this.state)?1:0;if(this.shapeArgs){if(this.collapseButtonOptions=s,this.collapseButton){if(this.node.children.length&&s.enabled){let{x:e,y:t}=this.getCollapseBtnPosition(s);this.collapseButton.attr({text:this.collapsed?"+":"-"
|