9 lines
15 KiB
JavaScript
9 lines
15 KiB
JavaScript
|
!/**
|
||
|
* Highcharts Gantt JS v11.4.1 (2024-04-04)
|
||
|
*
|
||
|
* Pathfinder
|
||
|
*
|
||
|
* (c) 2016-2024 Øystein Moseng
|
||
|
*
|
||
|
* License: www.highcharts.com/license
|
||
|
*/function(t){"object"==typeof module&&module.exports?(t.default=t,module.exports=t):"function"==typeof define&&define.amd?define("highcharts/modules/pathfinder",["highcharts"],function(n){return t(n),t.Highcharts=n,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var n=t?t._modules:{};function e(t,n,e,i){t.hasOwnProperty(n)||(t[n]=i.apply(null,e),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:n,module:t[n]}})))}e(n,"Gantt/Connection.js",[n["Core/Globals.js"],n["Core/Utilities.js"]],function(t,n){let{defined:e,error:i,merge:r,objectEach:a}=n,o=t.deg2rad,s=Math.max,h=Math.min;return class{constructor(t,n,e){this.init(t,n,e)}init(t,n,e){this.fromPoint=t,this.toPoint=n,this.options=e,this.chart=t.series.chart,this.pathfinder=this.chart.pathfinder}renderPath(t,n){let e=this.chart,i=e.styledMode,r=this.pathfinder,a={},o=this.graphics&&this.graphics.path;r.group||(r.group=e.renderer.g().addClass("highcharts-pathfinder-group").attr({zIndex:-1}).add(e.seriesGroup)),r.group.translate(e.plotLeft,e.plotTop),o&&o.renderer||(o=e.renderer.path().add(r.group),i||o.attr({opacity:0})),o.attr(n),a.d=t,i||(a.opacity=1),o.animate(a),this.graphics=this.graphics||{},this.graphics.path=o}addMarker(t,n,e){let i,r,a,s,h,c,l,x;let M=this.fromPoint.series.chart,d=M.pathfinder,y=M.renderer,f="start"===t?this.fromPoint:this.toPoint,u=f.getPathfinderAnchorPoint(n);n.enabled&&((x="start"===t?e[1]:e[e.length-2])&&"M"===x[0]||"L"===x[0])&&(l={x:x[1],y:x[2]},r=f.getRadiansToVector(l,u),i=f.getMarkerVector(r,n.radius,u),a=-r/o,n.width&&n.height?(h=n.width,c=n.height):h=c=2*n.radius,this.graphics=this.graphics||{},s={x:i.x-h/2,y:i.y-c/2,width:h,height:c,rotation:a,rotationOriginX:i.x,rotationOriginY:i.y},this.graphics[t]?this.graphics[t].animate(s):(this.graphics[t]=y.symbol(n.symbol).addClass("highcharts-point-connecting-path-"+t+"-marker highcharts-color-"+this.fromPoint.colorIndex).attr(s).add(d.group),y.styledMode||this.graphics[t].attr({fill:n.color||this.fromPoint.color,stroke:n.lineColor,"stroke-width":n.lineWidth,opacity:0}).animate({opacity:1},f.series.options.animation)))}getPath(t){let n=this.pathfinder,e=this.chart,a=n.algorithms[t.type],o=n.chartObstacles;return"function"!=typeof a?(i('"'+t.type+'" is not a Pathfinder algorithm.'),{path:[],obstacles:[]}):(a.requiresObstacles&&!o&&(o=n.chartObstacles=n.getChartObstacles(t),e.options.connectors.algorithmMargin=t.algorithmMargin,n.chartObstacleMetrics=n.getObstacleMetrics(o)),a(this.fromPoint.getPathfinderAnchorPoint(t.startMarker),this.toPoint.getPathfinderAnchorPoint(t.endMarker),r({chartObstacles:o,lineObstacles:n.lineObstacles||[],obstacleMetrics:n.chartObstacleMetrics,hardBounds:{xMin:0,xMax:e.plotWidth,yMin:0,yMax:e.plotHeight},obstacleOptions:{margin:t.algorithmMargin},startDirectionX:n.getAlgorithmStartDirection(t.startMarker)},t)))}render(){let t=this.fromPoint,n=t.series,i=n.chart,a=i.pathfinder,o={},c=r(i.options.connectors,n.options.connectors,t.options.connectors,this.options);!i.styledMode&&(o.stroke=c.lineColor||t.color,o["stroke-width"]=c.lineWidth,c.dashStyle&&(o.dashstyle=c.dashStyle)),o.class="highcharts-point-connecting-path highcharts-color-"+t.colorIndex,e((c=r(o,c)).marker.radius)||(c.marker.radius=h(s(Math.ceil((c.algorithmMargin||8)/2)-1,1),5));let l=this.getPath(c),x=l.path;l.obstacles&&(a.lineObstacles=a.lineObstacles||[],a.lineObstacles=a.lineObstacles.concat(l.obstacles)),this.renderPath(x,o),this.addMarker("start",r(c.marker,c.startMarker),x),this.addMarker("end",r(c.marker,c.endMarker),x)}destroy(){this.graphics&&(a(this.graphics,function(t){t.destroy()}),delete this.graphics)}}}),e(n,"Series/PathUtilities.js",[],function(){function t(t,n){let e=[];for(let i=0;i<t.length;i++){let r=t[i][1],a=t[i][2];if("number"==typeof r&&"number"==typeof a){if(0===i)e.push(["M",r,a]);else if(i===t.length-1)e.push(["L",r,a]);else if(n){let o=t[i-1],s=t[i+1];if(o&&s){let t=o[1],i=o[2],h=s[1],c=s[2];if("number"==typeof t&&"number"==typeof h&&"number"==typeof i&&"number"==typeof c&&t!==h&&i!
|