stock.js 66.5 KB
/*
 Highcharts JS v6.2.0 (2018-10-17)
 Highstock as a plugin for Highcharts

 (c) 2018 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(J){"object"===typeof module&&module.exports?module.exports=J:"function"===typeof define&&define.amd?define(function(){return J}):J(Highcharts)})(function(J){(function(a){var x=a.addEvent,l=a.Axis,H=a.Chart,v=a.css,F=a.defined,G=a.each,C=a.extend,D=a.noop,r=a.pick,y=a.timeUnits,t=a.wrap;t(a.Series.prototype,"init",function(a){var d;a.apply(this,Array.prototype.slice.call(arguments,1));(d=this.xAxis)&&d.options.ordinal&&x(this,"updatedData",function(){delete d.ordinalIndex})});t(l.prototype,
"getTimeTicks",function(a,d,e,g,b,k,u,n){var c=0,f,q,m={},A,w,B,h=[],p=-Number.MAX_VALUE,z=this.options.tickPixelInterval,K=this.chart.time;if(!this.options.ordinal&&!this.options.breaks||!k||3>k.length||void 0===e)return a.call(this,d,e,g,b);w=k.length;for(f=0;f<w;f++){B=f&&k[f-1]>g;k[f]<e&&(c=f);if(f===w-1||k[f+1]-k[f]>5*u||B){if(k[f]>p){for(q=a.call(this,d,k[c],k[f],b);q.length&&q[0]<=p;)q.shift();q.length&&(p=q[q.length-1]);h=h.concat(q)}c=f+1}if(B)break}a=q.info;if(n&&a.unitRange<=y.hour){f=
h.length-1;for(c=1;c<f;c++)K.dateFormat("%d",h[c])!==K.dateFormat("%d",h[c-1])&&(m[h[c]]="day",A=!0);A&&(m[h[0]]="day");a.higherRanks=m}h.info=a;if(n&&F(z)){n=K=h.length;f=[];var I;for(A=[];n--;)c=this.translate(h[n]),I&&(A[n]=I-c),f[n]=I=c;A.sort();A=A[Math.floor(A.length/2)];A<.6*z&&(A=null);n=h[K-1]>g?K-1:K;for(I=void 0;n--;)c=f[n],g=Math.abs(I-c),I&&g<.8*z&&(null===A||g<.8*A)?(m[h[n]]&&!m[h[n+1]]?(g=n+1,I=c):g=n,h.splice(g,1)):I=c}return h});C(l.prototype,{beforeSetTickPositions:function(){var a,
d=[],e,g=!1,b,k=this.getExtremes(),u=k.min,n=k.max,c,f=this.isXAxis&&!!this.options.breaks,k=this.options.ordinal,q=Number.MAX_VALUE,m=this.chart.options.chart.ignoreHiddenSeries;b="highcharts-navigator-xaxis"===this.options.className;var A;!this.options.overscroll||this.max!==this.dataMax||this.chart.mouseIsDown&&!b||this.eventArgs&&(!this.eventArgs||"navigator"===this.eventArgs.trigger)||(this.max+=this.options.overscroll,!b&&F(this.userMin)&&(this.min+=this.options.overscroll));if(k||f){G(this.series,
function(b,c){e=[];if(!(m&&!1===b.visible||!1===b.takeOrdinalPosition&&!f)&&(d=d.concat(b.processedXData),a=d.length,d.sort(function(h,b){return h-b}),q=Math.min(q,r(b.closestPointRange,q)),a)){for(c=0;c<a-1;)d[c]!==d[c+1]&&e.push(d[c+1]),c++;e[0]!==d[0]&&e.unshift(d[0]);d=e}b.isSeriesBoosting&&(A=!0)});A&&(d.length=0);a=d.length;if(2<a){b=d[1]-d[0];for(c=a-1;c--&&!g;)d[c+1]-d[c]!==b&&(g=!0);!this.options.keepOrdinalPadding&&(d[0]-u>b||n-d[d.length-1]>b)&&(g=!0)}else this.options.overscroll&&(2===
a?q=d[1]-d[0]:1===a?(q=this.options.overscroll,d=[d[0],d[0]+q]):q=this.overscrollPointsRange);g?(this.options.overscroll&&(this.overscrollPointsRange=q,d=d.concat(this.getOverscrollPositions())),this.ordinalPositions=d,b=this.ordinal2lin(Math.max(u,d[0]),!0),c=Math.max(this.ordinal2lin(Math.min(n,d[d.length-1]),!0),1),this.ordinalSlope=n=(n-u)/(c-b),this.ordinalOffset=u-b*n):(this.overscrollPointsRange=r(this.closestPointRange,this.overscrollPointsRange),this.ordinalPositions=this.ordinalSlope=this.ordinalOffset=
void 0)}this.isOrdinal=k&&g;this.groupIntervalFactor=null},val2lin:function(a,d){var e=this.ordinalPositions;if(e){var g=e.length,b,k;for(b=g;b--;)if(e[b]===a){k=b;break}for(b=g-1;b--;)if(a>e[b]||0===b){a=(a-e[b])/(e[b+1]-e[b]);k=b+a;break}d=d?k:this.ordinalSlope*(k||0)+this.ordinalOffset}else d=a;return d},lin2val:function(a,d){var e=this.ordinalPositions;if(e){var g=this.ordinalSlope,b=this.ordinalOffset,k=e.length-1,u;if(d)0>a?a=e[0]:a>k?a=e[k]:(k=Math.floor(a),u=a-k);else for(;k--;)if(d=g*k+b,
a>=d){g=g*(k+1)+b;u=(a-d)/(g-d);break}return void 0!==u&&void 0!==e[k]?e[k]+(u?u*(e[k+1]-e[k]):0):a}return a},getExtendedPositions:function(){var a=this,d=a.chart,e=a.series[0].currentDataGrouping,g=a.ordinalIndex,b=e?e.count+e.unitName:"raw",k=a.options.overscroll,u=a.getExtremes(),n,c;g||(g=a.ordinalIndex={});g[b]||(n={series:[],chart:d,getExtremes:function(){return{min:u.dataMin,max:u.dataMax+k}},options:{ordinal:!0},val2lin:l.prototype.val2lin,ordinal2lin:l.prototype.ordinal2lin},G(a.series,function(b){c=
{xAxis:n,xData:b.xData.slice(),chart:d,destroyGroupedData:D};c.xData=c.xData.concat(a.getOverscrollPositions());c.options={dataGrouping:e?{enabled:!0,forced:!0,approximation:"open",units:[[e.unitName,[e.count]]]}:{enabled:!1}};b.processData.apply(c);n.series.push(c)}),a.beforeSetTickPositions.apply(n),g[b]=n.ordinalPositions);return g[b]},getOverscrollPositions:function(){var E=this.options.overscroll,d=this.overscrollPointsRange,e=[],g=this.dataMax;if(a.defined(d))for(e.push(g);g<=this.dataMax+E;)g+=
d,e.push(g);return e},getGroupIntervalFactor:function(a,d,e){var g;e=e.processedXData;var b=e.length,k=[];g=this.groupIntervalFactor;if(!g){for(g=0;g<b-1;g++)k[g]=e[g+1]-e[g];k.sort(function(b,a){return b-a});k=k[Math.floor(b/2)];a=Math.max(a,e[0]);d=Math.min(d,e[b-1]);this.groupIntervalFactor=g=b*k/(d-a)}return g},postProcessTickInterval:function(a){var d=this.ordinalSlope;return d?this.options.breaks?this.closestPointRange||a:a/(d/this.closestPointRange):a}});l.prototype.ordinal2lin=l.prototype.val2lin;
t(H.prototype,"pan",function(a,d){var e=this.xAxis[0],g=e.options.overscroll,b=d.chartX,k=!1;if(e.options.ordinal&&e.series.length){var u=this.mouseDownX,n=e.getExtremes(),c=n.dataMax,f=n.min,q=n.max,m=this.hoverPoints,A=e.closestPointRange||e.overscrollPointsRange,u=(u-b)/(e.translationSlope*(e.ordinalSlope||A)),w={ordinalPositions:e.getExtendedPositions()},A=e.lin2val,B=e.val2lin,h;w.ordinalPositions?1<Math.abs(u)&&(m&&G(m,function(h){h.setState()}),0>u?(m=w,h=e.ordinalPositions?e:w):(m=e.ordinalPositions?
e:w,h=w),w=h.ordinalPositions,c>w[w.length-1]&&w.push(c),this.fixedRange=q-f,u=e.toFixedRange(null,null,A.apply(m,[B.apply(m,[f,!0])+u,!0]),A.apply(h,[B.apply(h,[q,!0])+u,!0])),u.min>=Math.min(n.dataMin,f)&&u.max<=Math.max(c,q)+g&&e.setExtremes(u.min,u.max,!0,!1,{trigger:"pan"}),this.mouseDownX=b,v(this.container,{cursor:"move"})):k=!0}else k=!0;k&&(g&&(e.max=e.dataMax+g),a.apply(this,Array.prototype.slice.call(arguments,1)))})})(J);(function(a){function x(){return Array.prototype.slice.call(arguments,
1)}function l(a){a.apply(this);this.drawBreaks(this.xAxis,["x"]);this.drawBreaks(this.yAxis,v(this.pointArrayMap,["y"]))}var H=a.addEvent,v=a.pick,F=a.wrap,G=a.each,C=a.extend,D=a.isArray,r=a.fireEvent,y=a.Axis,t=a.Series;C(y.prototype,{isInBreak:function(a,d){var e=a.repeat||Infinity,g=a.from,b=a.to-a.from;d=d>=g?(d-g)%e:e-(g-d)%e;return a.inclusive?d<=b:d<b&&0!==d},isInAnyBreak:function(a,d){var e=this.options.breaks,g=e&&e.length,b,k,u;if(g){for(;g--;)this.isInBreak(e[g],a)&&(b=!0,k||(k=v(e[g].showPoints,
this.isXAxis?!1:!0)));u=b&&d?b&&!k:b}return u}});H(y,"afterInit",function(){"function"===typeof this.setBreaks&&this.setBreaks(this.options.breaks,!1)});H(y,"afterSetTickPositions",function(){if(this.isBroken){var a=this.tickPositions,d=this.tickPositions.info,e=[],g;for(g=0;g<a.length;g++)this.isInAnyBreak(a[g])||e.push(a[g]);this.tickPositions=e;this.tickPositions.info=d}});H(y,"afterSetOptions",function(){this.isBroken&&(this.options.ordinal=!1)});y.prototype.setBreaks=function(a,d){function e(a){var k=
a,c,f;for(f=0;f<b.breakArray.length;f++)if(c=b.breakArray[f],c.to<=a)k-=c.len;else if(c.from>=a)break;else if(b.isInBreak(c,a)){k-=a-c.from;break}return k}function g(a){var k,c;for(c=0;c<b.breakArray.length&&!(k=b.breakArray[c],k.from>=a);c++)k.to<a?a+=k.len:b.isInBreak(k,a)&&(a+=k.len);return a}var b=this,k=D(a)&&!!a.length;b.isDirty=b.isBroken!==k;b.isBroken=k;b.options.breaks=b.userOptions.breaks=a;b.forceRedraw=!0;k||b.val2lin!==e||(delete b.val2lin,delete b.lin2val);k&&(b.userOptions.ordinal=
!1,b.val2lin=e,b.lin2val=g,b.setExtremes=function(b,a,c,f,k){if(this.isBroken){for(;this.isInAnyBreak(b);)b-=this.closestPointRange;for(;this.isInAnyBreak(a);)a-=this.closestPointRange}y.prototype.setExtremes.call(this,b,a,c,f,k)},b.setAxisTranslation=function(a){y.prototype.setAxisTranslation.call(this,a);this.unitLength=null;if(this.isBroken){a=b.options.breaks;var k=[],c=[],f=0,q,m,A=b.userMin||b.min,w=b.userMax||b.max,B=v(b.pointRangePadding,0),h,p;G(a,function(h){m=h.repeat||Infinity;b.isInBreak(h,
A)&&(A+=h.to%m-A%m);b.isInBreak(h,w)&&(w-=w%m-h.from%m)});G(a,function(b){h=b.from;for(m=b.repeat||Infinity;h-m>A;)h-=m;for(;h<A;)h+=m;for(p=h;p<w;p+=m)k.push({value:p,move:"in"}),k.push({value:p+(b.to-b.from),move:"out",size:b.breakSize})});k.sort(function(h,b){return h.value===b.value?("in"===h.move?0:1)-("in"===b.move?0:1):h.value-b.value});q=0;h=A;G(k,function(b){q+="in"===b.move?1:-1;1===q&&"in"===b.move&&(h=b.value);0===q&&(c.push({from:h,to:b.value,len:b.value-h-(b.size||0)}),f+=b.value-h-
(b.size||0))});b.breakArray=c;b.unitLength=w-A-f+B;r(b,"afterBreaks");b.staticScale?b.transA=b.staticScale:b.unitLength&&(b.transA*=(w-b.min+B)/b.unitLength);B&&(b.minPixelPadding=b.transA*b.minPointOffset);b.min=A;b.max=w}});v(d,!0)&&this.chart.redraw()};F(t.prototype,"generatePoints",function(a){a.apply(this,x(arguments));var d=this.xAxis,e=this.yAxis,g=this.points,b,k=g.length,u=this.options.connectNulls,n;if(d&&e&&(d.options.breaks||e.options.breaks))for(;k--;)b=g[k],n=null===b.y&&!1===u,n||!d.isInAnyBreak(b.x,
!0)&&!e.isInAnyBreak(b.y,!0)||(g.splice(k,1),this.data[k]&&this.data[k].destroyElements())});a.Series.prototype.drawBreaks=function(a,d){var e=this,g=e.points,b,k,u,n;a&&G(d,function(c){b=a.breakArray||[];k=a.isXAxis?a.min:v(e.options.threshold,a.min);G(g,function(f){n=v(f["stack"+c.toUpperCase()],f[c]);G(b,function(b){u=!1;if(k<b.from&&n>b.to||k>b.from&&n<b.from)u="pointBreak";else if(k<b.from&&n>b.from&&n<b.to||k>b.from&&n>b.to&&n<b.from)u="pointInBreak";u&&r(a,u,{point:f,brk:b})})})})};a.Series.prototype.gappedPath=
function(){var t=this.currentDataGrouping,d=t&&t.totalRange,t=this.options.gapSize,e=this.points.slice(),g=e.length-1,b=this.yAxis;if(t&&0<g)for("value"!==this.options.gapUnit&&(t*=this.closestPointRange),d&&d>t&&(t=d);g--;)e[g+1].x-e[g].x>t&&(d=(e[g].x+e[g+1].x)/2,e.splice(g+1,0,{isNull:!0,x:d}),this.options.stacking&&(d=b.stacks[this.stackKey][d]=new a.StackItem(b,b.options.stackLabels,!1,d,this.stack),d.total=0));return this.getGraphPath(e)};F(a.seriesTypes.column.prototype,"drawPoints",l);F(a.Series.prototype,
"drawPoints",l)})(J);(function(a){var x=a.addEvent,l=a.arrayMax,H=a.arrayMin,v=a.Axis,F=a.defaultPlotOptions,G=a.defined,C=a.each,D=a.extend,r=a.format,y=a.isNumber,t=a.merge,E=a.pick,d=a.Point,e=a.Series,g=a.Tooltip,b=a.wrap,k=e.prototype,u=k.processData,n=k.generatePoints,c={approximation:"average",groupPixelWidth:2,dateTimeLabelFormats:{millisecond:["%A, %b %e, %H:%M:%S.%L","%A, %b %e, %H:%M:%S.%L","-%H:%M:%S.%L"],second:["%A, %b %e, %H:%M:%S","%A, %b %e, %H:%M:%S","-%H:%M:%S"],minute:["%A, %b %e, %H:%M",
"%A, %b %e, %H:%M","-%H:%M"],hour:["%A, %b %e, %H:%M","%A, %b %e, %H:%M","-%H:%M"],day:["%A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],week:["Week from %A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],month:["%B %Y","%B","-%B %Y"],year:["%Y","%Y","-%Y"]}},f={line:{},spline:{},area:{},areaspline:{},column:{approximation:"sum",groupPixelWidth:10},arearange:{approximation:"range"},areasplinerange:{approximation:"range"},columnrange:{approximation:"range",groupPixelWidth:10},candlestick:{approximation:"ohlc",
groupPixelWidth:10},ohlc:{approximation:"ohlc",groupPixelWidth:5}},q=a.defaultDataGroupingUnits=[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1]],["week",[1]],["month",[1,3,6]],["year",null]],m=a.approximations={sum:function(b){var a=b.length,c;if(!a&&b.hasNulls)c=null;else if(a)for(c=0;a--;)c+=b[a];return c},average:function(b){var a=b.length;b=m.sum(b);y(b)&&a&&(b/=a);return b},averages:function(){var b=
[];C(arguments,function(a){b.push(m.average(a))});return void 0===b[0]?void 0:b},open:function(b){return b.length?b[0]:b.hasNulls?null:void 0},high:function(b){return b.length?l(b):b.hasNulls?null:void 0},low:function(b){return b.length?H(b):b.hasNulls?null:void 0},close:function(b){return b.length?b[b.length-1]:b.hasNulls?null:void 0},ohlc:function(b,a,c,h){b=m.open(b);a=m.high(a);c=m.low(c);h=m.close(h);if(y(b)||y(a)||y(c)||y(h))return[b,a,c,h]},range:function(b,a){b=m.low(b);a=m.high(a);if(y(b)||
y(a))return[b,a];if(null===b&&null===a)return null}};k.groupData=function(b,a,k,h){var p=this,z=p.data,w=p.options.data,I=[],q=[],e=[],A=b.length,d,B,g=!!a,u=[];h="function"===typeof h?h:m[h]||f[p.type]&&m[f[p.type].approximation]||m[c.approximation];var n=p.pointArrayMap,r=n&&n.length,l=["x"].concat(n||["y"]),F=0,v=0,D,E;r?C(n,function(){u.push([])}):u.push([]);D=r||1;for(E=0;E<=A&&!(b[E]>=k[0]);E++);for(E;E<=A;E++){for(;void 0!==k[F+1]&&b[E]>=k[F+1]||E===A;){d=k[F];p.dataGroupInfo={start:v,length:u[0].length};
B=h.apply(p,u);G(p.dataGroupInfo.options)||(p.dataGroupInfo.options=t(p.pointClass.prototype.optionsToObject.call({series:p},p.options.data[v])),C(l,function(b){delete p.dataGroupInfo.options[b]}));void 0!==B&&(I.push(d),q.push(B),e.push(p.dataGroupInfo));v=E;for(d=0;d<D;d++)u[d].length=0,u[d].hasNulls=!1;F+=1;if(E===A)break}if(E===A)break;if(n){d=p.cropStart+E;B=z&&z[d]||p.pointClass.prototype.applyOptions.apply({series:p},[w[d]]);var x;for(d=0;d<r;d++)x=B[n[d]],y(x)?u[d].push(x):null===x&&(u[d].hasNulls=
!0)}else d=g?a[E]:null,y(d)?u[0].push(d):null===d&&(u[0].hasNulls=!0)}return[I,q,e]};k.processData=function(){var b=this.chart,a=this.options.dataGrouping,c=!1!==this.allowDG&&a&&E(a.enabled,b.options.isStock),h=this.visible||!b.options.chart.ignoreHiddenSeries,p,z=this.currentDataGrouping,f;this.forceCrop=c;this.groupPixelWidth=null;this.hasProcessed=!0;if(!1!==u.apply(this,arguments)&&c){this.destroyGroupedData();var I,d=a.groupAll?this.xData:this.processedXData,m=a.groupAll?this.yData:this.processedYData,
e=b.plotSizeX,b=this.xAxis,n=b.options.ordinal,g=this.groupPixelWidth=b.getGroupPixelWidth&&b.getGroupPixelWidth();if(g){this.isDirty=p=!0;this.points=null;c=b.getExtremes();f=c.min;c=c.max;n=n&&b.getGroupIntervalFactor(f,c,this)||1;g=g*(c-f)/e*n;e=b.getTimeTicks(b.normalizeTimeTickInterval(g,a.units||q),Math.min(f,d[0]),Math.max(c,d[d.length-1]),b.options.startOfWeek,d,this.closestPointRange);m=k.groupData.apply(this,[d,m,e,a.approximation]);d=m[0];n=m[1];if(a.smoothed&&d.length){I=d.length-1;for(d[I]=
Math.min(d[I],c);I--&&0<I;)d[I]+=g/2;d[0]=Math.max(d[0],f)}f=e.info;this.closestPointRange=e.info.totalRange;this.groupMap=m[2];if(G(d[0])&&d[0]<b.dataMin&&h){if(!G(b.options.min)&&b.min<=b.dataMin||b.min===b.dataMin)b.min=d[0];b.dataMin=d[0]}a.groupAll&&(a=this.cropData(d,n,b.min,b.max,1),d=a.xData,n=a.yData);this.processedXData=d;this.processedYData=n}else this.groupMap=null;this.hasGroupedData=p;this.currentDataGrouping=f;this.preventGraphAnimation=(z&&z.totalRange)!==(f&&f.totalRange)}};k.destroyGroupedData=
function(){var b=this.groupedData;C(b||[],function(a,c){a&&(b[c]=a.destroy?a.destroy():null)});this.groupedData=null};k.generatePoints=function(){n.apply(this);this.destroyGroupedData();this.groupedData=this.hasGroupedData?this.points:null};x(d,"update",function(){if(this.dataGroup)return a.error(24),!1});b(g.prototype,"tooltipFooterHeaderFormatter",function(b,a,c){var h=this.chart.time,p=a.series,z=p.tooltipOptions,f=p.options.dataGrouping,k=z.xDateFormat,d,m=p.xAxis;return m&&"datetime"===m.options.type&&
f&&y(a.key)?(b=p.currentDataGrouping,f=f.dateTimeLabelFormats,b?(m=f[b.unitName],1===b.count?k=m[0]:(k=m[1],d=m[2])):!k&&f&&(k=this.getXDateFormat(a,z,m)),k=h.dateFormat(k,a.key),d&&(k+=h.dateFormat(d,a.key+b.totalRange-1)),r(z[(c?"footer":"header")+"Format"],{point:D(a.point,{key:k}),series:p},h)):b.call(this,a,c)});x(e,"destroy",k.destroyGroupedData);x(e,"afterSetOptions",function(b){b=b.options;var a=this.type,k=this.chart.options.plotOptions,h=F[a].dataGrouping,p=this.useCommonDataGrouping&&c;
if(f[a]||p)h||(h=t(c,f[a])),b.dataGrouping=t(p,h,k.series&&k.series.dataGrouping,k[a].dataGrouping,this.userOptions.dataGrouping);this.chart.options.isStock&&(this.requireSorting=!0)});x(v,"afterSetScale",function(){C(this.series,function(b){b.hasProcessed=!1})});v.prototype.getGroupPixelWidth=function(){var b=this.series,a=b.length,c,h=0,p=!1,z;for(c=a;c--;)(z=b[c].options.dataGrouping)&&(h=Math.max(h,z.groupPixelWidth));for(c=a;c--;)(z=b[c].options.dataGrouping)&&b[c].hasProcessed&&(a=(b[c].processedXData||
b[c].data).length,b[c].groupPixelWidth||a>this.chart.plotSizeX/h||a&&z.forced)&&(p=!0);return p?h:0};v.prototype.setDataGrouping=function(b,a){var c;a=E(a,!0);b||(b={forced:!1,units:null});if(this instanceof v)for(c=this.series.length;c--;)this.series[c].update({dataGrouping:b},!1);else C(this.chart.options.series,function(h){h.dataGrouping=b},!1);this.ordinalSlope=null;a&&this.chart.redraw()}})(J);(function(a){var x=a.each,l=a.Point,H=a.seriesType,v=a.seriesTypes;H("ohlc","column",{lineWidth:1,tooltip:{pointFormat:'\x3cspan class\x3d"highcharts-color-{point.colorIndex}"\x3e\u25cf\x3c/span\x3e \x3cb\x3e {series.name}\x3c/b\x3e\x3cbr/\x3eOpen: {point.open}\x3cbr/\x3eHigh: {point.high}\x3cbr/\x3eLow: {point.low}\x3cbr/\x3eClose: {point.close}\x3cbr/\x3e'},
threshold:null,stickyTracking:!0},{directTouch:!1,pointArrayMap:["open","high","low","close"],toYData:function(a){return[a.open,a.high,a.low,a.close]},pointValKey:"close",translate:function(){var a=this,l=a.yAxis,C=!!a.modifyValue,D=["plotOpen","plotHigh","plotLow","plotClose","yBottom"];v.column.prototype.translate.apply(a);x(a.points,function(r){x([r.open,r.high,r.low,r.close,r.low],function(y,t){null!==y&&(C&&(y=a.modifyValue(y)),r[D[t]]=l.toPixels(y,!0))});r.tooltipPos[1]=r.plotHigh+l.pos-a.chart.plotTop})},
drawPoints:function(){var a=this,l=a.chart;x(a.points,function(C){var v,r,y,t,E=C.graphic,d,e=!E;void 0!==C.plotY&&(E||(C.graphic=E=l.renderer.path().add(a.group)),r=E.strokeWidth()%2/2,d=Math.round(C.plotX)-r,y=Math.round(C.shapeArgs.width/2),t=["M",d,Math.round(C.yBottom),"L",d,Math.round(C.plotHigh)],null!==C.open&&(v=Math.round(C.plotOpen)+r,t.push("M",d,v,"L",d-y,v)),null!==C.close&&(v=Math.round(C.plotClose)+r,t.push("M",d,v,"L",d+y,v)),E[e?"attr":"animate"]({d:t}).addClass(C.getClassName(),
!0))})},animate:null},{getClassName:function(){return l.prototype.getClassName.call(this)+(this.open<this.close?" highcharts-point-up":" highcharts-point-down")}})})(J);(function(a){var x=a.defaultPlotOptions,l=a.each,H=a.merge;a=a.seriesType;a("candlestick","ohlc",H(x.column,{states:{hover:{lineWidth:2}},tooltip:x.ohlc.tooltip,threshold:null,stickyTracking:!0}),{drawPoints:function(){var a=this,F=a.chart,x=a.yAxis.reversed;l(a.points,function(l){var v=l.graphic,r,y,t,E,d,e,g,b=!v;void 0!==l.plotY&&
(v||(l.graphic=v=F.renderer.path().add(a.group)),d=v.strokeWidth()%2/2,e=Math.round(l.plotX)-d,r=l.plotOpen,y=l.plotClose,t=Math.min(r,y),r=Math.max(r,y),g=Math.round(l.shapeArgs.width/2),y=x?r!==l.yBottom:Math.round(t)!==Math.round(l.plotHigh),E=x?Math.round(t)!==Math.round(l.plotHigh):r!==l.yBottom,t=Math.round(t)+d,r=Math.round(r)+d,d=[],d.push("M",e-g,r,"L",e-g,t,"L",e+g,t,"L",e+g,r,"Z","M",e,t,"L",e,y?Math.round(x?l.yBottom:l.plotHigh):t,"M",e,r,"L",e,E?Math.round(x?l.plotHigh:l.yBottom):r),
v[b?"attr":"animate"]({d:d}).addClass(l.getClassName(),!0))})}})})(J);var W=function(a){var x=a.each,l=a.defined,H=a.seriesTypes,v=a.stableSort;return{getPlotBox:function(){return a.Series.prototype.getPlotBox.call(this.options.onSeries&&this.chart.get(this.options.onSeries)||this)},translate:function(){H.column.prototype.translate.apply(this);var a=this.options,G=this.chart,C=this.points,D=C.length-1,r,y,t=a.onSeries,t=t&&G.get(t),a=a.onKey||"y",E=t&&t.options.step,d=t&&t.points,e=d&&d.length,g=
G.inverted,b=this.xAxis,k=this.yAxis,u=0,n,c,f,q;if(t&&t.visible&&e)for(u=(t.pointXOffset||0)+(t.barW||0)/2,r=t.currentDataGrouping,c=d[e-1].x+(r?r.totalRange:0),v(C,function(b,a){return b.x-a.x}),a="plot"+a[0].toUpperCase()+a.substr(1);e--&&C[D]&&!(n=d[e],r=C[D],r.y=n.y,n.x<=r.x&&void 0!==n[a]&&(r.x<=c&&(r.plotY=n[a],n.x<r.x&&!E&&(f=d[e+1])&&void 0!==f[a]&&(q=(r.x-n.x)/(f.x-n.x),r.plotY+=q*(f[a]-n[a]),r.y+=q*(f.y-n.y))),D--,e++,0>D)););x(C,function(a,c){var f;a.plotX+=u;if(void 0===a.plotY||g)0<=
a.plotX&&a.plotX<=b.len?g?(a.plotY=b.translate(a.x,0,1,0,1),a.plotX=l(a.y)?k.translate(a.y,0,0,0,1):0):a.plotY=G.chartHeight-b.bottom-(b.opposite?b.height:0)+b.offset-k.top:a.shapeArgs={};(y=C[c-1])&&y.plotX===a.plotX&&(void 0===y.stackIndex&&(y.stackIndex=0),f=y.stackIndex+1);a.stackIndex=f});this.onSeries=t}}}(J);(function(a,x){function l(a){r[a+"pin"]=function(t,l,d,e,g){var b=g&&g.anchorX;g=g&&g.anchorY;"circle"===a&&e>d&&(t-=Math.round((e-d)/2),d=e);t=r[a](t,l,d,e);b&&g&&(t.push("M","circle"===
a?t[1]-t[4]:t[1]+t[4]/2,l>g?l:l+e,"L",b,g),t=t.concat(r.circle(b-1,g-1,2,2)));return t}}var H=a.addEvent,v=a.each,F=a.noop,G=a.Series,C=a.seriesType,D=a.TrackerMixin,r=a.SVGRenderer.prototype.symbols;C("flags","column",{pointRange:0,allowOverlapX:!1,shape:"flag",stackDistance:12,textAlign:"center",tooltip:{pointFormat:"{point.text}\x3cbr/\x3e"},threshold:null,y:-30},{sorted:!1,noSharedTooltip:!0,allowDG:!1,takeOrdinalPosition:!1,trackerGroups:["markerGroup"],forceCrop:!0,init:G.prototype.init,translate:x.translate,
getPlotBox:x.getPlotBox,drawPoints:function(){var l=this.points,t=this.chart,r=t.renderer,d,e,g=t.inverted,b=this.options,k=b.y,u,n,c,f,q,m,A=this.yAxis,w={},B=[];for(n=l.length;n--;)c=l[n],m=(g?c.plotY:c.plotX)>this.xAxis.len,d=c.plotX,f=c.stackIndex,u=c.options.shape||b.shape,e=c.plotY,void 0!==e&&(e=c.plotY+k-(void 0!==f&&f*b.stackDistance)),c.anchorX=f?void 0:c.plotX,q=f?void 0:c.plotY,f=c.graphic,void 0!==e&&0<=d&&!m?(f||(f=c.graphic=r.label("",null,null,u,null,null,b.useHTML).attr({align:"flag"===
u?"left":"center",width:b.width,height:b.height,"text-align":b.textAlign}).addClass("highcharts-point").add(this.markerGroup),c.graphic.div&&(c.graphic.div.point=c),f.isNew=!0),0<d&&(d-=f.strokeWidth()%2),u={y:e,anchorY:q},b.allowOverlapX&&(u.x=d,u.anchorX=c.anchorX),f.attr({text:c.options.title||b.title||"A"})[f.isNew?"attr":"animate"](u),b.allowOverlapX||(w[c.plotX]?w[c.plotX].size=Math.max(w[c.plotX].size,f.width):w[c.plotX]={align:0,size:f.width,target:d,anchorX:d}),c.tooltipPos=[d,e+A.pos-t.plotTop]):
f&&(c.graphic=f.destroy());b.allowOverlapX||(a.objectEach(w,function(b){b.plotX=b.anchorX;B.push(b)}),a.distribute(B,g?A.len:this.xAxis.len,100),v(l,function(b){var a=b.graphic&&w[b.plotX];a&&(b.graphic[b.graphic.isNew?"attr":"animate"]({x:a.pos,anchorX:b.anchorX}),a.pos?b.graphic.isNew=!1:(b.graphic.attr({x:-9999,anchorX:-9999}),b.graphic.isNew=!0))}));b.useHTML&&a.wrap(this.markerGroup,"on",function(b){return a.SVGElement.prototype.on.apply(b.apply(this,[].slice.call(arguments,1)),[].slice.call(arguments,
1))})},drawTracker:function(){var a=this.points;D.drawTrackerPoint.apply(this);v(a,function(t){var l=t.graphic;l&&H(l.element,"mouseover",function(){0<t.stackIndex&&!t.raised&&(t._y=l.y,l.attr({y:t._y-8}),t.raised=!0);v(a,function(a){a!==t&&a.raised&&a.graphic&&(a.graphic.attr({y:a._y}),a.raised=!1)})})})},animate:function(a){a?this.setClip():this.animate=null},setClip:function(){G.prototype.setClip.apply(this,arguments);!1!==this.options.clip&&this.sharedClipKey&&this.markerGroup.clip(this.chart[this.sharedClipKey])},
buildKDTree:F,invertGroups:F});r.flag=function(a,l,v,d,e){var g=e&&e.anchorX||a;e=e&&e.anchorY||l;return r.circle(g-1,e-1,2,2).concat(["M",g,e,"L",a,l+d,a,l,a+v,l,a+v,l+d,a,l+d,"Z"])};l("circle");l("square")})(J,W);(function(a){function x(b,a,d){this.init(b,a,d)}var l=a.addEvent,H=a.Axis,v=a.correctFloat,F=a.defaultOptions,G=a.defined,C=a.destroyObjectProperties,D=a.each,r=a.fireEvent,y=a.hasTouch,t=a.merge,E=a.pick,d=a.removeEvent,e,g={height:a.isTouchDevice?20:14,barBorderRadius:0,buttonBorderRadius:0,
liveRedraw:void 0,margin:10,minWidth:6,step:.2,zIndex:3};F.scrollbar=t(!0,g,F.scrollbar);a.swapXY=e=function(b,a){var k=b.length,d;if(a)for(a=0;a<k;a+=3)d=b[a+1],b[a+1]=b[a+2],b[a+2]=d;return b};x.prototype={init:function(b,a,d){this.scrollbarButtons=[];this.renderer=b;this.userOptions=a;this.options=t(g,a);this.chart=d;this.size=E(this.options.size,this.options.height);a.enabled&&(this.render(),this.initEvents(),this.addEvents())},render:function(){var b=this.renderer,a=this.options,d=this.size,
g;this.group=g=b.g("scrollbar").attr({zIndex:a.zIndex,translateY:-99999}).add();this.track=b.rect().addClass("highcharts-scrollbar-track").attr({x:0,r:a.trackBorderRadius||0,height:d,width:d}).add(g);this.trackBorderWidth=this.track.strokeWidth();this.track.attr({y:-this.trackBorderWidth%2/2});this.scrollbarGroup=b.g().add(g);this.scrollbar=b.rect().addClass("highcharts-scrollbar-thumb").attr({height:d,width:d,r:a.barBorderRadius||0}).add(this.scrollbarGroup);this.scrollbarRifles=b.path(e(["M",-3,
d/4,"L",-3,2*d/3,"M",0,d/4,"L",0,2*d/3,"M",3,d/4,"L",3,2*d/3],a.vertical)).addClass("highcharts-scrollbar-rifles").add(this.scrollbarGroup);this.scrollbarStrokeWidth=this.scrollbar.strokeWidth();this.scrollbarGroup.translate(-this.scrollbarStrokeWidth%2/2,-this.scrollbarStrokeWidth%2/2);this.drawScrollbarButton(0);this.drawScrollbarButton(1)},position:function(b,a,d,e){var c=this.options.vertical,f=0,k=this.rendered?"animate":"attr";this.x=b;this.y=a+this.trackBorderWidth;this.width=d;this.xOffset=
this.height=e;this.yOffset=f;c?(this.width=this.yOffset=d=f=this.size,this.xOffset=a=0,this.barWidth=e-2*d,this.x=b+=this.options.margin):(this.height=this.xOffset=e=a=this.size,this.barWidth=d-2*e,this.y+=this.options.margin);this.group[k]({translateX:b,translateY:this.y});this.track[k]({width:d,height:e});this.scrollbarButtons[1][k]({translateX:c?0:d-a,translateY:c?e-f:0})},drawScrollbarButton:function(b){var a=this.renderer,d=this.scrollbarButtons,g=this.options,c=this.size,f;f=a.g().add(this.group);
d.push(f);f=a.rect().addClass("highcharts-scrollbar-button").add(f);f.attr(f.crisp({x:-.5,y:-.5,width:c+1,height:c+1,r:g.buttonBorderRadius},f.strokeWidth()));a.path(e(["M",c/2+(b?-1:1),c/2-3,"L",c/2+(b?-1:1),c/2+3,"L",c/2+(b?2:-2),c/2],g.vertical)).addClass("highcharts-scrollbar-arrow").add(d[b])},setRange:function(b,a){var d=this.options,k=d.vertical,c=d.minWidth,f=this.barWidth,e,m,g=!this.rendered||this.hasDragged||this.chart.navigator&&this.chart.navigator.hasDragged?"attr":"animate";G(f)&&(b=
Math.max(b,0),e=Math.ceil(f*b),this.calculatedWidth=m=v(f*Math.min(a,1)-e),m<c&&(e=(f-c+m)*b,m=c),c=Math.floor(e+this.xOffset+this.yOffset),f=m/2-.5,this.from=b,this.to=a,k?(this.scrollbarGroup[g]({translateY:c}),this.scrollbar[g]({height:m}),this.scrollbarRifles[g]({translateY:f}),this.scrollbarTop=c,this.scrollbarLeft=0):(this.scrollbarGroup[g]({translateX:c}),this.scrollbar[g]({width:m}),this.scrollbarRifles[g]({translateX:f}),this.scrollbarLeft=c,this.scrollbarTop=0),12>=m?this.scrollbarRifles.hide():
this.scrollbarRifles.show(!0),!1===d.showFull&&(0>=b&&1<=a?this.group.hide():this.group.show()),this.rendered=!0)},initEvents:function(){var b=this;b.mouseMoveHandler=function(a){var d=b.chart.pointer.normalize(a),k=b.options.vertical?"chartY":"chartX",c=b.initPositions;!b.grabbedCenter||a.touches&&0===a.touches[0][k]||(d=b.cursorToScrollbarPosition(d)[k],k=b[k],k=d-k,b.hasDragged=!0,b.updatePosition(c[0]+k,c[1]+k),b.hasDragged&&r(b,"changed",{from:b.from,to:b.to,trigger:"scrollbar",DOMType:a.type,
DOMEvent:a}))};b.mouseUpHandler=function(a){b.hasDragged&&r(b,"changed",{from:b.from,to:b.to,trigger:"scrollbar",DOMType:a.type,DOMEvent:a});b.grabbedCenter=b.hasDragged=b.chartX=b.chartY=null};b.mouseDownHandler=function(a){a=b.chart.pointer.normalize(a);a=b.cursorToScrollbarPosition(a);b.chartX=a.chartX;b.chartY=a.chartY;b.initPositions=[b.from,b.to];b.grabbedCenter=!0};b.buttonToMinClick=function(a){var d=v(b.to-b.from)*b.options.step;b.updatePosition(v(b.from-d),v(b.to-d));r(b,"changed",{from:b.from,
to:b.to,trigger:"scrollbar",DOMEvent:a})};b.buttonToMaxClick=function(a){var d=(b.to-b.from)*b.options.step;b.updatePosition(b.from+d,b.to+d);r(b,"changed",{from:b.from,to:b.to,trigger:"scrollbar",DOMEvent:a})};b.trackClick=function(a){var d=b.chart.pointer.normalize(a),e=b.to-b.from,c=b.y+b.scrollbarTop,f=b.x+b.scrollbarLeft;b.options.vertical&&d.chartY>c||!b.options.vertical&&d.chartX>f?b.updatePosition(b.from+e,b.to+e):b.updatePosition(b.from-e,b.to-e);r(b,"changed",{from:b.from,to:b.to,trigger:"scrollbar",
DOMEvent:a})}},cursorToScrollbarPosition:function(b){var a=this.options,a=a.minWidth>this.calculatedWidth?a.minWidth:0;return{chartX:(b.chartX-this.x-this.xOffset)/(this.barWidth-a),chartY:(b.chartY-this.y-this.yOffset)/(this.barWidth-a)}},updatePosition:function(b,a){1<a&&(b=v(1-v(a-b)),a=1);0>b&&(a=v(a-b),b=0);this.from=b;this.to=a},update:function(a){this.destroy();this.init(this.chart.renderer,t(!0,this.options,a),this.chart)},addEvents:function(){var a=this.options.inverted?[1,0]:[0,1],d=this.scrollbarButtons,
e=this.scrollbarGroup.element,g=this.mouseDownHandler,c=this.mouseMoveHandler,f=this.mouseUpHandler,a=[[d[a[0]].element,"click",this.buttonToMinClick],[d[a[1]].element,"click",this.buttonToMaxClick],[this.track.element,"click",this.trackClick],[e,"mousedown",g],[e.ownerDocument,"mousemove",c],[e.ownerDocument,"mouseup",f]];y&&a.push([e,"touchstart",g],[e.ownerDocument,"touchmove",c],[e.ownerDocument,"touchend",f]);D(a,function(a){l.apply(null,a)});this._events=a},removeEvents:function(){D(this._events,
function(a){d.apply(null,a)});this._events.length=0},destroy:function(){var a=this.chart.scroller;this.removeEvents();D(["track","scrollbarRifles","scrollbar","scrollbarGroup","group"],function(a){this[a]&&this[a].destroy&&(this[a]=this[a].destroy())},this);a&&this===a.scrollbar&&(a.scrollbar=null,C(a.scrollbarButtons))}};l(H,"afterInit",function(){var a=this;a.options&&a.options.scrollbar&&a.options.scrollbar.enabled&&(a.options.scrollbar.vertical=!a.horiz,a.options.startOnTick=a.options.endOnTick=
!1,a.scrollbar=new x(a.chart.renderer,a.options.scrollbar,a.chart),l(a.scrollbar,"changed",function(b){var d=Math.min(E(a.options.min,a.min),a.min,a.dataMin),e=Math.max(E(a.options.max,a.max),a.max,a.dataMax)-d,c;a.horiz&&!a.reversed||!a.horiz&&a.reversed?(c=d+e*this.to,d+=e*this.from):(c=d+e*(1-this.from),d+=e*(1-this.to));a.setExtremes(d,c,!0,!1,b)}))});l(H,"afterRender",function(){var a=Math.min(E(this.options.min,this.min),this.min,E(this.dataMin,this.min)),d=Math.max(E(this.options.max,this.max),
this.max,E(this.dataMax,this.max)),e=this.scrollbar,g=this.titleOffset||0;if(e){this.horiz?(e.position(this.left,this.top+this.height+2+this.chart.scrollbarsOffsets[1]+(this.opposite?0:g+this.axisTitleMargin+this.offset),this.width,this.height),g=1):(e.position(this.left+this.width+2+this.chart.scrollbarsOffsets[0]+(this.opposite?g+this.axisTitleMargin+this.offset:0),this.top,this.width,this.height),g=0);if(!this.opposite&&!this.horiz||this.opposite&&this.horiz)this.chart.scrollbarsOffsets[g]+=this.scrollbar.size+
this.scrollbar.options.margin;isNaN(a)||isNaN(d)||!G(this.min)||!G(this.max)?e.setRange(0,0):(g=(this.min-a)/(d-a),a=(this.max-a)/(d-a),this.horiz&&!this.reversed||!this.horiz&&this.reversed?e.setRange(g,a):e.setRange(1-a,1-g))}});l(H,"afterGetOffset",function(){var a=this.horiz?2:1,d=this.scrollbar;d&&(this.chart.scrollbarsOffsets=[0,0],this.chart.axisOffset[a]+=d.size+d.options.margin)});a.Scrollbar=x})(J);(function(a){function x(a){this.init(a)}var l=a.addEvent,H=a.Axis,v=a.Chart,F=a.defaultOptions,
G=a.defined,C=a.destroyObjectProperties,D=a.each,r=a.erase,y=a.error,t=a.extend,E=a.grep,d=a.hasTouch,e=a.isArray,g=a.isNumber,b=a.isObject,k=a.isTouchDevice,u=a.merge,n=a.pick,c=a.removeEvent,f=a.Scrollbar,q=a.Series,m=a.seriesTypes,A=a.wrap,w=[].concat(a.defaultDataGroupingUnits),B=function(a){var b=E(arguments,g);if(b.length)return Math[a].apply(0,b)};w[4]=["day",[1,2,3,4]];w[5]=["week",[1,2,3]];t(F,{navigator:{height:40,margin:25,maskInside:!0,handles:{width:7,height:15,symbols:["navigator-handle",
"navigator-handle"],enabled:!0},series:{type:void 0===m.areaspline?"line":"areaspline",compare:null,dataGrouping:{approximation:"average",enabled:!0,groupPixelWidth:2,smoothed:!0,units:w},dataLabels:{enabled:!1,zIndex:2},id:"highcharts-navigator-series",className:"highcharts-navigator-series",lineColor:null,marker:{enabled:!1},pointRange:0,threshold:null},xAxis:{overscroll:0,className:"highcharts-navigator-xaxis",tickLength:0,tickPixelInterval:200,labels:{align:"left",x:3,y:-4},crosshair:!1},yAxis:{className:"highcharts-navigator-yaxis",
startOnTick:!1,endOnTick:!1,minPadding:.1,maxPadding:.1,labels:{enabled:!1},crosshair:!1,title:{text:null},tickLength:0,tickWidth:0}}});a.Renderer.prototype.symbols["navigator-handle"]=function(a,b,c,d,f){a=f.width/2;b=Math.round(a/3)+.5;f=f.height;return["M",-a-1,.5,"L",a,.5,"L",a,f+.5,"L",-a-1,f+.5,"L",-a-1,.5,"M",-b,4,"L",-b,f-3,"M",b-1,4,"L",b-1,f-3]};x.prototype={drawHandle:function(a,b,c,d){var h=this.navigatorOptions.handles.height;this.handles[b][d](c?{translateX:Math.round(this.left+this.height/
2),translateY:Math.round(this.top+parseInt(a,10)+.5-h)}:{translateX:Math.round(this.left+parseInt(a,10)),translateY:Math.round(this.top+this.height/2-h/2-1)})},drawOutline:function(a,b,c,d){var h=this.navigatorOptions.maskInside,p=this.outline.strokeWidth(),f=p/2,p=p%2/2,z=this.outlineHeight,e=this.scrollbarHeight,m=this.size,g=this.left-e,q=this.top;c?(g-=f,c=q+b+p,b=q+a+p,a=["M",g+z,q-e-p,"L",g+z,c,"L",g,c,"L",g,b,"L",g+z,b,"L",g+z,q+m+e].concat(h?["M",g+z,c-f,"L",g+z,b+f]:[])):(a+=g+e-p,b+=g+e-
p,q+=f,a=["M",g,q,"L",a,q,"L",a,q+z,"L",b,q+z,"L",b,q,"L",g+m+2*e,q].concat(h?["M",a-f,q,"L",b+f,q]:[]));this.outline[d]({d:a})},drawMasks:function(a,b,c,d){var h=this.left,p=this.top,f=this.height,z,e,g,q;c?(g=[h,h,h],q=[p,p+a,p+b],e=[f,f,f],z=[a,b-a,this.size-b]):(g=[h,h+a,h+b],q=[p,p,p],e=[a,b-a,this.size-b],z=[f,f,f]);D(this.shades,function(a,b){a[d]({x:g[b],y:q[b],width:e[b],height:z[b]})})},renderElements:function(){var a=this,b=a.navigatorOptions,c=b.maskInside,d=a.chart,f=d.renderer,e;a.navigatorGroup=
e=f.g("navigator").attr({zIndex:8,visibility:"hidden"}).add();D([!c,c,!c],function(b,h){a.shades[h]=f.rect().addClass("highcharts-navigator-mask"+(1===h?"-inside":"-outside")).add(e)});a.outline=f.path().addClass("highcharts-navigator-outline").add(e);b.handles.enabled&&D([0,1],function(h){b.handles.inverted=d.inverted;a.handles[h]=f.symbol(b.handles.symbols[h],-b.handles.width/2-1,0,b.handles.width,b.handles.height,b.handles);a.handles[h].attr({zIndex:7-h}).addClass("highcharts-navigator-handle highcharts-navigator-handle-"+
["left","right"][h]).add(e)})},update:function(a){D(this.series||[],function(a){a.baseSeries&&delete a.baseSeries.navigatorSeries});this.destroy();u(!0,this.chart.options.navigator,this.options,a);this.init(this.chart)},render:function(b,c,d,f){var h=this.chart,p,e,z=this.scrollbarHeight,q,m=this.xAxis;p=m.fake?h.xAxis[0]:m;var w=this.navigatorEnabled,k,K=this.rendered;e=h.inverted;var B,l=h.xAxis[0].minRange,A=h.xAxis[0].options.maxRange;if(!this.hasDragged||G(d)){if(!g(b)||!g(c))if(K)d=0,f=n(m.width,
p.width);else return;this.left=n(m.left,h.plotLeft+z+(e?h.plotWidth:0));this.size=k=q=n(m.len,(e?h.plotHeight:h.plotWidth)-2*z);h=e?z:q+2*z;d=n(d,m.toPixels(b,!0));f=n(f,m.toPixels(c,!0));g(d)&&Infinity!==Math.abs(d)||(d=0,f=h);b=m.toValue(d,!0);c=m.toValue(f,!0);B=Math.abs(a.correctFloat(c-b));B<l?this.grabbedLeft?d=m.toPixels(c-l,!0):this.grabbedRight&&(f=m.toPixels(b+l,!0)):G(A)&&B>A&&(this.grabbedLeft?d=m.toPixels(c-A,!0):this.grabbedRight&&(f=m.toPixels(b+A,!0)));this.zoomedMax=Math.min(Math.max(d,
f,0),k);this.zoomedMin=Math.min(Math.max(this.fixedWidth?this.zoomedMax-this.fixedWidth:Math.min(d,f),0),k);this.range=this.zoomedMax-this.zoomedMin;k=Math.round(this.zoomedMax);d=Math.round(this.zoomedMin);w&&(this.navigatorGroup.attr({visibility:"visible"}),K=K&&!this.hasDragged?"animate":"attr",this.drawMasks(d,k,e,K),this.drawOutline(d,k,e,K),this.navigatorOptions.handles.enabled&&(this.drawHandle(d,0,e,K),this.drawHandle(k,1,e,K)));this.scrollbar&&(e?(e=this.top-z,p=this.left-z+(w||!p.opposite?
0:(p.titleOffset||0)+p.axisTitleMargin),z=q+2*z):(e=this.top+(w?this.height:-z),p=this.left-z),this.scrollbar.position(p,e,h,z),this.scrollbar.setRange(this.zoomedMin/(q||1),this.zoomedMax/(q||1)));this.rendered=!0}},addMouseEvents:function(){var a=this,b=a.chart,c=b.container,f=[],e,m;a.mouseMoveHandler=e=function(b){a.onMouseMove(b)};a.mouseUpHandler=m=function(b){a.onMouseUp(b)};f=a.getPartsEvents("mousedown");f.push(l(c,"mousemove",e),l(c.ownerDocument,"mouseup",m));d&&(f.push(l(c,"touchmove",
e),l(c.ownerDocument,"touchend",m)),f.concat(a.getPartsEvents("touchstart")));a.eventsToUnbind=f;a.series&&a.series[0]&&f.push(l(a.series[0].xAxis,"foundExtremes",function(){b.navigator.modifyNavigatorAxisExtremes()}))},getPartsEvents:function(a){var b=this,c=[];D(["shades","handles"],function(h){D(b[h],function(d,f){c.push(l(d.element,a,function(a){b[h+"Mousedown"](a,f)}))})});return c},shadesMousedown:function(a,b){a=this.chart.pointer.normalize(a);var c=this.chart,h=this.xAxis,d=this.zoomedMin,
f=this.left,e=this.size,p=this.range,m=a.chartX,g,q;c.inverted&&(m=a.chartY,f=this.top);1===b?(this.grabbedCenter=m,this.fixedWidth=p,this.dragOffset=m-d):(a=m-f-p/2,0===b?a=Math.max(0,a):2===b&&a+p>=e&&(a=e-p,this.reversedExtremes?(a-=p,q=this.getUnionExtremes().dataMin):g=this.getUnionExtremes().dataMax),a!==d&&(this.fixedWidth=p,b=h.toFixedRange(a,a+p,q,g),G(b.min)&&c.xAxis[0].setExtremes(Math.min(b.min,b.max),Math.max(b.min,b.max),!0,null,{trigger:"navigator"})))},handlesMousedown:function(a,
b){this.chart.pointer.normalize(a);a=this.chart;var c=a.xAxis[0],h=this.reversedExtremes;0===b?(this.grabbedLeft=!0,this.otherHandlePos=this.zoomedMax,this.fixedExtreme=h?c.min:c.max):(this.grabbedRight=!0,this.otherHandlePos=this.zoomedMin,this.fixedExtreme=h?c.max:c.min);a.fixedRange=null},onMouseMove:function(b){var c=this,h=c.chart,d=c.left,f=c.navigatorSize,e=c.range,m=c.dragOffset,g=h.inverted;b.touches&&0===b.touches[0].pageX||(b=h.pointer.normalize(b),h=b.chartX,g&&(d=c.top,h=b.chartY),c.grabbedLeft?
(c.hasDragged=!0,c.render(0,0,h-d,c.otherHandlePos)):c.grabbedRight?(c.hasDragged=!0,c.render(0,0,c.otherHandlePos,h-d)):c.grabbedCenter&&(c.hasDragged=!0,h<m?h=m:h>f+m-e&&(h=f+m-e),c.render(0,0,h-m,h-m+e)),c.hasDragged&&c.scrollbar&&n(c.scrollbar.options.liveRedraw,a.svg&&!k&&!this.chart.isBoosting)&&(b.DOMType=b.type,setTimeout(function(){c.onMouseUp(b)},0)))},onMouseUp:function(a){var b=this.chart,c=this.xAxis,h=this.scrollbar,d,f,e=a.DOMEvent||a;(!this.hasDragged||h&&h.hasDragged)&&"scrollbar"!==
a.trigger||(h=this.getUnionExtremes(),this.zoomedMin===this.otherHandlePos?d=this.fixedExtreme:this.zoomedMax===this.otherHandlePos&&(f=this.fixedExtreme),this.zoomedMax===this.size&&(f=this.reversedExtremes?h.dataMin:h.dataMax),0===this.zoomedMin&&(d=this.reversedExtremes?h.dataMax:h.dataMin),c=c.toFixedRange(this.zoomedMin,this.zoomedMax,d,f),G(c.min)&&b.xAxis[0].setExtremes(Math.min(c.min,c.max),Math.max(c.min,c.max),!0,this.hasDragged?!1:null,{trigger:"navigator",triggerOp:"navigator-drag",DOMEvent:e}));
"mousemove"!==a.DOMType&&(this.grabbedLeft=this.grabbedRight=this.grabbedCenter=this.fixedWidth=this.fixedExtreme=this.otherHandlePos=this.hasDragged=this.dragOffset=null)},removeEvents:function(){this.eventsToUnbind&&(D(this.eventsToUnbind,function(a){a()}),this.eventsToUnbind=void 0);this.removeBaseSeriesEvents()},removeBaseSeriesEvents:function(){var a=this.baseSeries||[];this.navigatorEnabled&&a[0]&&(!1!==this.navigatorOptions.adaptToUpdatedData&&D(a,function(a){c(a,"updatedData",this.updatedDataHandler)},
this),a[0].xAxis&&c(a[0].xAxis,"foundExtremes",this.modifyBaseAxisExtremes))},init:function(a){var b=a.options,c=b.navigator,h=c.enabled,d=b.scrollbar,e=d.enabled,b=h?c.height:0,m=e?d.height:0;this.handles=[];this.shades=[];this.chart=a;this.setBaseSeries();this.height=b;this.scrollbarHeight=m;this.scrollbarEnabled=e;this.navigatorEnabled=h;this.navigatorOptions=c;this.scrollbarOptions=d;this.outlineHeight=b+m;this.opposite=n(c.opposite,!h&&a.inverted);var g=this,h=g.baseSeries,d=a.xAxis.length,e=
a.yAxis.length,q=h&&h[0]&&h[0].xAxis||a.xAxis[0]||{options:{}};a.isDirtyBox=!0;g.navigatorEnabled?(g.xAxis=new H(a,u({breaks:q.options.breaks,ordinal:q.options.ordinal},c.xAxis,{id:"navigator-x-axis",yAxis:"navigator-y-axis",isX:!0,type:"datetime",index:d,isInternal:!0,offset:0,keepOrdinalPadding:!0,startOnTick:!1,endOnTick:!1,minPadding:0,maxPadding:0,zoomEnabled:!1},a.inverted?{offsets:[m,0,-m,0],width:b}:{offsets:[0,-m,0,m],height:b})),g.yAxis=new H(a,u(c.yAxis,{id:"navigator-y-axis",alignTicks:!1,
offset:0,index:e,isInternal:!0,zoomEnabled:!1},a.inverted?{width:b}:{height:b})),h||c.series.data?g.updateNavigatorSeries(!1):0===a.series.length&&(g.unbindRedraw=l(a,"beforeRedraw",function(){0<a.series.length&&!g.series&&(g.setBaseSeries(),g.unbindRedraw())})),g.reversedExtremes=a.inverted&&!g.xAxis.reversed||!a.inverted&&g.xAxis.reversed,g.renderElements(),g.addMouseEvents()):g.xAxis={translate:function(b,c){var h=a.xAxis[0],d=h.getExtremes(),f=h.len-2*m,e=B("min",h.options.min,d.dataMin),h=B("max",
h.options.max,d.dataMax)-e;return c?b*h/f+e:f*(b-e)/h},toPixels:function(a){return this.translate(a)},toValue:function(a){return this.translate(a,!0)},toFixedRange:H.prototype.toFixedRange,fake:!0};a.options.scrollbar.enabled&&(a.scrollbar=g.scrollbar=new f(a.renderer,u(a.options.scrollbar,{margin:g.navigatorEnabled?0:10,vertical:a.inverted}),a),l(g.scrollbar,"changed",function(b){var c=g.size,h=c*this.to,c=c*this.from;g.hasDragged=g.scrollbar.hasDragged;g.render(0,0,c,h);(a.options.scrollbar.liveRedraw||
"mousemove"!==b.DOMType&&"touchmove"!==b.DOMType)&&setTimeout(function(){g.onMouseUp(b)})}));g.addBaseSeriesEvents();g.addChartEvents()},getUnionExtremes:function(a){var b=this.chart.xAxis[0],c=this.xAxis,h=c.options,d=b.options,f;a&&null===b.dataMin||(f={dataMin:n(h&&h.min,B("min",d.min,b.dataMin,c.dataMin,c.min)),dataMax:n(h&&h.max,B("max",d.max,b.dataMax,c.dataMax,c.max))});return f},setBaseSeries:function(a,b){var c=this.chart,h=this.baseSeries=[];a=a||c.options&&c.options.navigator.baseSeries||
0;D(c.series||[],function(b,c){b.options.isInternal||!b.options.showInNavigator&&(c!==a&&b.options.id!==a||!1===b.options.showInNavigator)||h.push(b)});this.xAxis&&!this.xAxis.fake&&this.updateNavigatorSeries(!0,b)},updateNavigatorSeries:function(b,d){var h=this,f=h.chart,g=h.baseSeries,m,p,q=h.navigatorOptions.series,k,w={enableMouseTracking:!1,index:null,linkedTo:null,group:"nav",padXAxis:!1,xAxis:"navigator-x-axis",yAxis:"navigator-y-axis",showInLegend:!1,stacking:!1,isInternal:!0},B=h.series=
a.grep(h.series||[],function(b){var d=b.baseSeries;return 0>a.inArray(d,g)?(d&&(c(d,"updatedData",h.updatedDataHandler),delete d.navigatorSeries),b.chart&&b.destroy(),!1):!0});g&&g.length&&D(g,function(a){var b=a.navigatorSeries,c=t({color:a.color,visible:a.visible},e(q)?F.navigator.series:q);b&&!1===h.navigatorOptions.adaptToUpdatedData||(w.name="Navigator "+g.length,m=a.options||{},k=m.navigatorOptions||{},p=u(m,w,c,k),c=k.data||c.data,h.hasNavigatorData=h.hasNavigatorData||!!c,p.data=c||m.data&&
m.data.slice(0),b&&b.options?b.update(p,d):(a.navigatorSeries=f.initSeries(p),a.navigatorSeries.baseSeries=a,B.push(a.navigatorSeries)))});if(q.data&&(!g||!g.length)||e(q))h.hasNavigatorData=!1,q=a.splat(q),D(q,function(a,b){w.name="Navigator "+(B.length+1);p=u(F.navigator.series,{color:f.series[b]&&!f.series[b].options.isInternal&&f.series[b].color||f.options.colors[b]||f.options.colors[0]},w,a);p.data=a.data;p.data&&(h.hasNavigatorData=!0,B.push(f.initSeries(p)))});b&&this.addBaseSeriesEvents()},
addBaseSeriesEvents:function(){var a=this,b=a.baseSeries||[];b[0]&&b[0].xAxis&&l(b[0].xAxis,"foundExtremes",this.modifyBaseAxisExtremes);D(b,function(b){l(b,"show",function(){this.navigatorSeries&&this.navigatorSeries.setVisible(!0,!1)});l(b,"hide",function(){this.navigatorSeries&&this.navigatorSeries.setVisible(!1,!1)});!1!==this.navigatorOptions.adaptToUpdatedData&&b.xAxis&&l(b,"updatedData",this.updatedDataHandler);l(b,"remove",function(){this.navigatorSeries&&(r(a.series,this.navigatorSeries),
G(this.navigatorSeries.options)&&this.navigatorSeries.remove(!1),delete this.navigatorSeries)})},this)},getBaseSeriesMin:function(b){return a.reduce(this.baseSeries,function(a,b){return Math.min(a,b.xData[0])},b)},modifyNavigatorAxisExtremes:function(){var a=this.xAxis,b;a.getExtremes&&(!(b=this.getUnionExtremes(!0))||b.dataMin===a.min&&b.dataMax===a.max||(a.min=b.dataMin,a.max=b.dataMax))},modifyBaseAxisExtremes:function(){var a=this.chart.navigator,b=this.getExtremes(),c=b.dataMin,d=b.dataMax,b=
b.max-b.min,f=a.stickToMin,e=a.stickToMax,m=n(this.options.overscroll,0),q,k,w=a.series&&a.series[0],B=!!this.setExtremes;this.eventArgs&&"rangeSelectorButton"===this.eventArgs.trigger||(f&&(k=c,q=k+b),e&&(q=d+m,f||(k=Math.max(q-b,a.getBaseSeriesMin(w&&w.xData?w.xData[0]:-Number.MAX_VALUE)))),B&&(f||e)&&g(k)&&(this.min=this.userMin=k,this.max=this.userMax=q));a.stickToMin=a.stickToMax=null},updatedDataHandler:function(){var a=this.chart.navigator,b=this.navigatorSeries,c=a.getBaseSeriesMin(this.xData[0]);
a.stickToMax=a.reversedExtremes?0===Math.round(a.zoomedMin):Math.round(a.zoomedMax)>=Math.round(a.size);a.stickToMin=g(this.xAxis.min)&&this.xAxis.min<=c&&(!this.chart.fixedRange||!a.stickToMax);b&&!a.hasNavigatorData&&(b.options.pointStart=this.xData[0],b.setData(this.options.data,!1,null,!1))},addChartEvents:function(){this.eventsToUnbind||(this.eventsToUnbind=[]);this.eventsToUnbind.push(l(this.chart,"redraw",function(){var a=this.navigator,b=a&&(a.baseSeries&&a.baseSeries[0]&&a.baseSeries[0].xAxis||
a.scrollbar&&this.xAxis[0]);b&&a.render(b.min,b.max)}),l(this.chart,"getMargins",function(){var a=this.navigator,b=a.opposite?"plotTop":"marginBottom";this.inverted&&(b=a.opposite?"marginRight":"plotLeft");this[b]=(this[b]||0)+(a.navigatorEnabled||!this.inverted?a.outlineHeight:0)+a.navigatorOptions.margin}))},destroy:function(){this.removeEvents();this.xAxis&&(r(this.chart.xAxis,this.xAxis),r(this.chart.axes,this.xAxis));this.yAxis&&(r(this.chart.yAxis,this.yAxis),r(this.chart.axes,this.yAxis));
D(this.series||[],function(a){a.destroy&&a.destroy()});D("series xAxis yAxis shades outline scrollbarTrack scrollbarRifles scrollbarGroup scrollbar navigatorGroup rendered".split(" "),function(a){this[a]&&this[a].destroy&&this[a].destroy();this[a]=null},this);D([this.handles],function(a){C(a)},this)}};a.Navigator=x;A(H.prototype,"zoom",function(a,b,c){var d=this.chart,f=d.options,h=f.chart.zoomType,e=f.chart.pinchType,g=f.navigator,f=f.rangeSelector,m;this.isXAxis&&(g&&g.enabled||f&&f.enabled)&&(!k&&
"x"===h||k&&"x"===e?d.resetZoomButton="blocked":"y"===h?m=!1:(!k&&"xy"===h||k&&"xy"===e)&&this.options.range&&(d=this.previousZoom,G(b)?this.previousZoom=[this.min,this.max]:d&&(b=d[0],c=d[1],delete this.previousZoom)));return void 0!==m?m:a.call(this,b,c)});l(v,"beforeRender",function(){var a=this.options;if(a.navigator.enabled||a.scrollbar.enabled)this.scroller=this.navigator=new x(this)});l(v,"afterSetChartSize",function(){var a=this.legend,b=this.navigator,c,d,f,e;b&&(d=a&&a.options,f=b.xAxis,
e=b.yAxis,c=b.scrollbarHeight,this.inverted?(b.left=b.opposite?this.chartWidth-c-b.height:this.spacing[3]+c,b.top=this.plotTop+c):(b.left=this.plotLeft+c,b.top=b.navigatorOptions.top||this.chartHeight-b.height-c-this.spacing[2]-(this.rangeSelector&&this.extraBottomMargin?this.rangeSelector.getHeight():0)-(d&&"bottom"===d.verticalAlign&&d.enabled&&!d.floating?a.legendHeight+n(d.margin,10):0)),f&&e&&(this.inverted?f.options.left=e.options.left=b.left:f.options.top=e.options.top=b.top,f.setAxisSize(),
e.setAxisSize()))});l(v,"update",function(a){var b=a.options.navigator||{},c=a.options.scrollbar||{};this.navigator||this.scroller||!b.enabled&&!c.enabled||(u(!0,this.options.navigator,b),u(!0,this.options.scrollbar,c),delete a.options.navigator,delete a.options.scrollbar)});l(v,"afterUpdate",function(){this.navigator||this.scroller||!this.options.navigator.enabled&&!this.options.scrollbar.enabled||(this.scroller=this.navigator=new x(this))});A(q.prototype,"addPoint",function(a,c,d,f,e){var h=this.options.turboThreshold;
h&&this.xData.length>h&&b(c,!0)&&this.chart.navigator&&y(20,!0);a.call(this,c,d,f,e)});l(v,"afterAddSeries",function(){this.navigator&&this.navigator.setBaseSeries(null,!1)});l(q,"afterUpdate",function(){this.chart.navigator&&!this.options.isInternal&&this.chart.navigator.setBaseSeries(null,!1)});v.prototype.callbacks.push(function(a){var b=a.navigator;b&&a.xAxis[0]&&(a=a.xAxis[0].getExtremes(),b.render(a.min,a.max))})})(J);(function(a){function x(a){this.init(a)}var l=a.addEvent,H=a.Axis,v=a.Chart,
F=a.css,G=a.createElement,C=a.defaultOptions,D=a.defined,r=a.destroyObjectProperties,y=a.discardElement,t=a.each,E=a.extend,d=a.fireEvent,e=a.isNumber,g=a.merge,b=a.pick,k=a.pInt,u=a.splat,n=a.wrap;E(C,{rangeSelector:{verticalAlign:"top",buttonTheme:{width:28,height:18,padding:2,zIndex:7},floating:!1,x:0,y:0,height:void 0,inputPosition:{align:"right",x:0,y:0},buttonPosition:{align:"left",x:0,y:0}}});C.lang=g(C.lang,{rangeSelectorZoom:"Zoom",rangeSelectorFrom:"From",rangeSelectorTo:"To"});x.prototype=
{clickButton:function(a,d){var c=this,f=c.chart,g=c.buttonOptions[a],k=f.xAxis[0],B=f.scroller&&f.scroller.getUnionExtremes()||k||{},h=B.dataMin,p=B.dataMax,z,n=k&&Math.round(Math.min(k.max,b(p,k.max))),I=g.type,r,B=g._range,v,C,y,x=g.dataGrouping;if(null!==h&&null!==p){f.fixedRange=B;x&&(this.forcedDataGrouping=!0,H.prototype.setDataGrouping.call(k||{chart:this.chart},x,!1),this.frozenStates=g.preserveDataGrouping);if("month"===I||"year"===I)k?(I={range:g,max:n,chart:f,dataMin:h,dataMax:p},z=k.minFromRange.call(I),
e(I.newMax)&&(n=I.newMax)):B=g;else if(B)z=Math.max(n-B,h),n=Math.min(z+B,p);else if("ytd"===I)if(k)void 0===p&&(h=Number.MAX_VALUE,p=Number.MIN_VALUE,t(f.series,function(a){a=a.xData;h=Math.min(a[0],h);p=Math.max(a[a.length-1],p)}),d=!1),n=c.getYTDExtremes(p,h,f.time.useUTC),z=v=n.min,n=n.max;else{l(f,"beforeRender",function(){c.clickButton(a)});return}else"all"===I&&k&&(z=h,n=p);z+=g._offsetMin;n+=g._offsetMax;c.setSelected(a);k?k.setExtremes(z,n,b(d,1),null,{trigger:"rangeSelectorButton",rangeSelectorButton:g}):
(r=u(f.options.xAxis)[0],y=r.range,r.range=B,C=r.min,r.min=v,l(f,"load",function(){r.range=y;r.min=C}))}},setSelected:function(a){this.selected=this.options.selected=a},defaultButtons:[{type:"month",count:1,text:"1m"},{type:"month",count:3,text:"3m"},{type:"month",count:6,text:"6m"},{type:"ytd",text:"YTD"},{type:"year",count:1,text:"1y"},{type:"all",text:"All"}],init:function(a){var b=this,c=a.options.rangeSelector,e=c.buttons||[].concat(b.defaultButtons),g=c.selected,k=function(){var a=b.minInput,
c=b.maxInput;a&&a.blur&&d(a,"blur");c&&c.blur&&d(c,"blur")};b.chart=a;b.options=c;b.buttons=[];a.extraTopMargin=c.height;b.buttonOptions=e;this.unMouseDown=l(a.container,"mousedown",k);this.unResize=l(a,"resize",k);t(e,b.computeButtonRange);void 0!==g&&e[g]&&this.clickButton(g,!1);l(a,"load",function(){a.xAxis&&a.xAxis[0]&&l(a.xAxis[0],"setExtremes",function(c){this.max-this.min!==a.fixedRange&&"rangeSelectorButton"!==c.trigger&&"updatedData"!==c.trigger&&b.forcedDataGrouping&&!b.frozenStates&&this.setDataGrouping(!1,
!1)})})},updateButtonStates:function(){var a=this,b=this.chart,d=b.xAxis[0],g=Math.round(d.max-d.min),k=!d.hasVisibleSeries,w=b.scroller&&b.scroller.getUnionExtremes()||d,B=w.dataMin,h=w.dataMax,b=a.getYTDExtremes(h,B,b.time.useUTC),p=b.min,z=b.max,l=a.selected,n=e(l),r=a.options.allButtonsEnabled,u=a.buttons;t(a.buttonOptions,function(b,c){var f=b._range,e=b.type,m=b.count||1,q=u[c],w=0;b=b._offsetMax-b._offsetMin;c=c===l;var A=f>h-B,t=f<d.minRange,I=!1,v=!1,f=f===g;("month"===e||"year"===e)&&g+
36E5>=864E5*{month:28,year:365}[e]*m-b&&g-36E5<=864E5*{month:31,year:366}[e]*m+b?f=!0:"ytd"===e?(f=z-p+b===g,I=!c):"all"===e&&(f=d.max-d.min>=h-B,v=!c&&n&&f);e=!r&&(A||t||v||k);m=c&&f||f&&!n&&!I||c&&a.frozenStates;e?w=3:m&&(n=!0,w=2);q.state!==w&&q.setState(w)})},computeButtonRange:function(a){var c=a.type,d=a.count||1,e={millisecond:1,second:1E3,minute:6E4,hour:36E5,day:864E5,week:6048E5};if(e[c])a._range=e[c]*d;else if("month"===c||"year"===c)a._range=864E5*{month:30,year:365}[c]*d;a._offsetMin=
b(a.offsetMin,0);a._offsetMax=b(a.offsetMax,0);a._range+=a._offsetMax-a._offsetMin},setInputValue:function(a,b){var c=this.chart.options.rangeSelector,d=this.chart.time,f=this[a+"Input"];D(b)&&(f.previousValue=f.HCTime,f.HCTime=b);f.value=d.dateFormat(c.inputEditDateFormat||"%Y-%m-%d",f.HCTime);this[a+"DateBox"].attr({text:d.dateFormat(c.inputDateFormat||"%b %e, %Y",f.HCTime)})},showInput:function(a){var b=this.inputGroup,c=this[a+"DateBox"];F(this[a+"Input"],{left:b.translateX+c.x+"px",top:b.translateY+
"px",width:c.width-2+"px",height:c.height-2+"px",border:"2px solid silver"})},hideInput:function(a){F(this[a+"Input"],{border:0,width:"1px",height:"1px"});this.setInputValue(a)},drawInput:function(a){function b(){var a=p.value,b=(w.inputDateParser||Date.parse)(a),f=d.xAxis[0],g=d.scroller&&d.scroller.xAxis?d.scroller.xAxis:f,m=g.dataMin,g=g.dataMax;b!==p.previousValue&&(p.previousValue=b,e(b)||(b=a.split("-"),b=Date.UTC(k(b[0]),k(b[1])-1,k(b[2]))),e(b)&&(d.time.useUTC||(b+=6E4*(new Date).getTimezoneOffset()),
h?b>c.maxInput.HCTime?b=void 0:b<m&&(b=m):b<c.minInput.HCTime?b=void 0:b>g&&(b=g),void 0!==b&&f.setExtremes(h?b:f.min,h?f.max:b,void 0,void 0,{trigger:"rangeSelectorInput"})))}var c=this,d=c.chart,g=d.renderer,w=d.options.rangeSelector,B=c.div,h="min"===a,p,z,l=this.inputGroup;this[a+"Label"]=z=g.label(C.lang[h?"rangeSelectorFrom":"rangeSelectorTo"],this.inputGroup.offset).addClass("highcharts-range-label").attr({padding:2}).add(l);l.offset+=z.width+5;this[a+"DateBox"]=g=g.label("",l.offset).addClass("highcharts-range-input").attr({padding:2,
width:w.inputBoxWidth||90,height:w.inputBoxHeight||17,"text-align":"center"}).on("click",function(){c.showInput(a);c[a+"Input"].focus()}).add(l);l.offset+=g.width+(h?10:0);this[a+"Input"]=p=G("input",{name:a,className:"highcharts-range-selector",type:"text"},{top:d.plotTop+"px"},B);p.onfocus=function(){c.showInput(a)};p.onblur=function(){c.hideInput(a)};p.onchange=b;p.onkeypress=function(a){13===a.keyCode&&b()}},getPosition:function(){var a=this.chart,b=a.options.rangeSelector,a="top"===b.verticalAlign?
a.plotTop-a.axisOffset[0]:0;return{buttonTop:a+b.buttonPosition.y,inputTop:a+b.inputPosition.y-10}},getYTDExtremes:function(a,b,d){var c=this.chart.time,f=new c.Date(a),e=c.get("FullYear",f);d=d?c.Date.UTC(e,0,1):+new c.Date(e,0,1);b=Math.max(b||0,d);f=f.getTime();return{max:Math.min(a||f,f),min:b}},render:function(a,d){var c=this,f=c.chart,e=f.renderer,g=f.container,k=f.options,h=k.exporting&&!1!==k.exporting.enabled&&k.navigation&&k.navigation.buttonOptions,p=C.lang,l=c.div,n=k.rangeSelector,r=
b(k.chart.style&&k.chart.style.zIndex,0)+1,k=n.floating,u=c.buttons,l=c.inputGroup,v=n.buttonTheme,y=n.buttonPosition,x=n.inputPosition,E=n.inputEnabled,D=v&&v.states,F=f.plotLeft,H,L=c.buttonGroup,J;J=c.rendered;var P=c.options.verticalAlign,R=f.legend,S=R&&R.options,T=y.y,Q=x.y,U=J||!1,V=U?"animate":"attr",O=0,M=0,N;if(!1!==n.enabled){J||(c.group=J=e.g("range-selector-group").attr({zIndex:7}).add(),c.buttonGroup=L=e.g("range-selector-buttons").add(J),c.zoomText=e.text(p.rangeSelectorZoom,0,15).css(n.labelStyle).add(L),
t(c.buttonOptions,function(a,b){u[b]=e.button(a.text,0,0,function(){var d=a.events&&a.events.click,f;d&&(f=d.call(a));!1!==f&&c.clickButton(b);c.isActive=!0},v,D&&D.hover,D&&D.select,D&&D.disabled).attr({"text-align":"center"}).add(L)}),!1!==E&&(c.div=l=G("div",null,{position:"relative",height:0,zIndex:r}),g.parentNode.insertBefore(l,g),c.inputGroup=l=e.g("input-group").add(J),l.offset=0,c.drawInput("min"),c.drawInput("max")));c.zoomText[V]({x:b(F+y.x,F)});H=b(F+y.x,F)+c.zoomText.getBBox().width+
5;t(c.buttonOptions,function(a,c){u[c][V]({x:H});H+=u[c].width+b(n.buttonSpacing,5)});F=f.plotLeft-f.spacing[3];c.updateButtonStates();h&&this.titleCollision(f)&&"top"===P&&"right"===y.align&&y.y+L.getBBox().height-12<(h.y||0)+h.height&&(O=-40);"left"===y.align?N=y.x-f.spacing[3]:"right"===y.align&&(N=y.x+O-f.spacing[1]);L.align({y:y.y,width:L.getBBox().width,align:y.align,x:N},!0,f.spacingBox);c.group.placed=U;c.buttonGroup.placed=U;!1!==E&&(O=h&&this.titleCollision(f)&&"top"===P&&"right"===x.align&&
x.y-l.getBBox().height-12<(h.y||0)+h.height+f.spacing[0]?-40:0,"left"===x.align?N=F:"right"===x.align&&(N=-Math.max(f.axisOffset[1],-O)),l.align({y:x.y,width:l.getBBox().width,align:x.align,x:x.x+N-2},!0,f.spacingBox),g=l.alignAttr.translateX+l.alignOptions.x-O+l.getBBox().x+2,h=l.alignOptions.width,p=L.alignAttr.translateX+L.getBBox().x,N=L.getBBox().width+20,(x.align===y.align||p+N>g&&g+h>p&&T<Q+l.getBBox().height)&&l.attr({translateX:l.alignAttr.translateX+(f.axisOffset[1]>=-O?0:-O),translateY:l.alignAttr.translateY+
L.getBBox().height+10}),c.setInputValue("min",a),c.setInputValue("max",d),c.inputGroup.placed=U);c.group.align({verticalAlign:P},!0,f.spacingBox);a=c.group.getBBox().height+20;d=c.group.alignAttr.translateY;"bottom"===P&&(R=S&&"bottom"===S.verticalAlign&&S.enabled&&!S.floating?R.legendHeight+b(S.margin,10):0,a=a+R-20,M=d-a-(k?0:n.y)-10);if("top"===P)k&&(M=0),f.titleOffset&&(M=f.titleOffset+f.options.title.margin),M+=f.margin[0]-f.spacing[0]||0;else if("middle"===P)if(Q===T)M=0>Q?d+void 0:d;else if(Q||
T)M=0>Q||0>T?M-Math.min(Q,T):d-a+NaN;c.group.translate(n.x,n.y+Math.floor(M));!1!==E&&(c.minInput.style.marginTop=c.group.translateY+"px",c.maxInput.style.marginTop=c.group.translateY+"px");c.rendered=!0}},getHeight:function(){var a=this.options,b=this.group,d=a.y,e=a.buttonPosition.y,a=a.inputPosition.y,b=b?b.getBBox(!0).height+13+d:0,d=Math.min(a,e);if(0>a&&0>e||0<a&&0<e)b+=Math.abs(d);return b},titleCollision:function(a){return!(a.options.title.text||a.options.subtitle.text)},update:function(a){var b=
this.chart;g(!0,b.options.rangeSelector,a);this.destroy();this.init(b);b.rangeSelector.render()},destroy:function(){var b=this,d=b.minInput,e=b.maxInput;b.unMouseDown();b.unResize();r(b.buttons);d&&(d.onfocus=d.onblur=d.onchange=null);e&&(e.onfocus=e.onblur=e.onchange=null);a.objectEach(b,function(a,c){a&&"chart"!==c&&(a.destroy?a.destroy():a.nodeType&&y(this[c]));a!==x.prototype[c]&&(b[c]=null)},this)}};H.prototype.toFixedRange=function(a,d,g,k){var c=this.chart&&this.chart.fixedRange;a=b(g,this.translate(a,
!0,!this.horiz));d=b(k,this.translate(d,!0,!this.horiz));g=c&&(d-a)/c;.7<g&&1.3>g&&(k?a=d-c:d=a+c);e(a)&&e(d)||(a=d=void 0);return{min:a,max:d}};H.prototype.minFromRange=function(){var a=this.range,d={month:"Month",year:"FullYear"}[a.type],g,k=this.max,l,w,n=function(a,b){var c=new Date(a),e=c["get"+d]();c["set"+d](e+b);e===c["get"+d]()&&c.setDate(0);return c.getTime()-a};e(a)?(g=k-a,w=a):(g=k+n(k,-a.count),this.chart&&(this.chart.fixedRange=k-g));l=b(this.dataMin,Number.MIN_VALUE);e(g)||(g=l);g<=
l&&(g=l,void 0===w&&(w=n(g,a.count)),this.newMax=Math.min(g+w,this.dataMax));e(k)||(g=void 0);return g};l(v,"afterGetContainer",function(){this.options.rangeSelector.enabled&&(this.rangeSelector=new x(this))});n(v.prototype,"render",function(a,b,d){var c=this.axes,e=this.rangeSelector;e&&(t(c,function(a){a.updateNames();a.setScale()}),this.getAxisMargins(),e.render(),c=e.options.verticalAlign,e.options.floating||("bottom"===c?this.extraBottomMargin=!0:"middle"!==c&&(this.extraTopMargin=!0)));a.call(this,
b,d)});l(v,"update",function(a){var b=a.options.rangeSelector;a=this.rangeSelector;var c=this.extraBottomMargin,d=this.extraTopMargin;b&&b.enabled&&!D(a)&&(this.options.rangeSelector.enabled=!0,this.rangeSelector=new x(this));this.extraTopMargin=this.extraBottomMargin=!1;a&&(a.render(),b=b&&b.verticalAlign||a.options&&a.options.verticalAlign,a.options.floating||("bottom"===b?this.extraBottomMargin=!0:"middle"!==b&&(this.extraTopMargin=!0)),this.extraBottomMargin!==c||this.extraTopMargin!==d)&&(this.isDirtyBox=
!0)});n(v.prototype,"redraw",function(a,b,d){var c=this.rangeSelector;c&&!c.options.floating&&(c.render(),c=c.options.verticalAlign,"bottom"===c?this.extraBottomMargin=!0:"middle"!==c&&(this.extraTopMargin=!0));a.call(this,b,d)});l(v,"getMargins",function(){var a=this.rangeSelector;a&&(a=a.getHeight(),this.extraTopMargin&&(this.plotTop+=a),this.extraBottomMargin&&(this.marginBottom+=a))});v.prototype.callbacks.push(function(a){function b(){c=a.xAxis[0].getExtremes();e(c.min)&&d.render(c.min,c.max)}
var c,d=a.rangeSelector,g,k;d&&(k=l(a.xAxis[0],"afterSetExtremes",function(a){d.render(a.min,a.max)}),g=l(a,"redraw",b),b());l(a,"destroy",function(){d&&(g(),k())})});a.RangeSelector=x})(J);(function(a){var x=a.addEvent,l=a.arrayMax,H=a.arrayMin,v=a.Axis,F=a.Chart,G=a.defined,C=a.each,D=a.format,r=a.grep,y=a.inArray,t=a.isNumber,E=a.isString,d=a.map,e=a.merge,g=a.pick,b=a.Point,k=a.Series,u=a.splat,n=a.SVGRenderer,c=a.wrap,f=k.prototype,q=f.init,m=f.processData,A=b.prototype.tooltipFormatter;a.StockChart=
a.stockChart=function(b,c,f){var h=E(b)||b.nodeName,k=arguments[h?1:0],l=k.series,w=a.getOptions(),m,n=g(k.navigator&&k.navigator.enabled,w.navigator.enabled,!0),B=n?{startOnTick:!1,endOnTick:!1}:null,t={marker:{enabled:!1,radius:2}},q={shadow:!1,borderWidth:0};k.xAxis=d(u(k.xAxis||{}),function(a,b){return e({minPadding:0,maxPadding:0,overscroll:0,ordinal:!0,title:{text:null},labels:{overflow:"justify"},showLastLabel:!0},w.xAxis,w.xAxis&&w.xAxis[b],a,{type:"datetime",categories:null},B)});k.yAxis=
d(u(k.yAxis||{}),function(a,b){m=g(a.opposite,!0);return e({labels:{y:-2},opposite:m,showLastLabel:!(!a.categories&&"category"!==a.type),title:{text:null}},w.yAxis,w.yAxis&&w.yAxis[b],a)});k.series=null;k=e({chart:{panning:!0,pinchType:"x"},navigator:{enabled:n},scrollbar:{enabled:g(w.scrollbar.enabled,!0)},rangeSelector:{enabled:g(w.rangeSelector.enabled,!0)},title:{text:null},tooltip:{split:g(w.tooltip.split,!0),crosshairs:!0},legend:{enabled:!1},plotOptions:{line:t,spline:t,area:t,areaspline:t,
arearange:t,areasplinerange:t,column:q,columnrange:q,candlestick:q,ohlc:q}},k,{isStock:!0});k.series=l;return h?new F(b,k,f):new F(k,c)};c(v.prototype,"autoLabelAlign",function(a){var b=this.chart,c=this.options,b=b._labelPanes=b._labelPanes||{},d=this.options.labels;return this.chart.options.isStock&&"yAxis"===this.coll&&(c=c.top+","+c.height,!b[c]&&d.enabled)?(15===d.x&&(d.x=0),void 0===d.align&&(d.align="right"),b[c]=this,"right"):a.apply(this,[].slice.call(arguments,1))});x(v,"destroy",function(){var a=
this.chart,b=this.options&&this.options.top+","+this.options.height;b&&a._labelPanes&&a._labelPanes[b]===this&&delete a._labelPanes[b]});c(v.prototype,"getPlotLinePath",function(b,c,e,f,k,l){var h=this,w=this.isLinked&&!this.series?this.linkedParent.series:this.series,m=h.chart,p=m.renderer,n=h.left,B=h.top,q,r,u,v,z=[],x=[],A,D;if("xAxis"!==h.coll&&"yAxis"!==h.coll)return b.apply(this,[].slice.call(arguments,1));x=function(a){var b="xAxis"===a?"yAxis":"xAxis";a=h.options[b];return t(a)?[m[b][a]]:
E(a)?[m.get(a)]:d(w,function(a){return a[b]})}(h.coll);C(h.isXAxis?m.yAxis:m.xAxis,function(a){if(G(a.options.id)?-1===a.options.id.indexOf("navigator"):1){var b=a.isXAxis?"yAxis":"xAxis",b=G(a.options[b])?m[b][a.options[b]]:m[b][0];h===b&&x.push(a)}});A=x.length?[]:[h.isXAxis?m.yAxis[0]:m.xAxis[0]];C(x,function(b){-1!==y(b,A)||a.find(A,function(a){return a.pos===b.pos&&a.len===b.len})||A.push(b)});D=g(l,h.translate(c,null,null,f));t(D)&&(h.horiz?C(A,function(a){var b;r=a.pos;v=r+a.len;q=u=Math.round(D+
h.transB);"pass"!==k&&(q<n||q>n+h.width)&&(k?q=u=Math.min(Math.max(n,q),n+h.width):b=!0);b||z.push("M",q,r,"L",u,v)}):C(A,function(a){var b;q=a.pos;u=q+a.len;r=v=Math.round(B+h.height-D);"pass"!==k&&(r<B||r>B+h.height)&&(k?r=v=Math.min(Math.max(B,r),h.top+h.height):b=!0);b||z.push("M",q,r,"L",u,v)}));return 0<z.length?p.crispPolyLine(z,e||1):null});n.prototype.crispPolyLine=function(a,b){var c;for(c=0;c<a.length;c+=6)a[c+1]===a[c+4]&&(a[c+1]=a[c+4]=Math.round(a[c+1])-b%2/2),a[c+2]===a[c+5]&&(a[c+
2]=a[c+5]=Math.round(a[c+2])+b%2/2);return a};c(v.prototype,"hideCrosshair",function(a,b){a.call(this,b);this.crossLabel&&(this.crossLabel=this.crossLabel.hide())});x(v,"afterDrawCrosshair",function(a){var b,c;if(G(this.crosshair.label)&&this.crosshair.label.enabled&&this.cross){var d=this.chart,e=this.options.crosshair.label,f=this.horiz;b=this.opposite;c=this.left;var k=this.top,l=this.crossLabel,m=e.format,n="",w="inside"===this.options.tickPosition,q=!1!==this.crosshair.snap,t=0,r=a.e||this.cross&&
this.cross.e,u=a.point;a=this.lin2log;var v,x;this.isLog?(v=a(this.min),x=a(this.max)):(v=this.min,x=this.max);a=f?"center":b?"right"===this.labelAlign?"right":"left":"left"===this.labelAlign?"left":"center";l||(l=this.crossLabel=d.renderer.label(null,null,null,e.shape||"callout").addClass("highcharts-crosshair-label"+(this.series[0]&&" highcharts-color-"+this.series[0].colorIndex)).attr({align:e.align||a,padding:g(e.padding,8),r:g(e.borderRadius,3),zIndex:2}).add(this.labelGroup));f?(a=q?u.plotX+
c:r.chartX,k+=b?0:this.height):(a=b?this.width+c:0,k=q?u.plotY+k:r.chartY);m||e.formatter||(this.isDatetimeAxis&&(n="%b %d, %Y"),m="{value"+(n?":"+n:"")+"}");n=q?u[this.isXAxis?"x":"y"]:this.toValue(f?r.chartX:r.chartY);l.attr({text:m?D(m,{value:n},d.time):e.formatter.call(this,n),x:a,y:k,visibility:n<v||n>x?"hidden":"visible"});e=l.getBBox();if(f){if(w&&!b||!w&&b)k=l.y-e.height}else k=l.y-e.height/2;f?(b=c-e.x,c=c+this.width-e.x):(b="left"===this.labelAlign?c:0,c="right"===this.labelAlign?c+this.width:
d.chartWidth);l.translateX<b&&(t=b-l.translateX);l.translateX+e.width>=c&&(t=-(l.translateX+e.width-c));l.attr({x:a+t,y:k,anchorX:f?a:this.opposite?0:d.chartWidth,anchorY:f?this.opposite?d.chartHeight:0:k+e.height/2})}});f.init=function(){q.apply(this,arguments);this.setCompare(this.options.compare)};f.setCompare=function(a){this.modifyValue="value"===a||"percent"===a?function(b,c){var d=this.compareValue;if(void 0!==b&&void 0!==d)return b="value"===a?b-d:b/d*100-(100===this.options.compareBase?0:
100),c&&(c.change=b),b}:null;this.userOptions.compare=a;this.chart.hasRendered&&(this.isDirty=!0)};f.processData=function(){var a,b=-1,c,d,e=!0===this.options.compareStart?0:1,f,g;m.apply(this,arguments);if(this.xAxis&&this.processedYData)for(c=this.processedXData,d=this.processedYData,f=d.length,this.pointArrayMap&&(b=y("close",this.pointArrayMap),-1===b&&(b=y(this.pointValKey||"y",this.pointArrayMap))),a=0;a<f-e;a++)if(g=d[a]&&-1<b?d[a][b]:d[a],t(g)&&c[a+e]>=this.xAxis.min&&0!==g){this.compareValue=
g;break}};c(f,"getExtremes",function(a){var b;a.apply(this,[].slice.call(arguments,1));this.modifyValue&&(b=[this.modifyValue(this.dataMin),this.modifyValue(this.dataMax)],this.dataMin=H(b),this.dataMax=l(b))});v.prototype.setCompare=function(a,b){this.isXAxis||(C(this.series,function(b){b.setCompare(a)}),g(b,!0)&&this.chart.redraw())};b.prototype.tooltipFormatter=function(b){b=b.replace("{point.change}",(0<this.change?"+":"")+a.numberFormat(this.change,g(this.series.tooltipOptions.changeDecimals,
2)));return A.apply(this,[b])};c(k.prototype,"render",function(a){var b;this.chart.is3d&&this.chart.is3d()||this.chart.polar||!this.xAxis||this.xAxis.isRadial||(b=this.yAxis.len-(this.xAxis.axisLine?Math.floor(this.xAxis.axisLine.strokeWidth()/2):0),!this.clipBox&&this.animate?(this.clipBox=e(this.chart.clipBox),this.clipBox.width=this.xAxis.len,this.clipBox.height=b):this.chart[this.sharedClipKey]?this.chart[this.sharedClipKey].attr({width:this.xAxis.len,height:b}):this.clipBox&&(this.clipBox.width=
this.xAxis.len,this.clipBox.height=b));a.call(this)});c(F.prototype,"getSelectedPoints",function(a){var b=a.call(this);C(this.series,function(a){a.hasGroupedData&&(b=b.concat(r(a.points||[],function(a){return a.selected})))});return b});x(F,"update",function(a){a=a.options;"scrollbar"in a&&this.navigator&&(e(!0,this.options.scrollbar,a.scrollbar),this.navigator.update({},!1),delete a.scrollbar)})})(J)});
//# sourceMappingURL=stock.js.map