UNPKG

highcharts

Version:
106 lines (103 loc) 80.4 kB
/* Highcharts JS v8.2.0 (2020-08-20) Annotations module (c) 2009-2019 Torstein Honsi License: www.highcharts.com/license */ (function(d){"object"===typeof module&&module.exports?(d["default"]=d,module.exports=d):"function"===typeof define&&define.amd?define("highcharts/modules/annotations-advanced",["highcharts"],function(u){d(u);d.Highcharts=u;return d}):d("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(d){function u(l,d,p,h){l.hasOwnProperty(d)||(l[d]=h.apply(null,p))}d=d?d._modules:{};u(d,"Extensions/Annotations/Mixins/EventEmitterMixin.js",[d["Core/Globals.js"],d["Core/Utilities.js"]],function(l,d){var k= d.addEvent,h=d.fireEvent,w=d.objectEach,e=d.pick,g=d.removeEvent;return{addEvents:function(){var c=this,b=function(b){k(b,l.isTouchDevice?"touchstart":"mousedown",function(b){c.onMouseDown(b)})};b(this.graphic.element);(c.labels||[]).forEach(function(a){a.options.useHTML&&a.graphic.text&&b(a.graphic.text.element)});w(c.options.events,function(b,a){var f=function(f){"click"===a&&c.cancelClick||b.call(c,c.chart.pointer.normalize(f),c.target)};if(-1===(c.nonDOMEvents||[]).indexOf(a))c.graphic.on(a,f); else k(c,a,f)});if(c.options.draggable&&(k(c,"drag",c.onDrag),!c.graphic.renderer.styledMode)){var a={cursor:{x:"ew-resize",y:"ns-resize",xy:"move"}[c.options.draggable]};c.graphic.css(a);(c.labels||[]).forEach(function(b){b.options.useHTML&&b.graphic.text&&b.graphic.text.css(a)})}c.isUpdating||h(c,"add")},removeDocEvents:function(){this.removeDrag&&(this.removeDrag=this.removeDrag());this.removeMouseUp&&(this.removeMouseUp=this.removeMouseUp())},onMouseDown:function(c){var b=this,a=b.chart.pointer; c.preventDefault&&c.preventDefault();if(2!==c.button){c=a.normalize(c);var f=c.chartX;var n=c.chartY;b.cancelClick=!1;b.chart.hasDraggedAnnotation=!0;b.removeDrag=k(l.doc,l.isTouchDevice?"touchmove":"mousemove",function(c){b.hasDragged=!0;c=a.normalize(c);c.prevChartX=f;c.prevChartY=n;h(b,"drag",c);f=c.chartX;n=c.chartY});b.removeMouseUp=k(l.doc,l.isTouchDevice?"touchend":"mouseup",function(a){b.cancelClick=b.hasDragged;b.hasDragged=!1;b.chart.hasDraggedAnnotation=!1;h(e(b.target,b),"afterUpdate"); b.onMouseUp(a)})}},onMouseUp:function(c){var b=this.chart;c=this.target||this;var a=b.options.annotations;b=b.annotations.indexOf(c);this.removeDocEvents();a[b]=c.options},onDrag:function(c){if(this.chart.isInsidePlot(c.chartX-this.chart.plotLeft,c.chartY-this.chart.plotTop)){var b=this.mouseMoveToTranslation(c);"x"===this.options.draggable&&(b.y=0);"y"===this.options.draggable&&(b.x=0);this.points.length?this.translate(b.x,b.y):(this.shapes.forEach(function(a){a.translate(b.x,b.y)}),this.labels.forEach(function(a){a.translate(b.x, b.y)}));this.redraw(!1)}},mouseMoveToRadians:function(c,b,a){var f=c.prevChartY-a,n=c.prevChartX-b;a=c.chartY-a;c=c.chartX-b;this.chart.inverted&&(b=n,n=f,f=b,b=c,c=a,a=b);return Math.atan2(a,c)-Math.atan2(f,n)},mouseMoveToTranslation:function(c){var b=c.chartX-c.prevChartX;c=c.chartY-c.prevChartY;if(this.chart.inverted){var a=c;c=b;b=a}return{x:b,y:c}},mouseMoveToScale:function(c,b,a){b=(c.chartX-b||1)/(c.prevChartX-b||1);c=(c.chartY-a||1)/(c.prevChartY-a||1);this.chart.inverted&&(a=c,c=b,b=a);return{x:b, y:c}},destroy:function(){this.removeDocEvents();g(this);this.hcEvents=null}}});u(d,"Extensions/Annotations/ControlPoint.js",[d["Core/Utilities.js"],d["Extensions/Annotations/Mixins/EventEmitterMixin.js"]],function(l,d){var k=l.merge,h=l.pick;return function(){function l(e,g,c,b){this.addEvents=d.addEvents;this.graphic=void 0;this.mouseMoveToRadians=d.mouseMoveToRadians;this.mouseMoveToScale=d.mouseMoveToScale;this.mouseMoveToTranslation=d.mouseMoveToTranslation;this.onDrag=d.onDrag;this.onMouseDown= d.onMouseDown;this.onMouseUp=d.onMouseUp;this.removeDocEvents=d.removeDocEvents;this.nonDOMEvents=["drag"];this.chart=e;this.target=g;this.options=c;this.index=h(c.index,b)}l.prototype.setVisibility=function(e){this.graphic.attr("visibility",e?"visible":"hidden");this.options.visible=e};l.prototype.render=function(){var e=this.chart,g=this.options;this.graphic=e.renderer.symbol(g.symbol,0,0,g.width,g.height).add(e.controlPointsGroup).css(g.style);this.setVisibility(g.visible);this.addEvents()};l.prototype.redraw= function(e){this.graphic[e?"animate":"attr"](this.options.positioner.call(this,this.target))};l.prototype.destroy=function(){d.destroy.call(this);this.graphic&&(this.graphic=this.graphic.destroy());this.options=this.target=this.chart=null};l.prototype.update=function(e){var g=this.chart,c=this.target,b=this.index;e=k(!0,this.options,e);this.destroy();this.constructor(g,c,e,b);this.render(g.controlPointsGroup);this.redraw()};return l}()});u(d,"Extensions/Annotations/MockPoint.js",[d["Core/Globals.js"], d["Core/Utilities.js"]],function(l,d){var k=d.defined,h=d.fireEvent;return function(){function d(e,g,c){this.y=this.x=this.plotY=this.plotX=this.isInside=void 0;this.mock=!0;this.series={visible:!0,chart:e,getPlotBox:l.Series.prototype.getPlotBox};this.target=g||null;this.options=c;this.applyOptions(this.getOptions())}d.fromPoint=function(e){return new d(e.series.chart,null,{x:e.x,y:e.y,xAxis:e.series.xAxis,yAxis:e.series.yAxis})};d.pointToPixels=function(e,g){var c=e.series,b=c.chart,a=e.plotX,f= e.plotY;b.inverted&&(e.mock?(a=e.plotY,f=e.plotX):(a=b.plotWidth-e.plotY,f=b.plotHeight-e.plotX));c&&!g&&(e=c.getPlotBox(),a+=e.translateX,f+=e.translateY);return{x:a,y:f}};d.pointToOptions=function(e){return{x:e.x,y:e.y,xAxis:e.series.xAxis,yAxis:e.series.yAxis}};d.prototype.hasDynamicOptions=function(){return"function"===typeof this.options};d.prototype.getOptions=function(){return this.hasDynamicOptions()?this.options(this.target):this.options};d.prototype.applyOptions=function(e){this.command= e.command;this.setAxis(e,"x");this.setAxis(e,"y");this.refresh()};d.prototype.setAxis=function(e,g){g+="Axis";e=e[g];var c=this.series.chart;this.series[g]=e instanceof l.Axis?e:k(e)?c[g][e]||c.get(e):null};d.prototype.toAnchor=function(){var e=[this.plotX,this.plotY,0,0];this.series.chart.inverted&&(e[0]=this.plotY,e[1]=this.plotX);return e};d.prototype.getLabelConfig=function(){return{x:this.x,y:this.y,point:this}};d.prototype.isInsidePlot=function(){var e=this.plotX,g=this.plotY,c=this.series.xAxis, b=this.series.yAxis,a={x:e,y:g,isInsidePlot:!0};c&&(a.isInsidePlot=k(e)&&0<=e&&e<=c.len);b&&(a.isInsidePlot=a.isInsidePlot&&k(g)&&0<=g&&g<=b.len);h(this.series.chart,"afterIsInsidePlot",a);return a.isInsidePlot};d.prototype.refresh=function(){var e=this.series,g=e.xAxis;e=e.yAxis;var c=this.getOptions();g?(this.x=c.x,this.plotX=g.toPixels(c.x,!0)):(this.x=null,this.plotX=c.x);e?(this.y=c.y,this.plotY=e.toPixels(c.y,!0)):(this.y=null,this.plotY=c.y);this.isInside=this.isInsidePlot()};d.prototype.translate= function(e,g,c,b){this.hasDynamicOptions()||(this.plotX+=c,this.plotY+=b,this.refreshOptions())};d.prototype.scale=function(e,g,c,b){if(!this.hasDynamicOptions()){var a=this.plotY*b;this.plotX=(1-c)*e+this.plotX*c;this.plotY=(1-b)*g+a;this.refreshOptions()}};d.prototype.rotate=function(e,g,c){if(!this.hasDynamicOptions()){var b=Math.cos(c);c=Math.sin(c);var a=this.plotX,f=this.plotY;a-=e;f-=g;this.plotX=a*b-f*c+e;this.plotY=a*c+f*b+g;this.refreshOptions()}};d.prototype.refreshOptions=function(){var e= this.series,g=e.xAxis;e=e.yAxis;this.x=this.options.x=g?this.options.x=g.toValue(this.plotX,!0):this.plotX;this.y=this.options.y=e?e.toValue(this.plotY,!0):this.plotY};return d}()});u(d,"Extensions/Annotations/Mixins/ControllableMixin.js",[d["Extensions/Annotations/ControlPoint.js"],d["Extensions/Annotations/MockPoint.js"],d["Core/Tooltip.js"],d["Core/Utilities.js"]],function(l,d,p,h){var k=h.isObject,e=h.isString,g=h.merge,c=h.splat;return{init:function(b,a,c){this.annotation=b;this.chart=b.chart; this.options=a;this.points=[];this.controlPoints=[];this.index=c;this.linkPoints();this.addControlPoints()},attr:function(){this.graphic.attr.apply(this.graphic,arguments)},getPointsOptions:function(){var b=this.options;return b.points||b.point&&c(b.point)},attrsFromOptions:function(b){var a=this.constructor.attrsMap,c={},n,q=this.chart.styledMode;for(n in b){var e=a[n];!e||q&&-1!==["fill","stroke","stroke-width"].indexOf(e)||(c[e]=b[n])}return c},anchor:function(b){var a=b.series.getPlotBox();b= b.mock?b.toAnchor():p.prototype.getAnchor.call({chart:b.series.chart},b);b={x:b[0]+(this.options.x||0),y:b[1]+(this.options.y||0),height:b[2]||0,width:b[3]||0};return{relativePosition:b,absolutePosition:g(b,{x:b.x+a.translateX,y:b.y+a.translateY})}},point:function(b,a){if(b&&b.series)return b;a&&null!==a.series||(k(b)?a=new d(this.chart,this,b):e(b)?a=this.chart.get(b)||null:"function"===typeof b&&(a=b.call(a,this),a=a.series?a:new d(this.chart,this,b)));return a},linkPoints:function(){var b=this.getPointsOptions(), a=this.points,c=b&&b.length||0,n;for(n=0;n<c;n++){var q=this.point(b[n],a[n]);if(!q){a.length=0;return}q.mock&&q.refresh();a[n]=q}return a},addControlPoints:function(){var b=this.options.controlPoints;(b||[]).forEach(function(a,c){a=g(this.options.controlPointOptions,a);a.index||(a.index=c);b[c]=a;this.controlPoints.push(new l(this.chart,this,a))},this)},shouldBeDrawn:function(){return!!this.points.length},render:function(b){this.controlPoints.forEach(function(b){b.render()})},redraw:function(b){this.controlPoints.forEach(function(a){a.redraw(b)})}, transform:function(b,a,c,n,q){if(this.chart.inverted){var f=a;a=c;c=f}this.points.forEach(function(f,e){this.transformPoint(b,a,c,n,q,e)},this)},transformPoint:function(b,a,c,n,q,e){var f=this.points[e];f.mock||(f=this.points[e]=d.fromPoint(f));f[b](a,c,n,q)},translate:function(b,a){this.transform("translate",null,null,b,a)},translatePoint:function(b,a,c){this.transformPoint("translate",null,null,b,a,c)},translateShape:function(b,a){var c=this.annotation.chart,n=this.annotation.userOptions,q=c.annotations.indexOf(this.annotation); c=c.options.annotations[q];this.translatePoint(b,a,0);c[this.collection][this.index].point=this.options.point;n[this.collection][this.index].point=this.options.point},rotate:function(b,a,c){this.transform("rotate",b,a,c)},scale:function(b,a,c,n){this.transform("scale",b,a,c,n)},setControlPointsVisibility:function(b){this.controlPoints.forEach(function(a){a.setVisibility(b)})},destroy:function(){this.graphic&&(this.graphic=this.graphic.destroy());this.tracker&&(this.tracker=this.tracker.destroy()); this.controlPoints.forEach(function(b){b.destroy()});this.options=this.controlPoints=this.points=this.chart=null;this.annotation&&(this.annotation=null)},update:function(b){var a=this.annotation;b=g(!0,this.options,b);var c=this.graphic.parentGroup;this.destroy();this.constructor(a,b);this.render(c);this.redraw()}}});u(d,"Extensions/Annotations/Mixins/MarkerMixin.js",[d["Core/Chart/Chart.js"],d["Core/Renderer/SVG/SVGRenderer.js"],d["Core/Utilities.js"]],function(l,d,p){function h(b){return function(a){this.attr(b, "url(#"+a+")")}}var k=p.addEvent,e=p.defined,g=p.merge,c=p.objectEach,b=p.uniqueKey,a={arrow:{tagName:"marker",render:!1,id:"arrow",refY:5,refX:9,markerWidth:10,markerHeight:10,children:[{tagName:"path",d:"M 0 0 L 10 5 L 0 10 Z",strokeWidth:0}]},"reverse-arrow":{tagName:"marker",render:!1,id:"reverse-arrow",refY:5,refX:1,markerWidth:10,markerHeight:10,children:[{tagName:"path",d:"M 0 5 L 10 0 L 10 10 Z",strokeWidth:0}]}};d.prototype.addMarker=function(b,a){var c={id:b},f={stroke:a.color||"none",fill:a.color|| "rgba(0, 0, 0, 0.75)"};c.children=a.children.map(function(b){return g(f,b)});a=this.definition(g(!0,{markerWidth:20,markerHeight:20,refX:0,refY:0,orient:"auto"},a,c));a.id=b;return a};d={markerEndSetter:h("marker-end"),markerStartSetter:h("marker-start"),setItemMarkers:function(a){var c=a.options,f=a.chart,d=f.options.defs,m=c.fill,r=e(m)&&"none"!==m?m:c.stroke;["markerStart","markerEnd"].forEach(function(n){var m=c[n],q;if(m){for(q in d){var e=d[q];if(m===e.id&&"marker"===e.tagName){var l=e;break}}l&& (m=a[n]=f.renderer.addMarker((c.id||b())+"-"+l.id,g(l,{color:r})),a.attr(n,m.attr("id")))}})}};k(l,"afterGetContainer",function(){this.options.defs=g(a,this.options.defs||{});c(this.options.defs,function(b){"marker"===b.tagName&&!1!==b.render&&this.renderer.addMarker(b.id,b)},this)});return d});u(d,"Extensions/Annotations/Controllables/ControllablePath.js",[d["Extensions/Annotations/Mixins/ControllableMixin.js"],d["Core/Globals.js"],d["Extensions/Annotations/Mixins/MarkerMixin.js"],d["Core/Utilities.js"]], function(d,k,p,h){var l=h.extend,e="rgba(192,192,192,"+(k.svg?.0001:.002)+")";return function(){function g(c,b,a){this.addControlPoints=d.addControlPoints;this.anchor=d.anchor;this.attr=d.attr;this.attrsFromOptions=d.attrsFromOptions;this.destroy=d.destroy;this.getPointsOptions=d.getPointsOptions;this.init=d.init;this.linkPoints=d.linkPoints;this.point=d.point;this.rotate=d.rotate;this.scale=d.scale;this.setControlPointsVisibility=d.setControlPointsVisibility;this.setMarkers=p.setItemMarkers;this.transform= d.transform;this.transformPoint=d.transformPoint;this.translate=d.translate;this.translatePoint=d.translatePoint;this.translateShape=d.translateShape;this.update=d.update;this.type="path";this.init(c,b,a);this.collection="shapes"}g.prototype.toD=function(){var c=this.options.d;if(c)return"function"===typeof c?c.call(this):c;c=this.points;var b=c.length,a=b,f=c[0],n=a&&this.anchor(f).absolutePosition,q=0,e=[];if(n)for(e.push(["M",n.x,n.y]);++q<b&&a;)f=c[q],a=f.command||"L",n=this.anchor(f).absolutePosition, "M"===a?e.push([a,n.x,n.y]):"L"===a?e.push([a,n.x,n.y]):"Z"===a&&e.push([a]),a=f.series.visible;return a?this.chart.renderer.crispLine(e,this.graphic.strokeWidth()):null};g.prototype.shouldBeDrawn=function(){return d.shouldBeDrawn.call(this)||!!this.options.d};g.prototype.render=function(c){var b=this.options,a=this.attrsFromOptions(b);this.graphic=this.annotation.chart.renderer.path([["M",0,0]]).attr(a).add(c);b.className&&this.graphic.addClass(b.className);this.tracker=this.annotation.chart.renderer.path([["M", 0,0]]).addClass("highcharts-tracker-line").attr({zIndex:2}).add(c);this.annotation.chart.styledMode||this.tracker.attr({"stroke-linejoin":"round",stroke:e,fill:e,"stroke-width":this.graphic.strokeWidth()+2*b.snap});d.render.call(this);l(this.graphic,{markerStartSetter:p.markerStartSetter,markerEndSetter:p.markerEndSetter});this.setMarkers(this)};g.prototype.redraw=function(c){var b=this.toD(),a=c?"animate":"attr";b?(this.graphic[a]({d:b}),this.tracker[a]({d:b})):(this.graphic.attr({d:"M 0 -9000000000"}), this.tracker.attr({d:"M 0 -9000000000"}));this.graphic.placed=this.tracker.placed=!!b;d.redraw.call(this,c)};g.attrsMap={dashStyle:"dashstyle",strokeWidth:"stroke-width",stroke:"stroke",fill:"fill",zIndex:"zIndex"};return g}()});u(d,"Extensions/Annotations/Controllables/ControllableRect.js",[d["Extensions/Annotations/Mixins/ControllableMixin.js"],d["Extensions/Annotations/Controllables/ControllablePath.js"],d["Core/Utilities.js"]],function(d,k,p){var l=p.merge;return function(){function h(e,g,c){this.addControlPoints= d.addControlPoints;this.anchor=d.anchor;this.attr=d.attr;this.attrsFromOptions=d.attrsFromOptions;this.destroy=d.destroy;this.getPointsOptions=d.getPointsOptions;this.init=d.init;this.linkPoints=d.linkPoints;this.point=d.point;this.rotate=d.rotate;this.scale=d.scale;this.setControlPointsVisibility=d.setControlPointsVisibility;this.shouldBeDrawn=d.shouldBeDrawn;this.transform=d.transform;this.transformPoint=d.transformPoint;this.translatePoint=d.translatePoint;this.translateShape=d.translateShape; this.update=d.update;this.type="rect";this.translate=d.translateShape;this.init(e,g,c);this.collection="shapes"}h.prototype.render=function(e){var g=this.attrsFromOptions(this.options);this.graphic=this.annotation.chart.renderer.rect(0,-9E9,0,0).attr(g).add(e);d.render.call(this)};h.prototype.redraw=function(e){var g=this.anchor(this.points[0]).absolutePosition;if(g)this.graphic[e?"animate":"attr"]({x:g.x,y:g.y,width:this.options.width,height:this.options.height});else this.attr({x:0,y:-9E9});this.graphic.placed= !!g;d.redraw.call(this,e)};h.attrsMap=l(k.attrsMap,{width:"width",height:"height"});return h}()});u(d,"Extensions/Annotations/Controllables/ControllableCircle.js",[d["Extensions/Annotations/Mixins/ControllableMixin.js"],d["Extensions/Annotations/Controllables/ControllablePath.js"],d["Core/Utilities.js"]],function(d,k,p){var l=p.merge;return function(){function h(e,g,c){this.addControlPoints=d.addControlPoints;this.anchor=d.anchor;this.attr=d.attr;this.attrsFromOptions=d.attrsFromOptions;this.destroy= d.destroy;this.getPointsOptions=d.getPointsOptions;this.init=d.init;this.linkPoints=d.linkPoints;this.point=d.point;this.rotate=d.rotate;this.scale=d.scale;this.setControlPointsVisibility=d.setControlPointsVisibility;this.shouldBeDrawn=d.shouldBeDrawn;this.transform=d.transform;this.transformPoint=d.transformPoint;this.translatePoint=d.translatePoint;this.translateShape=d.translateShape;this.update=d.update;this.type="circle";this.translate=d.translateShape;this.init(e,g,c);this.collection="shapes"} h.prototype.render=function(e){var g=this.attrsFromOptions(this.options);this.graphic=this.annotation.chart.renderer.circle(0,-9E9,0).attr(g).add(e);d.render.call(this)};h.prototype.redraw=function(e){var g=this.anchor(this.points[0]).absolutePosition;if(g)this.graphic[e?"animate":"attr"]({x:g.x,y:g.y,r:this.options.r});else this.graphic.attr({x:0,y:-9E9});this.graphic.placed=!!g;d.redraw.call(this,e)};h.prototype.setRadius=function(d){this.options.r=d};h.attrsMap=l(k.attrsMap,{r:"r"});return h}()}); u(d,"Extensions/Annotations/Controllables/ControllableLabel.js",[d["Extensions/Annotations/Mixins/ControllableMixin.js"],d["Extensions/Annotations/MockPoint.js"],d["Core/Renderer/SVG/SVGRenderer.js"],d["Core/Tooltip.js"],d["Core/Utilities.js"]],function(d,k,p,h,w){var e=w.extend,g=w.format,c=w.isNumber,b=w.pick;w=function(){function a(b,a,c){this.addControlPoints=d.addControlPoints;this.attr=d.attr;this.attrsFromOptions=d.attrsFromOptions;this.destroy=d.destroy;this.getPointsOptions=d.getPointsOptions; this.init=d.init;this.linkPoints=d.linkPoints;this.point=d.point;this.rotate=d.rotate;this.scale=d.scale;this.setControlPointsVisibility=d.setControlPointsVisibility;this.shouldBeDrawn=d.shouldBeDrawn;this.transform=d.transform;this.transformPoint=d.transformPoint;this.translateShape=d.translateShape;this.update=d.update;this.init(b,a,c);this.collection="labels"}a.alignedPosition=function(b,a){var c=b.align,f=b.verticalAlign,n=(a.x||0)+(b.x||0),d=(a.y||0)+(b.y||0),e,g;"right"===c?e=1:"center"===c&& (e=2);e&&(n+=(a.width-(b.width||0))/e);"bottom"===f?g=1:"middle"===f&&(g=2);g&&(d+=(a.height-(b.height||0))/g);return{x:Math.round(n),y:Math.round(d)}};a.justifiedOptions=function(b,a,c,d){var f=c.align,n=c.verticalAlign,e=a.box?0:a.padding||0,q=a.getBBox();a={align:f,verticalAlign:n,x:c.x,y:c.y,width:a.width,height:a.height};c=d.x-b.plotLeft;var g=d.y-b.plotTop;d=c+e;0>d&&("right"===f?a.align="left":a.x=-d);d=c+q.width-e;d>b.plotWidth&&("left"===f?a.align="right":a.x=b.plotWidth-d);d=g+e;0>d&&("bottom"=== n?a.verticalAlign="top":a.y=-d);d=g+q.height-e;d>b.plotHeight&&("top"===n?a.verticalAlign="bottom":a.y=b.plotHeight-d);return a};a.prototype.translatePoint=function(b,a){d.translatePoint.call(this,b,a,0)};a.prototype.translate=function(b,a){var c=this.annotation.chart,f=this.annotation.userOptions,n=c.annotations.indexOf(this.annotation);n=c.options.annotations[n];c.inverted&&(c=b,b=a,a=c);this.options.x+=b;this.options.y+=a;n[this.collection][this.index].x=this.options.x;n[this.collection][this.index].y= this.options.y;f[this.collection][this.index].x=this.options.x;f[this.collection][this.index].y=this.options.y};a.prototype.render=function(b){var c=this.options,f=this.attrsFromOptions(c),e=c.style;this.graphic=this.annotation.chart.renderer.label("",0,-9999,c.shape,null,null,c.useHTML,null,"annotation-label").attr(f).add(b);this.annotation.chart.styledMode||("contrast"===e.color&&(e.color=this.annotation.chart.renderer.getContrast(-1<a.shapesWithoutBackground.indexOf(c.shape)?"#FFFFFF":c.backgroundColor)), this.graphic.css(c.style).shadow(c.shadow));c.className&&this.graphic.addClass(c.className);this.graphic.labelrank=c.labelrank;d.render.call(this)};a.prototype.redraw=function(b){var a=this.options,c=this.text||a.format||a.text,f=this.graphic,e=this.points[0];f.attr({text:c?g(c,e.getLabelConfig(),this.annotation.chart):a.formatter.call(e,this)});a=this.anchor(e);(c=this.position(a))?(f.alignAttr=c,c.anchorX=a.absolutePosition.x,c.anchorY=a.absolutePosition.y,f[b?"animate":"attr"](c)):f.attr({x:0, y:-9999});f.placed=!!c;d.redraw.call(this,b)};a.prototype.anchor=function(b){var a=d.anchor.apply(this,arguments),c=this.options.x||0,f=this.options.y||0;a.absolutePosition.x-=c;a.absolutePosition.y-=f;a.relativePosition.x-=c;a.relativePosition.y-=f;return a};a.prototype.position=function(c){var f=this.graphic,d=this.annotation.chart,g=this.points[0],m=this.options,r=c.absolutePosition,t=c.relativePosition;if(c=g.series.visible&&k.prototype.isInsidePlot.call(g)){if(m.distance)var y=h.prototype.getPosition.call({chart:d, distance:b(m.distance,16)},f.width,f.height,{plotX:t.x,plotY:t.y,negative:g.negative,ttBelow:g.ttBelow,h:t.height||t.width});else m.positioner?y=m.positioner.call(this):(g={x:r.x,y:r.y,width:0,height:0},y=a.alignedPosition(e(m,{width:f.width,height:f.height}),g),"justify"===this.options.overflow&&(y=a.alignedPosition(a.justifiedOptions(d,f,m,y),g)));m.crop&&(m=y.x-d.plotLeft,g=y.y-d.plotTop,c=d.isInsidePlot(m,g)&&d.isInsidePlot(m+f.width,g+f.height))}return c?y:null};a.attrsMap={backgroundColor:"fill", borderColor:"stroke",borderWidth:"stroke-width",zIndex:"zIndex",borderRadius:"r",padding:"padding"};a.shapesWithoutBackground=["connector"];return a}();p.prototype.symbols.connector=function(a,b,d,e,g){var f=g&&g.anchorX;g=g&&g.anchorY;var n=d/2;if(c(f)&&c(g)){var q=[["M",f,g]];var h=b-g;0>h&&(h=-e-h);h<d&&(n=f<a+d/2?h:d-h);g>b+e?q.push(["L",a+n,b+e]):g<b?q.push(["L",a+n,b]):f<a?q.push(["L",a,b+e/2]):f>a+d&&q.push(["L",a+d,b+e/2])}return q||[]};return w});u(d,"Extensions/Annotations/Controllables/ControllableImage.js", [d["Extensions/Annotations/Controllables/ControllableLabel.js"],d["Extensions/Annotations/Mixins/ControllableMixin.js"]],function(d,k){return function(){function l(d,l,e){this.addControlPoints=k.addControlPoints;this.anchor=k.anchor;this.attr=k.attr;this.attrsFromOptions=k.attrsFromOptions;this.destroy=k.destroy;this.getPointsOptions=k.getPointsOptions;this.init=k.init;this.linkPoints=k.linkPoints;this.point=k.point;this.rotate=k.rotate;this.scale=k.scale;this.setControlPointsVisibility=k.setControlPointsVisibility; this.shouldBeDrawn=k.shouldBeDrawn;this.transform=k.transform;this.transformPoint=k.transformPoint;this.translatePoint=k.translatePoint;this.translateShape=k.translateShape;this.update=k.update;this.type="image";this.translate=k.translateShape;this.init(d,l,e);this.collection="shapes"}l.prototype.render=function(d){var h=this.attrsFromOptions(this.options),e=this.options;this.graphic=this.annotation.chart.renderer.image(e.src,0,-9E9,e.width,e.height).attr(h).add(d);this.graphic.width=e.width;this.graphic.height= e.height;k.render.call(this)};l.prototype.redraw=function(h){var l=this.anchor(this.points[0]);if(l=d.prototype.position.call(this,l))this.graphic[h?"animate":"attr"]({x:l.x,y:l.y});else this.graphic.attr({x:0,y:-9E9});this.graphic.placed=!!l;k.redraw.call(this,h)};l.attrsMap={width:"width",height:"height",zIndex:"zIndex"};return l}()});u(d,"Extensions/Annotations/Annotations.js",[d["Core/Chart/Chart.js"],d["Extensions/Annotations/Mixins/ControllableMixin.js"],d["Extensions/Annotations/Controllables/ControllableRect.js"], d["Extensions/Annotations/Controllables/ControllableCircle.js"],d["Extensions/Annotations/Controllables/ControllablePath.js"],d["Extensions/Annotations/Controllables/ControllableImage.js"],d["Extensions/Annotations/Controllables/ControllableLabel.js"],d["Extensions/Annotations/ControlPoint.js"],d["Extensions/Annotations/Mixins/EventEmitterMixin.js"],d["Core/Globals.js"],d["Extensions/Annotations/MockPoint.js"],d["Core/Pointer.js"],d["Core/Utilities.js"]],function(d,k,p,h,w,e,g,c,b,a,f,n,q){d=d.prototype; var l=q.addEvent,m=q.defined,r=q.destroyObjectProperties,t=q.erase,y=q.extend,B=q.find,x=q.fireEvent,A=q.getDeferredAnimation,v=q.merge,z=q.pick,D=q.splat;q=q.wrap;var C=function(){function a(a,b){this.annotation=void 0;this.coll="annotations";this.shapesGroup=this.labelsGroup=this.labelCollector=this.group=this.graphic=this.animationConfig=this.collection=void 0;this.chart=a;this.points=[];this.controlPoints=[];this.coll="annotations";this.labels=[];this.shapes=[];this.options=v(this.defaultOptions, b);this.userOptions=b;b=this.getLabelsAndShapesOptions(this.options,b);this.options.labels=b.labels;this.options.shapes=b.shapes;this.init(a,this.options)}a.prototype.init=function(){var a=this.chart,b=this.options.animation;this.linkPoints();this.addControlPoints();this.addShapes();this.addLabels();this.setLabelCollector();this.animationConfig=A(a,b)};a.prototype.getLabelsAndShapesOptions=function(a,b){var c={};["labels","shapes"].forEach(function(f){a[f]&&(c[f]=D(b[f]).map(function(b,c){return v(a[f][c], b)}))});return c};a.prototype.addShapes=function(){(this.options.shapes||[]).forEach(function(a,b){a=this.initShape(a,b);v(!0,this.options.shapes[b],a.options)},this)};a.prototype.addLabels=function(){(this.options.labels||[]).forEach(function(a,b){a=this.initLabel(a,b);v(!0,this.options.labels[b],a.options)},this)};a.prototype.addClipPaths=function(){this.setClipAxes();this.clipXAxis&&this.clipYAxis&&(this.clipRect=this.chart.renderer.clipRect(this.getClipBox()))};a.prototype.setClipAxes=function(){var a= this.chart.xAxis,b=this.chart.yAxis,c=(this.options.labels||[]).concat(this.options.shapes||[]).reduce(function(c,f){return[a[f&&f.point&&f.point.xAxis]||c[0],b[f&&f.point&&f.point.yAxis]||c[1]]},[]);this.clipXAxis=c[0];this.clipYAxis=c[1]};a.prototype.getClipBox=function(){if(this.clipXAxis&&this.clipYAxis)return{x:this.clipXAxis.left,y:this.clipYAxis.top,width:this.clipXAxis.width,height:this.clipYAxis.height}};a.prototype.setLabelCollector=function(){var a=this;a.labelCollector=function(){return a.labels.reduce(function(a, b){b.options.allowOverlap||a.push(b.graphic);return a},[])};a.chart.labelCollectors.push(a.labelCollector)};a.prototype.setOptions=function(a){this.options=v(this.defaultOptions,a)};a.prototype.redraw=function(a){this.linkPoints();this.graphic||this.render();this.clipRect&&this.clipRect.animate(this.getClipBox());this.redrawItems(this.shapes,a);this.redrawItems(this.labels,a);k.redraw.call(this,a)};a.prototype.redrawItems=function(a,b){for(var c=a.length;c--;)this.redrawItem(a[c],b)};a.prototype.renderItems= function(a){for(var b=a.length;b--;)this.renderItem(a[b])};a.prototype.render=function(){var a=this.chart.renderer;this.graphic=a.g("annotation").attr({opacity:0,zIndex:this.options.zIndex,visibility:this.options.visible?"visible":"hidden"}).add();this.shapesGroup=a.g("annotation-shapes").add(this.graphic).clip(this.chart.plotBoxClip);this.labelsGroup=a.g("annotation-labels").attr({translateX:0,translateY:0}).add(this.graphic);this.addClipPaths();this.clipRect&&this.graphic.clip(this.clipRect);this.renderItems(this.shapes); this.renderItems(this.labels);this.addEvents();k.render.call(this)};a.prototype.setVisibility=function(a){var b=this.options;a=z(a,!b.visible);this.graphic.attr("visibility",a?"visible":"hidden");a||this.setControlPointsVisibility(!1);b.visible=a};a.prototype.setControlPointsVisibility=function(a){var b=function(b){b.setControlPointsVisibility(a)};k.setControlPointsVisibility.call(this,a);this.shapes.forEach(b);this.labels.forEach(b)};a.prototype.destroy=function(){var a=this.chart,c=function(a){a.destroy()}; this.labels.forEach(c);this.shapes.forEach(c);this.clipYAxis=this.clipXAxis=null;t(a.labelCollectors,this.labelCollector);b.destroy.call(this);k.destroy.call(this);r(this,a)};a.prototype.remove=function(){return this.chart.removeAnnotation(this)};a.prototype.update=function(a,b){var c=this.chart,f=this.getLabelsAndShapesOptions(this.userOptions,a),d=c.annotations.indexOf(this);a=v(!0,this.userOptions,a);a.labels=f.labels;a.shapes=f.shapes;this.destroy();this.constructor(c,a);c.options.annotations[d]= a;this.isUpdating=!0;z(b,!0)&&c.redraw();x(this,"afterUpdate");this.isUpdating=!1};a.prototype.initShape=function(b,c){b=v(this.options.shapeOptions,{controlPointOptions:this.options.controlPointOptions},b);c=new a.shapesMap[b.type](this,b,c);c.itemType="shape";this.shapes.push(c);return c};a.prototype.initLabel=function(a,b){a=v(this.options.labelOptions,{controlPointOptions:this.options.controlPointOptions},a);b=new g(this,a,b);b.itemType="label";this.labels.push(b);return b};a.prototype.redrawItem= function(a,b){a.linkPoints();a.shouldBeDrawn()?(a.graphic||this.renderItem(a),a.redraw(z(b,!0)&&a.graphic.placed),a.points.length&&this.adjustVisibility(a)):this.destroyItem(a)};a.prototype.adjustVisibility=function(a){var b=!1,c=a.graphic;a.points.forEach(function(a){!1!==a.series.visible&&!1!==a.visible&&(b=!0)});b?"hidden"===c.visibility&&c.show():c.hide()};a.prototype.destroyItem=function(a){t(this[a.itemType+"s"],a);a.destroy()};a.prototype.renderItem=function(a){a.render("label"===a.itemType? this.labelsGroup:this.shapesGroup)};a.ControlPoint=c;a.MockPoint=f;a.shapesMap={rect:p,circle:h,path:w,image:e};a.types={};return a}();v(!0,C.prototype,k,b,v(C.prototype,{nonDOMEvents:["add","afterUpdate","drag","remove"],defaultOptions:{visible:!0,animation:{},draggable:"xy",labelOptions:{align:"center",allowOverlap:!1,backgroundColor:"rgba(0, 0, 0, 0.75)",borderColor:"black",borderRadius:3,borderWidth:1,className:"",crop:!1,formatter:function(){return m(this.y)?this.y:"Annotation label"},includeInDataExport:!0, overflow:"justify",padding:5,shadow:!1,shape:"callout",style:{fontSize:"11px",fontWeight:"normal",color:"contrast"},useHTML:!1,verticalAlign:"bottom",x:0,y:-16},shapeOptions:{stroke:"rgba(0, 0, 0, 0.75)",strokeWidth:1,fill:"rgba(0, 0, 0, 0.75)",r:0,snap:2},controlPointOptions:{symbol:"circle",width:10,height:10,style:{stroke:"black","stroke-width":2,fill:"white"},visible:!1,events:{}},events:{},zIndex:6}}));a.extendAnnotation=function(a,b,c,f){b=b||C;v(!0,a.prototype,b.prototype,c);a.prototype.defaultOptions= v(a.prototype.defaultOptions,f||{})};y(d,{initAnnotation:function(a){a=new (C.types[a.type]||C)(this,a);this.annotations.push(a);return a},addAnnotation:function(a,b){a=this.initAnnotation(a);this.options.annotations.push(a.options);z(b,!0)&&(a.redraw(),a.graphic.attr({opacity:1}));return a},removeAnnotation:function(a){var b=this.annotations,c="annotations"===a.coll?a:B(b,function(b){return b.options.id===a});c&&(x(c,"remove"),t(this.options.annotations,c.options),t(b,c),c.destroy())},drawAnnotations:function(){this.plotBoxClip.attr(this.plotBox); this.annotations.forEach(function(a){a.redraw();a.graphic.animate({opacity:1},a.animationConfig)})}});d.collectionsWithUpdate.push("annotations");d.collectionsWithInit.annotations=[d.addAnnotation];d.callbacks.push(function(a){a.annotations=[];a.options.annotations||(a.options.annotations=[]);a.plotBoxClip=this.renderer.clipRect(this.plotBox);a.controlPointsGroup=a.renderer.g("control-points").attr({zIndex:99}).clip(a.plotBoxClip).add();a.options.annotations.forEach(function(b,c){b=a.initAnnotation(b); a.options.annotations[c]=b.options});a.drawAnnotations();l(a,"redraw",a.drawAnnotations);l(a,"destroy",function(){a.plotBoxClip.destroy();a.controlPointsGroup.destroy()});l(a,"exportData",function(b){var c,f,d,n,e,m,g,r,q=a.annotations,t=(this.options.exporting&&this.options.exporting.csv||{}).columnHeaderFormatter,x=!b.dataRows[1].xValues,h=null===(f=null===(c=a.options.lang)||void 0===c?void 0:c.exportData)||void 0===f?void 0:f.annotationHeader;c=function(a){if(t){var b=t(a);if(!1!==b)return b}b= h+" "+a;return x?{columnTitle:b,topLevelColumnTitle:b}:b};var v=b.dataRows[0].length,A=null===(e=null===(n=null===(d=a.options.exporting)||void 0===d?void 0:d.csv)||void 0===n?void 0:n.annotations)||void 0===e?void 0:e.itemDelimiter,l=null===(r=null===(g=null===(m=a.options.exporting)||void 0===m?void 0:m.csv)||void 0===g?void 0:g.annotations)||void 0===r?void 0:r.join;q.forEach(function(a){a.options.labelOptions.includeInDataExport&&a.labels.forEach(function(a){if(a.options.text){var c=a.options.text; a.points.forEach(function(a){var f=a.x,d=a.series.xAxis?a.series.xAxis.options.index:-1,n=!1;if(-1===d){a=b.dataRows[0].length;for(var e=Array(a),m=0;m<a;++m)e[m]="";e.push(c);e.xValues=[];e.xValues[d]=f;b.dataRows.push(e);n=!0}n||b.dataRows.forEach(function(a,b){!n&&a.xValues&&void 0!==d&&f===a.xValues[d]&&(l&&a.length>v?a[a.length-1]+=A+c:a.push(c),n=!0)});if(!n){a=b.dataRows[0].length;e=Array(a);for(m=0;m<a;++m)e[m]="";e[0]=f;e.push(c);e.xValues=[];void 0!==d&&(e.xValues[d]=f);b.dataRows.push(e)}})}})}); var z=0;b.dataRows.forEach(function(a){z=Math.max(z,a.length)});d=z-b.dataRows[0].length;for(n=0;n<d;n++)e=c(n+1),x?(b.dataRows[0].push(e.topLevelColumnTitle),b.dataRows[1].push(e.columnTitle)):b.dataRows[0].push(e)})});q(n.prototype,"onContainerMouseDown",function(a){this.chart.hasDraggedAnnotation||a.apply(this,Array.prototype.slice.call(arguments,1))});return a.Annotation=C});u(d,"Extensions/Annotations/Types/BasicAnnotation.js",[d["Extensions/Annotations/Annotations.js"],d["Extensions/Annotations/MockPoint.js"], d["Core/Utilities.js"]],function(d,k,p){var h=this&&this.__extends||function(){var d=function(e,c){d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])};return d(e,c)};return function(e,c){function b(){this.constructor=e}d(e,c);e.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)}}();p=p.merge;var l=function(e){function g(c,b){return e.call(this,c,b)||this}h(g,e);g.prototype.addControlPoints= function(){var c=this.options,b=g.basicControlPoints,a=this.basicType;(c.labels||c.shapes).forEach(function(c){c.controlPoints=b[a]})};g.prototype.init=function(){var c=this.options;c.shapes?(delete c.labelOptions,this.basicType="circle"===c.shapes[0].type?"circle":"rectangle"):(delete c.shapes,this.basicType="label");d.prototype.init.apply(this,arguments)};g.basicControlPoints={label:[{symbol:"triangle-down",positioner:function(c){if(!c.graphic.placed)return{x:0,y:-9E7};c=k.pointToPixels(c.points[0]); return{x:c.x-this.graphic.width/2,y:c.y-this.graphic.height/2}},events:{drag:function(c,b){c=this.mouseMoveToTranslation(c);b.translatePoint(c.x,c.y);b.annotation.userOptions.labels[0].point=b.options.point;b.redraw(!1)}}},{symbol:"square",positioner:function(c){return c.graphic.placed?{x:c.graphic.alignAttr.x-this.graphic.width/2,y:c.graphic.alignAttr.y-this.graphic.height/2}:{x:0,y:-9E7}},events:{drag:function(c,b){c=this.mouseMoveToTranslation(c);b.translate(c.x,c.y);b.annotation.userOptions.labels[0].point= b.options.point;b.redraw(!1)}}}],rectangle:[{positioner:function(c){c=k.pointToPixels(c.points[2]);return{x:c.x-4,y:c.y-4}},events:{drag:function(c,b){var a=b.annotation,f=this.chart.pointer.getCoordinates(c);c=f.xAxis[0].value;f=f.yAxis[0].value;var d=b.options.points;d[1].x=c;d[2].x=c;d[2].y=f;d[3].y=f;a.userOptions.shapes[0].points=b.options.points;a.redraw(!1)}}}],circle:[{positioner:function(c){var b=k.pointToPixels(c.points[0]);c=c.options.r;return{x:b.x+c*Math.cos(Math.PI/4)-this.graphic.width/ 2,y:b.y+c*Math.sin(Math.PI/4)-this.graphic.height/2}},events:{drag:function(c,b){var a=b.annotation;c=this.mouseMoveToTranslation(c);b.setRadius(Math.max(b.options.r+c.y/Math.sin(Math.PI/4),5));a.userOptions.shapes[0].r=b.options.r;a.userOptions.shapes[0].point=b.options.point;b.redraw(!1)}}}]};return g}(d);l.prototype.defaultOptions=p(d.prototype.defaultOptions,{});return d.types.basicAnnotation=l});u(d,"Extensions/Annotations/Types/CrookedLine.js",[d["Extensions/Annotations/Annotations.js"],d["Extensions/Annotations/ControlPoint.js"], d["Extensions/Annotations/MockPoint.js"],d["Core/Utilities.js"]],function(d,k,p,h){var l=this&&this.__extends||function(){var d=function(c,b){d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return d(c,b)};return function(c,b){function a(){this.constructor=c}d(c,b);c.prototype=null===b?Object.create(b):(a.prototype=b.prototype,new a)}}(),e=h.merge;h=function(d){function c(b,a){return d.call(this,b, a)||this}l(c,d);c.prototype.setClipAxes=function(){this.clipXAxis=this.chart.xAxis[this.options.typeOptions.xAxis];this.clipYAxis=this.chart.yAxis[this.options.typeOptions.yAxis]};c.prototype.getPointsOptions=function(){var b=this.options.typeOptions;return(b.points||[]).map(function(a){a.xAxis=b.xAxis;a.yAxis=b.yAxis;return a})};c.prototype.getControlPointsOptions=function(){return this.getPointsOptions()};c.prototype.addControlPoints=function(){this.getControlPointsOptions().forEach(function(b, a){a=new k(this.chart,this,e(this.options.controlPointOptions,b.controlPoint),a);this.controlPoints.push(a);b.controlPoint=a.options},this)};c.prototype.addShapes=function(){var b=this.options.typeOptions,a=this.initShape(e(b.line,{type:"path",points:this.points.map(function(a,b){return function(a){return a.annotation.points[b]}})}),!1);b.line=a.options};return c}(d);h.prototype.defaultOptions=e(d.prototype.defaultOptions,{typeOptions:{xAxis:0,yAxis:0,line:{fill:"none"}},controlPointOptions:{positioner:function(d){var c= this.graphic;d=p.pointToPixels(d.points[this.index]);return{x:d.x-c.width/2,y:d.y-c.height/2}},events:{drag:function(d,c){c.chart.isInsidePlot(d.chartX-c.chart.plotLeft,d.chartY-c.chart.plotTop)&&(d=this.mouseMoveToTranslation(d),c.translatePoint(d.x,d.y,this.index),c.options.typeOptions.points[this.index].x=c.points[this.index].x,c.options.typeOptions.points[this.index].y=c.points[this.index].y,c.redraw(!1))}}}});return d.types.crookedLine=h});u(d,"Extensions/Annotations/Types/ElliottWave.js",[d["Extensions/Annotations/Annotations.js"], d["Extensions/Annotations/Types/CrookedLine.js"],d["Core/Utilities.js"]],function(d,k,p){var h=this&&this.__extends||function(){var d=function(e,c){d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])};return d(e,c)};return function(e,c){function b(){this.constructor=e}d(e,c);e.prototype=null===c?Object.create(c):(b.prototype=c.prototype,new b)}}(),l=p.merge;p=function(d){function e(c,b){return d.call(this, c,b)||this}h(e,d);e.prototype.addLabels=function(){this.getPointsOptions().forEach(function(c,b){var a=this.initLabel(l(c.label,{text:this.options.typeOptions.labels[b],point:function(a){return a.annotation.points[b]}}),!1);c.label=a.options},this)};return e}(k);p.prototype.defaultOptions=l(k.prototype.defaultOptions,{typeOptions:{labels:"(0) (A) (B) (C) (D) (E)".split(" "),line:{strokeWidth:1}},labelOptions:{align:"center",allowOverlap:!0,crop:!0,overflow:"none",type:"rect",backgroundColor:"none", borderWidth:0,y:-5}});return d.types.elliottWave=p});u(d,"Extensions/Annotations/Types/Tunnel.js",[d["Extensions/Annotations/Annotations.js"],d["Extensions/Annotations/ControlPoint.js"],d["Extensions/Annotations/Types/CrookedLine.js"],d["Extensions/Annotations/MockPoint.js"],d["Core/Utilities.js"]],function(d,k,p,h,w){var e=this&&this.__extends||function(){var c=function(b,a){c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&& (a[c]=b[c])};return c(b,a)};return function(b,a){function d(){this.constructor=b}c(b,a);b.prototype=null===a?Object.create(a):(d.prototype=a.prototype,new d)}}(),g=w.merge;w=function(c){function b(a,b){return c.call(this,a,b)||this}e(b,c);b.prototype.getPointsOptions=function(){var a=p.prototype.getPointsOptions.call(this);a[2]=this.heightPointOptions(a[1]);a[3]=this.heightPointOptions(a[0]);return a};b.prototype.getControlPointsOptions=function(){return this.getPointsOptions().slice(0,2)};b.prototype.heightPointOptions= function(a){a=g(a);a.y+=this.options.typeOptions.height;return a};b.prototype.addControlPoints=function(){p.prototype.addControlPoints.call(this);var a=this.options,b=a.typeOptions;a=new k(this.chart,this,g(a.controlPointOptions,b.heightControlPoint),2);this.controlPoints.push(a);b.heightControlPoint=a.options};b.prototype.addShapes=function(){this.addLine();this.addBackground()};b.prototype.addLine=function(){var a=this.initShape(g(this.options.typeOptions.line,{type:"path",points:[this.points[0], this.points[1],function(a){a=h.pointToOptions(a.annotation.points[2]);a.command="M";return a},this.points[3]]}),!1);this.options.typeOptions.line=a.options};b.prototype.addBackground=function(){var a=this.initShape(g(this.options.typeOptions.background,{type:"path",points:this.points.slice()}));this.options.typeOptions.background=a.options};b.prototype.translateSide=function(a,b,c){c=Number(c);var d=0===c?3:2;this.translatePoint(a,b,c);this.translatePoint(a,b,d)};b.prototype.translateHeight=function(a){this.translatePoint(0, a,2);this.translatePoint(0,a,3);this.options.typeOptions.height=this.points[3].y-this.points[0].y};return b}(p);w.prototype.defaultOptions=g(p.prototype.defaultOptions,{typeOptions:{xAxis:0,yAxis:0,background:{fill:"rgba(130, 170, 255, 0.4)",strokeWidth:0},line:{strokeWidth:1},height:-2,heightControlPoint:{positioner:function(c){var b=h.pointToPixels(c.points[2]);c=h.pointToPixels(c.points[3]);var a=(b.x+c.x)/2;return{x:a-this.graphic.width/2,y:(c.y-b.y)/(c.x-b.x)*(a-b.x)+b.y-this.graphic.height/ 2}},events:{drag:function(c,b){b.chart.isInsidePlot(c.chartX-b.chart.plotLeft,c.chartY-b.chart.plotTop)&&(b.translateHeight(this.mouseMoveToTranslation(c).y),b.redraw(!1))}}}},controlPointOptions:{events:{drag:function(c,b){b.chart.isInsidePlot(c.chartX-b.chart.plotLeft,c.chartY-b.chart.plotTop)&&(c=this.mouseMoveToTranslation(c),b.translateSide(c.x,c.y,this.index),b.redraw(!1))}}}});return d.types.tunnel=w});u(d,"Extensions/Annotations/Types/InfinityLine.js",[d["Extensions/Annotations/Annotations.js"], d["Extensions/Annotations/Types/CrookedLine.js"],d["Extensions/Annotations/MockPoint.js"],d["Core/Utilities.js"]],function(d,k,p,h){var l=this&&this.__extends||function(){var d=function(c,b){d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return d(c,b)};return function(c,b){function a(){this.constructor=c}d(c,b);c.prototype=null===b?Object.create(b):(a.prototype=b.prototype,new a)}}(),e=h.merge;h= function(d){function c(b,a){return d.call(this,b,a)||this}l(c,d);c.edgePoint=function(b,a){return function(d){d=d.annotation;var f=d.points,e=d.options.typeOptions.type;"horizontalLine"===e?f=[f[0],new p(d.chart,f[0].target,{x:f[0].x+1,y:f[0].y,xAxis:f[0].options.xAxis,yAxis:f[0].options.yAxis})]:"verticalLine"===e&&(f=[f[0],new p(d.chart,f[0].target,{x:f[0].x,y:f[0].y+1,xAxis:f[0].options.xAxis,yAxis:f[0].options.yAxis})]);return c.findEdgePoint(f[b],f[a])}};c.findEdgeCoordinate=function(b,a,c,d){var f= "x"===c?"y":"x";return(a[c]-b[c])*(d-b[f])/(a[f]-b[f])+b[c]};c.findEdgePoint=function(b,a){var d=b.series.xAxis,e=a.series.yAxis,q=p.pointToPixels(b),g=p.pointToPixels(a),m=g.x-q.x,r=g.y-q.y;a=d.left;var t=a+d.width;d=e.top;e=d+e.height;var h=0>m?a:t,l=0>r?d:e;t={x:0===m?q.x:h,y:0===r?q.y:l};0!==m&&0!==r&&(m=c.findEdgeCoordinate(q,g,"y",h),q=c.findEdgeCoordinate(q,g,"x",l),m>=d&&m<=e?(t.x=h,t.y=m):(t.x=q,t.y=l));t.x-=a;t.y-=d;b.series.chart.inverted&&(b=t.x,t.x=t.y,t.y=b);return t};c.prototype.addShapes= function(){var b=this.options.typeOptions,a=[this.points[0],c.endEdgePoint];b.type.match(/Line/g)&&(a[0]=c.startEdgePoint);a=this.initShape(e(b.line,{type:"path",points:a}),!1);b.line=a.options};c.endEdgePoint=c.edgePoint(0,1);c.startEdgePoint=c.edgePoint(1,0);return c}(k);h.prototype.defaultOptions=e(k.prototype.defaultOptions,{});return d.types.infinityLine=h});u(d,"Extensions/Annotations/Types/Fibonacci.js",[d["Extensions/Annotations/Annotations.js"],d["Extensions/Annotations/MockPoint.js"],d["Extensions/Annotations/Types/Tunnel.js"], d["Core/Utilities.js"]],function(d,k,p,h){var l=this&&this.__extends||function(){var c=function(b,a){c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return c(b,a)};return function(b,a){function d(){this.constructor=b}c(b,a);b.prototype=null===a?Object.create(a):(d.prototype=a.prototype,new d)}}(),e=h.merge,g=function(c,b){return function(){var a=this.annotation,d=this.anchor(a.startRetracements[c]).absolutePosition, e=this.anchor(a.endRetracements[c]).absolutePosition;d=[["M",Math.round(d.x),Math.round(d.y)],["L",Math.round(e.x),Math.round(e.y)]];b&&(e=this.anchor(a.endRetracements[c-1]).absolutePosition,a=this.anchor(a.startRetracements[c-1]).absolutePosition,d.push(["L",Math.round(e.x),Math.round(e.y)],["L",Math.round(a.x),Math.round(a.y)]));return d}};h=function(c){function b(a,b){return c.call(this,a,b)||this}l(b,c);b.prototype.linkPoints=function(){c.prototype.linkPoints.call(this);this.linkRetracementsPoints()}; b.prototype.linkRetracementsPoints=function(){var a=this.points,c=a[0].y-a[3].y,d=a[1].y-a[2].y,e=a[0].x,g=a[1].x;b.levels.forEach(function(b,f){var m=a[0].y-c*b;b=a[1].y-d*b;this.startRetracements=this.startRetracements||[];this.endRetracements=this.endRetracements||[];this.linkRetracementPoint(f,e,m,this.startRetracements);this.linkRetracementPoint(f,g,b,this.endRetracements)},this)};b.prototype.linkRetracementPoint=function(a,b,c,d){var f=d[a],e=this.options.typeOptions;f?(f.options.x=b,f.options.y= c,f.refresh()):d[a]=new k(this.chart,this,{x:b,y:c,xAxis:e.xAxis,yAxis:e.yAxis})};b.prototype.addShapes=function(){b.levels.forEach(function(a,b){this.initShape({type:"path",d:g(b)},!1);0<b&&this.initShape({type:"path",fill:this.options.typeOptions.backgroundColors[b-1],strokeWidth:0,d:g(b,!0)})},this)};b.prototype.addLabels=function(){b.levels.forEach(function(a,b){var c=this.options.typeOptions;a=this.initLabel(e(c.labels[b],{point:function(a){return k.pointToOptions(a.annotation.startRetracements[b])}, text:a.toString()}));c.labels[b]=a.options},this)};b.levels=[0,.236,.382,.5,.618,.786,1];return b}(p);h.prototype.defaultOptions=e(p.prototype.defaultOptions,{typeOptions:{height:2,backgroundColors:"rgba(130, 170, 255, 0.4);rgba(139, 191, 216, 0.4);rgba(150, 216, 192, 0.4);rgba(156, 229, 161, 0.4);rgba(162, 241, 130, 0.4);rgba(169, 255, 101, 0.4)".split(";"),lineColor:"grey",lineColors:[],labels:[]},labelOptions:{allowOverlap:!0,align:"right",backgroundColor:"none",borderWidth:0,crop:!1,overflow:"none", shape:"rect",style:{color:"grey"},verticalAlign:"middle",y:0}});return d.types.fibonacci=h});u(d,"Extensions/Annotations/Types/Pitchfork.js",[d["Extensions/Annotations/Annotations.js"],d["Extensions/Annotations/Types/InfinityLine.js"],d["Extensions/Annotations/MockPoint.js"],d["Core/Utilities.js"]],function(d,k,p,h){var l=this&&this.__extends||function(){var d=function(c,b){d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&& (a[c]=b[c])};return d(c,b)};return function(c,b){function a(){this.constructor=c}d(c,b);c.prototype=null===b?Object.create(b):(a.prototype=b.prototype,new a)}}(),e=h.merge;h=function(d){function c(b,a){return d.call(this,b,a)||this}l(c,d);c.outerLineEdgePoint=function(b){return function(a){var d=a.annotation,e=d.points;return c.findEdgePoint(e[b],e[0],new p(d.chart,a,d.midPointOptions()))}};c.findEdgePoint=function(b,a,c){a=Math.atan2(c.plotY-a.plotY,c.plotX-a.plotX);return{x:b.plotX+1E7*Math.cos(a), y:b.plotY+1E7*Math.sin(a)}};c.middleLineEdgePoint=function(b){var a=b.annotation;return k.findEdgePoint(a.points[0],new p(a.chart,b,a.midPointOptions()))};c.prototype.midPointOptions=function(){var b=this.points;return{x:(b[1].x+b[2].x)/2,y:(b[1].y+b[2].y)/2,xAxis:b[0].series.xAxis,yAxis:b[0].series.yAxis}};c.prototype.addShapes=function(){this.addLines();this.addBackgrounds()};c.prototype.addLines=function(){this.initShape({type:"path",points:[this.points[0],c.middleLineEdgePoint]},!1);this.initShape({type:"path", points:[this.points[1],c.topLineEdgePoint]},!1);this.initShape({type:"path",points:[this.points[2],c.bottomLineEdgePoint]},!1)};c.prototype.addBackgrounds=function(){var b=this.shapes,a=this.options.typeOptions,c=this.initShape(e(a.innerBackground,{type:"path",points:[function(a){var b=a.annotation;a=b.points;b=b.midPointOptions();return{x:(a[1].x+b.x)/2,y:(a[1].y+b.y)/2,xAxis:b.xAxis,yAxis:b.yAxis}},b[1].points[1],b[2].points[1],function(a){var b=a.annotation;a=b.points;b=b.midPointOptions();return{x:(b.x+ a[2].x)/2,y:(b.y+a[2].y)/2,xAxis:b.xAxis,yAxis:b.yAxis}}]}));b=this.initShape(e(a.outerBackground,{type:"path",points:[this.points[1],b[1].points[1],b[2].points[1],this.points[2]]}));a.innerBackground=c.options;a.outerBackground=b.options};c.topLineEdgePoint=c.outerLineEdgePoint(1);c.bottomLineEdgePoint=c.outerLineEdgePoint(0);return c}(k);h.prototype.defaultOptions=e(k.prototype.defaultOptions,{typeOptions:{innerBackground:{fill:"rgba(130, 170, 255, 0.4)",strokeWidth:0},outerBackground:{fill:"rgba(156, 229, 161, 0.4)", strokeWidth:0}}});return d.types.pitchfork=h});u(d,"Extensions/Annotations/Types/VerticalLine.js",[d["Extensions/Annotations/Annotations.js"],d["Extensions/Annotations/MockPoint.js"],d["Core/Utilities.js"]],function(d,k,p){var h=this&&this.__extends||function(){var d=function(e,c){d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])};return d(e,c)};return function(e,c){function b(){this.constructor=e}