UNPKG

highcharts

Version:
21 lines (18 loc) 5.37 kB
/* Highcharts JS v10.0.0 (2022-03-07) Dependency wheel module (c) 2010-2021 Torstein Honsi License: www.highcharts.com/license */ (function(b){"object"===typeof module&&module.exports?(b["default"]=b,module.exports=b):"function"===typeof define&&define.amd?define("highcharts/modules/dependency-wheel",["highcharts","highcharts/modules/sankey"],function(f){b(f);b.Highcharts=f;return b}):b("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(b){function f(b,h,f,e){b.hasOwnProperty(h)||(b[h]=e.apply(null,f),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:h,module:b[h]}})))} b=b?b._modules:{};f(b,"Series/DependencyWheel/DependencyWheelPoint.js",[b["Core/Series/SeriesRegistry.js"],b["Core/Utilities.js"]],function(b,f){var h=this&&this.__extends||function(){var b=function(d,a){b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var d in a)a.hasOwnProperty(d)&&(b[d]=a[d])};return b(d,a)};return function(d,a){function e(){this.constructor=d}b(d,a);d.prototype=null===a?Object.create(a):(e.prototype=a.prototype,new e)}}(); return function(b){function d(){var a=null!==b&&b.apply(this,arguments)||this;a.angle=void 0;a.fromNode=void 0;a.index=void 0;a.linksFrom=void 0;a.linksTo=void 0;a.options=void 0;a.series=void 0;a.shapeArgs=void 0;a.toNode=void 0;return a}h(d,b);d.prototype.getDataLabelPath=function(b){var a=this.series.chart.renderer,d=this.shapeArgs,e=0>this.angle||this.angle>Math.PI,f=d.start||0,h=d.end||0;this.dataLabelPath||(this.dataLabelPath=a.arc({open:!0,longArc:Math.abs(Math.abs(f)-Math.abs(h))<Math.PI? 0:1}).add(b));this.dataLabelPath.attr({x:d.x,y:d.y,r:d.r+(this.dataLabel.options.distance||0),start:e?f:h,end:e?h:f,clockwise:+e});return this.dataLabelPath};d.prototype.isValid=function(){return!0};return d}(b.seriesTypes.sankey.prototype.pointClass)});f(b,"Series/DependencyWheel/DependencyWheelSeries.js",[b["Core/Animation/AnimationUtilities.js"],b["Series/DependencyWheel/DependencyWheelPoint.js"],b["Series/Sankey/SankeyColumnComposition.js"],b["Core/Globals.js"],b["Core/Series/SeriesRegistry.js"], b["Core/Utilities.js"]],function(b,f,q,e,d,a){var h=this&&this.__extends||function(){var b=function(a,g){b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var g in a)a.hasOwnProperty(g)&&(b[g]=a[g])};return b(a,g)};return function(a,g){function d(){this.constructor=a}b(a,g);a.prototype=null===g?Object.create(g):(d.prototype=g.prototype,new d)}}(),r=b.animObject,t=e.deg2rad;e=d.seriesTypes;b=e.pie;var l=e.sankey;e=a.extend;var u=a.merge;a=function(b){function a(){var a= null!==b&&b.apply(this,arguments)||this;a.data=void 0;a.options=void 0;a.nodeColumns=void 0;a.nodes=void 0;a.points=void 0;return a}h(a,b);a.prototype.animate=function(a){if(!a){var b=r(this.options.animation).duration/2/this.nodes.length;this.nodes.forEach(function(a,d){var g=a.graphic;g&&(g.attr({opacity:0}),setTimeout(function(){a.graphic&&a.graphic.animate({opacity:1},{duration:b})},b*d))},this);this.points.forEach(function(a){var b=a.graphic;!a.isNode&&b&&b.attr({opacity:0}).animate({opacity:1}, this.options.animation)},this)}};a.prototype.createNode=function(a){var b=l.prototype.createNode.call(this,a);b.getSum=function(){return b.linksFrom.concat(b.linksTo).reduce(function(b,a){return b+a.weight},0)};b.offset=function(a){function d(a){return a.fromNode===b?a.toNode:a.fromNode}var g=0,c,f=b.linksFrom.concat(b.linksTo);f.sort(function(a,b){return d(a).index-d(b).index});for(c=0;c<f.length;c++)if(d(f[c]).index>b.index){f=f.slice(0,c).reverse().concat(f.slice(c).reverse());var e=!0;break}e|| f.reverse();for(c=0;c<f.length;c++){if(f[c]===a)return g;g+=f[c].weight}};return b};a.prototype.createNodeColumns=function(){var a=[q.compose([],this)];this.nodes.forEach(function(b){b.column=0;a[0].push(b)});return a};a.prototype.getNodePadding=function(){return this.options.nodePadding/Math.PI};a.prototype.translate=function(){var a=this.options,b=2*Math.PI/(this.chart.plotHeight+this.getNodePadding()),d=this.getCenter(),f=(a.startAngle-90)*t;l.prototype.translate.call(this);this.nodeColumns[0].forEach(function(e){if(e.sum){var c= e.shapeArgs,g=d[0],h=d[1],l=d[2]/2,k=l-a.nodeWidth,m=f+b*(c.y||0);c=f+b*((c.y||0)+(c.height||0));e.angle=m+(c-m)/2;e.shapeType="arc";e.shapeArgs={x:g,y:h,r:l,innerR:k,start:m,end:c};e.dlBox={x:g+Math.cos((m+c)/2)*(l+k)/2,y:h+Math.sin((m+c)/2)*(l+k)/2,width:1,height:1};e.linksFrom.forEach(function(d){if(d.linkBase){var e,c=d.linkBase.map(function(c,l){c*=b;var m=Math.cos(f+c)*(k+1),p=Math.sin(f+c)*(k+1),n=a.curveFactor||0;e=Math.abs(d.linkBase[3-l]*b-c);e>Math.PI&&(e=2*Math.PI-e);e*=k;e<k&&(n*=e/k); return{x:g+m,y:h+p,cpX:g+(1-n)*m,cpY:h+(1-n)*p}});d.shapeArgs={d:[["M",c[0].x,c[0].y],["A",k,k,0,0,1,c[1].x,c[1].y],["C",c[1].cpX,c[1].cpY,c[2].cpX,c[2].cpY,c[2].x,c[2].y],["A",k,k,0,0,1,c[3].x,c[3].y],["C",c[3].cpX,c[3].cpY,c[0].cpX,c[0].cpY,c[0].x,c[0].y]]}}})}})};a.defaultOptions=u(l.defaultOptions,{center:[null,null],curveFactor:.6,startAngle:0});return a}(l);e(a.prototype,{orderNodes:!1,getCenter:b.prototype.getCenter});a.prototype.pointClass=f;d.registerSeriesType("dependencywheel",a);"";return a}); f(b,"masters/modules/dependency-wheel.src.js",[],function(){})}); //# sourceMappingURL=dependency-wheel.js.map