From 6ff0e95c904b8a45f83a074ca78f3683bd102598 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sun, 21 Jul 2013 11:14:36 -0400 Subject: [PATCH] stop exporting _calcYNormal --- dygraph-combined.js | 12 +++++------- dygraph-layout.js | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/dygraph-combined.js b/dygraph-combined.js index e6380de..95ce938 100644 --- a/dygraph-combined.js +++ b/dygraph-combined.js @@ -1,7 +1,5 @@ -This is not the file you are looking for. -A reasonably up-to-date version can be found at http://dygraphs.com/dygraph-combined.js - -dygraph-combined.js is a "packed" version of the larger dygraphs JS files. It is -smaller and loads more quickly, but is harder to debug. - -To generate this file, run "make" or generate-combined.sh. +/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */ +CanvasRenderingContext2D.prototype.installPattern=function(t){"use strict";if("undefined"!=typeof this.isPatternInstalled)throw"Must un-install old line pattern before installing a new one.";this.isPatternInstalled=!0;var e=[0,0],a=[],i=this.beginPath,r=this.lineTo,n=this.moveTo,s=this.stroke;this.uninstallPattern=function(){this.beginPath=i,this.lineTo=r,this.moveTo=n,this.stroke=s,this.uninstallPattern=void 0,this.isPatternInstalled=void 0},this.beginPath=function(){a=[],i.call(this)},this.moveTo=function(t,e){a.push([[t,e]]),n.call(this,t,e)},this.lineTo=function(t,e){var i=a[a.length-1];i.push([t,e])},this.stroke=function(){if(0===a.length)return s.call(this),void 0;for(var i=0;if;){var x=t[_];f+=e[1]?e[1]:x,f>y?(e=[_,f-y],f=y):e=[(_+1)%t.length,0],0===_%2?r.call(this,f,0):n.call(this,f,0),_=(_+1)%t.length}this.restore(),l=d,h=u}s.call(this),a=[]}},CanvasRenderingContext2D.prototype.uninstallPattern=function(){throw"Must install a line pattern before uninstalling it."};var DygraphOptions=function(){"use strict";var t=function(t){this.dygraph_=t,this.yAxes_=[],this.xAxis_={},this.series_={},this.global_=this.dygraph_.attrs_,this.user_=this.dygraph_.user_attrs_||{},this.labels_=[],this.highlightSeries_=this.get("highlightSeriesOpts")||{},this.reparseSeries()},e={y:0,Y:0,y1:0,Y1:0,y2:1,Y2:1},a=function(t){if("string"==typeof t){if(e.hasOwnProperty(t))return e[t];throw"Unknown axis : "+t}if("number"==typeof t){if(0===t||1===t)return t;throw"Dygraphs only supports two y-axes, indexed from 0-1."}if(t)throw"Unknown axis : "+t;return 0};return t.prototype.reparseSeries=function(){var t=this.get("labels");if(t){this.labels_=t.slice(1),this.yAxes_=[{series:[],options:{}}],this.xAxis_={options:{}},this.series_={};var e=!this.user_.series;if(e){for(var i=0,r=0;r1&&Dygraph.update(this.yAxes_[1].options,h.y2||{}),Dygraph.update(this.xAxis_.options,h.x||{})}},t.prototype.get=function(t){var e=this.getGlobalUser_(t);return null!==e?e:this.getGlobalDefault_(t)},t.prototype.getGlobalUser_=function(t){return this.user_.hasOwnProperty(t)?this.user_[t]:null},t.prototype.getGlobalDefault_=function(t){return this.global_.hasOwnProperty(t)?this.global_[t]:Dygraph.DEFAULT_ATTRS.hasOwnProperty(t)?Dygraph.DEFAULT_ATTRS[t]:null},t.prototype.getForAxis=function(t,e){var a,i;if("number"==typeof e)a=e,i=0===a?"y":"y2";else{if("y1"==e&&(e="y"),"y"==e)a=0;else if("y2"==e)a=1;else{if("x"!=e)throw"Unknown axis "+e;a=-1}i=e}var r=-1==a?this.xAxis_:this.yAxes_[a];if(r){var n=r.options;if(n.hasOwnProperty(t))return n[t]}var s=this.getGlobalUser_(t);if(null!==s)return s;var o=Dygraph.DEFAULT_ATTRS.axes[i];return o.hasOwnProperty(t)?o[t]:this.getGlobalDefault_(t)},t.prototype.getForSeries=function(t,e){if(e===this.dygraph_.getHighlightSeries()&&this.highlightSeries_.hasOwnProperty(t))return this.highlightSeries_[t];if(!this.series_.hasOwnProperty(e))throw"Unknown series: "+e;var a=this.series_[e],i=a.options;return i.hasOwnProperty(t)?i[t]:this.getForAxis(t,a.yAxis)},t.prototype.numAxes=function(){return this.yAxes_.length},t.prototype.axisForSeries=function(t){return this.series_[t].yAxis},t.prototype.axisOptions=function(t){return this.yAxes_[t].options},t.prototype.seriesForAxis=function(t){return this.yAxes_[t].series},t.prototype.seriesNames=function(){return this.labels_},t}(),DygraphLayout=function(t){this.dygraph_=t,this.points=[],this.setNames=[],this.annotations=[],this.yAxes_=null,this.xTicks_=null,this.yTicks_=null};DygraphLayout.prototype.attr_=function(t){return this.dygraph_.attr_(t)},DygraphLayout.prototype.addDataset=function(t,e){this.points.push(e),this.setNames.push(t)},DygraphLayout.prototype.getPlotArea=function(){return this.area_},DygraphLayout.prototype.computePlotArea=function(){var t={x:0,y:0};t.w=this.dygraph_.width_-t.x-this.attr_("rightGap"),t.h=this.dygraph_.height_;var e={chart_div:this.dygraph_.graphDiv,reserveSpaceLeft:function(e){var a={x:t.x,y:t.y,w:e,h:t.h};return t.x+=e,t.w-=e,a},reserveSpaceRight:function(e){var a={x:t.x+t.w-e,y:t.y,w:e,h:t.h};return t.w-=e,a},reserveSpaceTop:function(e){var a={x:t.x,y:t.y,w:t.w,h:e};return t.y+=e,t.h-=e,a},reserveSpaceBottom:function(e){var a={x:t.x,y:t.y+t.h-e,w:t.w,h:e};return t.h-=e,a},chartRect:function(){return{x:t.x,y:t.y,w:t.w,h:t.h}}};this.dygraph_.cascadeEvents_("layout",e),this.area_=t},DygraphLayout.prototype.setAnnotations=function(t){this.annotations=[];for(var e=this.attr_("xValueParser")||function(t){return t},a=0;a=0&&1>=i&&this.xticks.push([i,a]);for(this.yticks=[],t=0;t=0&&1>=i&&this.yticks.push([t,i,a])},DygraphLayout.prototype._evaluateAnnotations=function(){var t,e={};for(t=0;t=0;i--)a.childNodes[i].className==e&&a.removeChild(a.childNodes[i]);for(var r=document.bgColor,n=this.dygraph_.graphDiv;n!=document;){var s=n.currentStyle.backgroundColor;if(s&&"transparent"!=s){r=s;break}n=n.parentNode}var o=this.area;t({x:0,y:0,w:o.x,h:this.height}),t({x:o.x,y:0,w:this.width-o.x,h:o.y}),t({x:o.x+o.w,y:0,w:this.width-o.x-o.w,h:this.height}),t({x:o.x,y:o.y+o.h,w:this.width-o.x,h:this.height-o.h-o.y})},e=function(t){return t?a:null},a=function(t,e){return null!==t[e].yval};var h=function(t,a,n,s,o,l,h){var p=t.dygraph,d=p.getOption("stepPlot",t.setName);Dygraph.isArrayLike(s)||(s=null);var u=p.getOption("drawGapEdgePoints",t.setName),g=t.points,c=Dygraph.createIterator(g,0,g.length,e(p.getOption("connectSeparatedPoints"))),y=s&&s.length>=2,v=t.drawingContext;v.save(),y&&v.installPattern(s);var _=i(t,c,n,h,o,u,d,a);r(t,_,l,a,h),y&&v.uninstallPattern(),v.restore()};return i=function(t,e,a,i,r,n,s,o){var l,h,p=null,d=null,u=null,g=[],c=!0,y=t.drawingContext;y.beginPath(),y.strokeStyle=o,y.lineWidth=a;for(var v=e.array_,_=e.end_,f=e.predicate_,x=e.start_;_>x;x++){if(h=v[x],f){for(;_>x&&!f(v,x);)x++;if(x==_)break;h=v[x]}if(null===h.canvasy||h.canvasy!=h.canvasy)s&&null!==p&&(y.moveTo(p,d),y.lineTo(h.canvasx,d)),p=d=null;else{if(l=!1,n||!p){e.nextIdx_=x,e.next(),u=e.hasNext?e.peek.canvasy:null;var m=null===u||u!=u;l=!p&&m,n&&(!c&&!p||e.hasNext&&m)&&(l=!0)}null!==p?a&&(s&&(y.moveTo(p,d),y.lineTo(h.canvasx,d)),y.lineTo(h.canvasx,h.canvasy)):y.moveTo(h.canvasx,h.canvasy),(r||l)&&g.push([h.canvasx,h.canvasy,h.idx]),p=h.canvasx,d=h.canvasy}c=!1}return y.stroke(),g},r=function(t,e,a,i,r){for(var n=t.drawingContext,s=0;s=0;r--)a.visibility()[r]||i.splice(r,1);var n=function(){for(var t=0;t=0;v--){var _=i[v];if(a.getOption("fillGraph",_)){var f=a.getOption("stepPlot",_),x=c[v],m=a.axisPropertiesForSeries(_),b=1+m.minyval*m.yscale;0>b?b=0:b>1&&(b=1),b=h.h*b+h.y;var w,D=p[v],A=Dygraph.createIterator(D,0,D.length,e(a.getOption("connectSeparatedPoints"))),P=0/0,T=[-1,-1],C=Dygraph.toRGB_(x),S="rgba("+C.r+","+C.g+","+C.b+","+u+")";l.fillStyle=S,l.beginPath();for(var k,O=!0;A.hasNext;){var L=A.next();if(Dygraph.isOK(L.y)){if(g){if(!O&&k==L.xval)continue;O=!1,k=L.xval,s=y[L.canvasx];var R;R=void 0===s?b:o?s[0]:s,w=[L.canvasy,R],y[L.canvasx]=f?-1===T[0]?[L.canvasy,b]:[L.canvasy,T[0]]:L.canvasy}else w=[L.canvasy,b];isNaN(P)||(l.moveTo(P,T[0]),f?l.lineTo(L.canvasx,T[0]):l.lineTo(L.canvasx,w[0]),o&&s?l.lineTo(L.canvasx,s[1]):l.lineTo(L.canvasx,w[1]),l.lineTo(P,T[1]),l.closePath()),T=w,P=L.canvasx}else P=0/0,null===L.y_stacked||isNaN(L.y_stacked)||(y[L.canvasx]=h.h*L.y_stacked+h.y)}o=f,l.fill()}}}},l._Plotters={linePlotter:n,fillPlotter:s,errorPlotter:o},l}(),Dygraph=function(){"use strict";var t=function(e,a,i,r){void 0!==r?(t.warn("Using deprecated four-argument dygraph constructor"),this.__old_init__(e,a,i,r)):this.__init__(e,a,i)};t.NAME="Dygraph",t.VERSION="1.2",t.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"},t.toString=function(){return this.__repr__()};var e=1,a=480,i=320,r=12,n=200,s=["K","M","B","T","Q"],o=["k","M","G","T","P","E","Z","Y"],l=["m","u","n","p","f","a","z","y"];t.numberValueFormatter=function(e,a){var i=a("sigFigs");if(null!==i)return t.floatFormat(e,i);var r,n=a("digitsAfterDecimal"),h=a("maxNumberWidth"),p=a("labelsKMB"),d=a("labelsKMG2");if(r=0!==e&&(Math.abs(e)>=Math.pow(10,h)||Math.abs(e)=0;_--,v/=u)if(y>=v){r=t.round_(e/v,n)+g[_];break}if(d){var f=String(e.toExponential()).split("e-");2===f.length&&f[1]>=3&&f[1]<=24&&(r=f[1]%3>0?t.round_(f[0]/t.pow(10,f[1]%3),n):Number(f[0]).toFixed(2),r+=c[Math.floor(f[1]/3)-1])}}return r},t.numberAxisLabelFormatter=function(e,a,i,r){return t.numberValueFormatter(e,i,r)};var h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.dateAxisFormatter=function(e,a){if(a>=t.DECADAL)return""+e.getFullYear();if(a>=t.MONTHLY)return h[e.getMonth()]+" "+e.getFullYear();var i=3600*e.getHours()+60*e.getMinutes()+e.getSeconds()+e.getMilliseconds();if(0===i||a>=t.DAILY){var r=new Date(e.getTime()+36e5);return t.zeropad(r.getDate())+h[r.getMonth()]}return t.hmsString_(e.getTime())},t.Plotters=DygraphCanvasRenderer._Plotters,t.DEFAULT_ATTRS={highlightCircleSize:3,highlightSeriesOpts:null,highlightSeriesBackgroundAlpha:.5,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:!1,labelsShowZeroValues:!0,labelsKMB:!1,labelsKMG2:!1,showLabelsOnHighlight:!0,digitsAfterDecimal:2,maxNumberWidth:6,sigFigs:null,strokeWidth:1,strokeBorderWidth:0,strokeBorderColor:"white",axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:!1,xValueParser:t.dateParser,delimiter:",",sigma:2,errorBars:!1,fractions:!1,wilsonInterval:!0,customBars:!1,fillGraph:!1,fillAlpha:.15,connectSeparatedPoints:!1,stackedGraph:!1,stackedGraphNaNFill:"all",hideOverlayOnMouseOut:!0,legend:"onmouseover",stepPlot:!1,avoidMinZero:!1,xRangePad:0,yRangePad:null,drawAxesAtZero:!1,titleHeight:28,xLabelHeight:18,yLabelWidth:18,drawXAxis:!0,drawYAxis:!0,axisLineColor:"black",axisLineWidth:.3,gridLineWidth:.3,axisLabelColor:"black",axisLabelFont:"Arial",axisLabelWidth:50,drawYGrid:!0,drawXGrid:!0,gridLineColor:"rgb(128,128,128)",interactionModel:null,animatedZooms:!1,showRangeSelector:!1,rangeSelectorHeight:40,rangeSelectorPlotStrokeColor:"#808FAB",rangeSelectorPlotFillColor:"#A7B1C4",plotter:[t.Plotters.fillPlotter,t.Plotters.errorPlotter,t.Plotters.linePlotter],plugins:[],axes:{x:{pixelsPerLabel:60,axisLabelFormatter:t.dateAxisFormatter,valueFormatter:t.dateString_,drawGrid:!0,independentTicks:!0,ticker:null},y:{pixelsPerLabel:30,valueFormatter:t.numberValueFormatter,axisLabelFormatter:t.numberAxisLabelFormatter,drawGrid:!0,independentTicks:!0,ticker:null},y2:{pixelsPerLabel:30,valueFormatter:t.numberValueFormatter,axisLabelFormatter:t.numberAxisLabelFormatter,drawGrid:!1,independentTicks:!1,ticker:null}}};var p,d=1,u=2;t.PLUGINS=[];var g=!1;t.prototype.__old_init__=function(e,a,i,r){if(null!==i){for(var n=["Date"],s=0;s=0;n--){var s=r[n][0],o=r[n][1];if(o.call(s,i),i.propagationStopped)break}return i.defaultPrevented},t.prototype.isZoomed=function(t){if(null===t||void 0===t)return this.zoomed_x_||this.zoomed_y_;if("x"===t)return this.zoomed_x_;if("y"===t)return this.zoomed_y_;throw"axis parameter is ["+t+"] must be null, 'x' or 'y'."},t.prototype.toString=function(){var t=this.maindiv_,e=t&&t.id?t.id:t;return"[Dygraph "+e+"]"},t.prototype.attr_=function(t,e){return e?this.attributes_.getForSeries(t,e):this.attributes_.get(t)},t.prototype.getOption=function(t,e){return this.attr_(t,e)},t.prototype.getOptionForAxis=function(t,e){return this.attributes_.getForAxis(t,e)},t.prototype.optionsViewForAxis_=function(t){var e=this;return function(a){var i=e.user_attrs_.axes;return i&&i[t]&&i[t].hasOwnProperty(a)?i[t][a]:"undefined"!=typeof e.user_attrs_[a]?e.user_attrs_[a]:(i=e.attrs_.axes,i&&i[t]&&i[t].hasOwnProperty(a)?i[t][a]:"y"==t&&e.axes_[0].hasOwnProperty(a)?e.axes_[0][a]:"y2"==t&&e.axes_[1].hasOwnProperty(a)?e.axes_[1][a]:e.attr_(a))}},t.prototype.rollPeriod=function(){return this.rollPeriod_},t.prototype.xAxisRange=function(){return this.dateWindow_?this.dateWindow_:this.xAxisExtremes()},t.prototype.xAxisExtremes=function(){var t=this.attr_("xRangePad")/this.plotter_.area.w;if(0===this.numRows())return[0-t,1+t];var e=this.rawData_[0][0],a=this.rawData_[this.rawData_.length-1][0];if(t){var i=a-e;e-=i*t,a+=i*t}return[e,a]},t.prototype.yAxisRange=function(t){if("undefined"==typeof t&&(t=0),0>t||t>=this.axes_.length)return null;var e=this.axes_[t];return[e.computedValueRange[0],e.computedValueRange[1]]},t.prototype.yAxisRanges=function(){for(var t=[],e=0;et||t>this.rawData_.length?null:0>e||e>this.rawData_[t].length?null:this.rawData_[t][e]},t.prototype.createInterface_=function(){var e=this.maindiv_;this.graphDiv=document.createElement("div"),this.graphDiv.style.textAlign="left",e.appendChild(this.graphDiv),this.canvas_=t.createCanvas(),this.canvas_.style.position="absolute",this.hidden_=this.createPlotKitCanvas_(this.canvas_),this.resizeElements_(),this.canvas_ctx_=t.getContext(this.canvas_),this.hidden_ctx_=t.getContext(this.hidden_),this.graphDiv.appendChild(this.hidden_),this.graphDiv.appendChild(this.canvas_),this.mouseEventElement_=this.createMouseEventElement_(),this.layout_=new DygraphLayout(this);var a=this;this.mouseMoveHandler_=function(t){a.mouseMove_(t)},this.mouseOutHandler_=function(e){var i=e.target||e.fromElement,r=e.relatedTarget||e.toElement;t.isNodeContainedBy(i,a.graphDiv)&&!t.isNodeContainedBy(r,a.graphDiv)&&a.mouseOut_(e)},this.addAndTrackEvent(window,"mouseout",this.mouseOutHandler_),this.addAndTrackEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_),this.resizeHandler_||(this.resizeHandler_=function(){a.resize()},this.addAndTrackEvent(window,"resize",this.resizeHandler_))},t.prototype.resizeElements_=function(){this.graphDiv.style.width=this.width_+"px",this.graphDiv.style.height=this.height_+"px",this.canvas_.width=this.width_,this.canvas_.height=this.height_,this.canvas_.style.width=this.width_+"px",this.canvas_.style.height=this.height_+"px",this.hidden_.width=this.width_,this.hidden_.height=this.height_,this.hidden_.style.width=this.width_+"px",this.hidden_.style.height=this.height_+"px"},t.prototype.destroy=function(){this.canvas_ctx_.restore(),this.hidden_ctx_.restore();var e=function(t){for(;t.hasChildNodes();)e(t.firstChild),t.removeChild(t.firstChild)};this.removeTrackedEvents_(),t.removeEvent(window,"mouseout",this.mouseOutHandler_),t.removeEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler_),t.removeEvent(window,"resize",this.resizeHandler_),this.resizeHandler_=null,e(this.maindiv_);var a=function(t){for(var e in t)"object"==typeof t[e]&&(t[e]=null)};a(this.layout_),a(this.plotter_),a(this)},t.prototype.createPlotKitCanvas_=function(e){var a=t.createCanvas();return a.style.position="absolute",a.style.top=e.style.top,a.style.left=e.style.left,a.width=this.width_,a.height=this.height_,a.style.width=this.width_+"px",a.style.height=this.height_+"px",a},t.prototype.createMouseEventElement_=function(){if(this.isUsingExcanvas_){var t=document.createElement("div");return t.style.position="absolute",t.style.backgroundColor="white",t.style.filter="alpha(opacity=0)",t.style.width=this.width_+"px",t.style.height=this.height_+"px",this.graphDiv.appendChild(t),t}return this.canvas_},t.prototype.setColors_=function(){var e=this.getLabels(),a=e.length-1;this.colors_=[],this.colorsMap_={};var i,r=this.attr_("colors");if(r){for(i=0;a>i;i++)if(this.visibility()[i]){var n=r[i%r.length];this.colors_.push(n),this.colorsMap_[e[1+i]]=n}}else{var s=this.attr_("colorSaturation")||1,o=this.attr_("colorValue")||.5,l=Math.ceil(a/2);for(i=1;a>=i;i++)if(this.visibility()[i-1]){var h=i%2?Math.ceil(i/2):l+i/2,p=1*h/(1+a),n=t.hsvToRGB(p,s,o);this.colors_.push(n),this.colorsMap_[e[i]]=n}}},t.prototype.getColors=function(){return this.colors_},t.prototype.getPropertiesForSeries=function(t){for(var e=-1,a=this.getLabels(),i=1;i=l;l++)h=t.zoomAnimationFunction(l,p),d[l-1]=[e[0]*(1-h)+h*a[0],e[1]*(1-h)+h*a[1]];if(null!==i&&null!==s)for(l=1;p>=l;l++){h=t.zoomAnimationFunction(l,p);for(var g=[],c=0;cl;l++){var h=s[l];if(t.isValidPoint(h,!0)){var p=Math.abs(h.canvasx-e);a>p&&(a=p,i=h.idx)}}return i},t.prototype.findClosestPoint=function(e,a){for(var i,r,n,s,o,l,h,p=1/0,d=this.layout_.points.length-1;d>=0;--d)for(var u=this.layout_.points[d],g=0;gi&&(p=i,o=s,l=d,h=s.idx));var c=this.layout_.setNames[l];return{row:h,seriesName:c,point:o}},t.prototype.findStackedPoint=function(e,a){for(var i,r,n=this.findClosestRow(e),s=0;s=h.length)){var p=h[l];if(t.isValidPoint(p)){var d=p.canvasy;if(e>p.canvasx&&l+10){var c=(e-p.canvasx)/g;d+=c*(u.canvasy-p.canvasy)}}}else if(e0){var y=h[l-1];if(t.isValidPoint(y)){var g=p.canvasx-y.canvasx;if(g>0){var c=(p.canvasx-e)/g;d+=c*(y.canvasy-p.canvasy)}}}(0===s||a>d)&&(i=p,r=s)}}}var v=this.layout_.setNames[r];return{row:n,seriesName:v,point:i}},t.prototype.mouseMove_=function(t){var e=this.layout_.points;if(void 0!==e&&null!==e){var a=this.eventToDomCoords(t),i=a[0],r=a[1],n=this.attr_("highlightSeriesOpts"),s=!1;if(n&&!this.isSeriesLocked()){var o;o=this.attr_("stackedGraph")?this.findStackedPoint(i,r):this.findClosestPoint(i,r),s=this.setSelection(o.row,o.seriesName)}else{var l=this.findClosestRow(i);s=this.setSelection(l)}var h=this.attr_("highlightCallback");h&&s&&h(t,this.lastx_,this.selPoints_,this.lastRow_,this.highlightSet_)}},t.prototype.getLeftBoundary_=function(t){if(this.boundaryIds_[t])return this.boundaryIds_[t][0];for(var e=0;ee?r:a-r;if(0>=n)return this.fadeLevel&&this.updateSelection_(1),void 0;var s=++this.animateId,o=this;t.repeatAndCleanup(function(){o.animateId==s&&(o.fadeLevel+=e,0===o.fadeLevel?o.clearSelection():o.updateSelection_(o.fadeLevel/a))},n,i,function(){})},t.prototype.updateSelection_=function(e){this.cascadeEvents_("select",{selectedX:this.lastx_,selectedPoints:this.selPoints_});var a,i=this.canvas_ctx_;if(this.attr_("highlightSeriesOpts")){i.clearRect(0,0,this.width_,this.height_);var r=1-this.attr_("highlightSeriesBackgroundAlpha");if(r){var n=!0;if(n){if(void 0===e)return this.animateSelection_(1),void 0;r*=e}i.fillStyle="rgba(255,255,255,"+r+")",i.fillRect(0,0,this.width_,this.height_)}this.plotter_._renderLineChart(this.highlightSet_,i)}else if(this.previousVerticalX_>=0){var s=0,o=this.attr_("labels");for(a=1;as&&(s=l)}var h=this.previousVerticalX_;i.clearRect(h-s-1,0,2*s+2,this.height_)}if(this.isUsingExcanvas_&&this.currentZoomRectArgs_&&t.prototype.drawZoomRect_.apply(this,this.currentZoomRectArgs_),this.selPoints_.length>0){var p=this.selPoints_[0].canvasx;for(i.save(),a=0;a=0){t!=this.lastRow_&&(i=!0),this.lastRow_=t;for(var r=0;r=0&&(i=!0),this.lastRow_=-1;return this.lastx_=this.selPoints_.length?this.selPoints_[0].xval:-1,void 0!==e&&(this.highlightSet_!==e&&(i=!0),this.highlightSet_=e),void 0!==a&&(this.lockedSet_=a),i&&this.updateSelection_(void 0),i},t.prototype.mouseOut_=function(t){this.attr_("unhighlightCallback")&&this.attr_("unhighlightCallback")(t),this.attr_("hideOverlayOnMouseOut")&&!this.lockedSet_&&this.clearSelection()},t.prototype.clearSelection=function(){return this.cascadeEvents_("deselect",{}),this.lockedSet_=!1,this.fadeLevel?(this.animateSelection_(-1),void 0):(this.canvas_ctx_.clearRect(0,0,this.width_,this.height_),this.fadeLevel=0,this.selPoints_=[],this.lastx_=-1,this.lastRow_=-1,this.highlightSet_=null,void 0)},t.prototype.getSelection=function(){if(!this.selPoints_||this.selPoints_.length<1)return-1;for(var t=0;ta&&(s=a),a>o&&(o=a),(null===r||o>r)&&(r=o),(null===i||i>s)&&(i=s)}}else for(e=0;er)&&(r=a),(null===i||i>a)&&(i=a));return[i,r]},t.prototype.predraw_=function(){var t=new Date;this.layout_.computePlotArea(),this.computeYAxes_(),this.plotter_&&(this.cascadeEvents_("clearChart"),this.plotter_.clear()),this.is_initial_draw_||(this.canvas_ctx_.restore(),this.hidden_ctx_.restore()),this.canvas_ctx_.save(),this.hidden_ctx_.save(),this.plotter_=new DygraphCanvasRenderer(this,this.hidden_,this.hidden_ctx_,this.layout_),this.createRollInterface_(),this.cascadeEvents_("predraw"),this.rolledSeries_=[null];for(var e=1;e=e))for(var a=e;aa[1]&&(a[1]=g),g=1;i--)if(this.visibility()[i-1]){if(a){n=e[i];var y=a[0],v=a[1],_=null,f=null;for(r=0;r=y&&null===_&&(_=r),n[r][0]<=v&&(f=r);null===_&&(_=0);for(var x=_,m=!0;m&&x>0;)x--,m=g(n[x]);null===f&&(f=n.length-1);var b=f;for(m=!0;m&&b0&&(this.setIndexByName_[s[0]]=0);for(var o=0,l=1;li;i++)this.axes_[i].valueWindow=e[i]}for(a=0;al;l++){var h=this.axes_[l],p=this.attributes_.getForAxis("logscale",l),d=this.attributes_.getForAxis("includeZero",l),u=this.attributes_.getForAxis("independentTicks",l);if(i=this.attributes_.seriesForAxis(l),e=!0,r=.1,null!==this.attr_("yRangePad")&&(e=!1,r=this.attr_("yRangePad")/this.plotter_.area.h),0===i.length)h.extremeRange=[0,1];else{for(var g,c,y=1/0,v=-1/0,_=0;_0&&(y=0),0>v&&(v=0)),1/0==y&&(y=0),v==-1/0&&(v=1),a=v-y,0===a&&(0!==v?a=Math.abs(v):(v=1,a=1));var f,x;if(p)if(e)f=v+r*a,x=y;else{var m=Math.exp(Math.log(a)*r);f=v*m,x=y/m}else f=v+r*a,x=y-r*a,e&&!this.attr_("avoidMinZero")&&(0>x&&y>=0&&(x=0),f>0&&0>=v&&(f=0));h.extremeRange=[x,f]}if(h.valueWindow)h.computedValueRange=[h.valueWindow[0],h.valueWindow[1]];else if(h.valueRange){var b=s(h.valueRange[0])?h.extremeRange[0]:h.valueRange[0],w=s(h.valueRange[1])?h.extremeRange[1]:h.valueRange[1];if(!e)if(h.logscale){var m=Math.exp(Math.log(a)*r);b*=m,w/=m}else a=w-b,b-=a*r,w+=a*r;h.computedValueRange=[b,w]}else h.computedValueRange=h.extremeRange;if(u){h.independentTicks=u;var D=this.optionsViewForAxis_("y"+(l?"2":"")),A=D("ticker");h.ticks=A(h.computedValueRange[0],h.computedValueRange[1],this.height_,D,this),n||(n=h)}}if(void 0===n)throw'Configuration Error: At least one axis has to have the "independentTicks" option activated.';for(var l=0;o>l;l++){var h=this.axes_[l];if(!h.independentTicks){for(var D=this.optionsViewForAxis_("y"+(l?"2":"")),A=D("ticker"),P=n.ticks,T=n.computedValueRange[1]-n.computedValueRange[0],C=h.computedValueRange[1]-h.computedValueRange[0],S=[],k=0;k=l&&(l=null);null!==l?i.push([o,l]):i.push([o,r?[null,null]:n?[null,null,null]:l])}return i},t.prototype.rollingAverage=function(t,e){e=Math.min(e,t.length);var a,i,r,n,s,o,l,h,p=[],d=this.attr_("sigma");if(this.fractions_){var u=0,g=0,c=100;for(r=0;r=0&&(u-=t[r-e][1][0],g-=t[r-e][1][1]);var y=t[r][0],v=g?u/g:0;if(this.attr_("errorBars"))if(this.attr_("wilsonInterval"))if(g){var _=0>v?0:v,f=g,x=d*Math.sqrt(_*(1-_)/f+d*d/(4*f*f)),m=1+d*d/g;a=(_+d*d/(2*g)-x)/m,i=(_+d*d/(2*g)+x)/m,p[r]=[y,[_*c,(_-a)*c,(i-_)*c]]}else p[r]=[y,[0,0,0]];else h=g?d*Math.sqrt(v*(1-v)/g):1,p[r]=[y,[c*v,c*h,c*h]];else p[r]=[y,c*v]}}else if(this.attr_("customBars")){a=0;var b=0;i=0;var w=0;for(r=0;r=0){var A=t[r-e];null===A[1][1]||isNaN(A[1][1])||(a-=A[1][0],b-=A[1][1],i-=A[1][2],w-=1)}p[r]=w?[t[r][0],[1*b/w,1*(b-a)/w,1*(i-b)/w]]:[t[r][0],[null,null,null]]}}else if(this.attr_("errorBars"))for(r=0;rn;n++)s=t[n][1][0],null===s||isNaN(s)||(l++,o+=t[n][1][0],P+=Math.pow(t[n][1][1],2));if(l)h=Math.sqrt(P)/l,p[r]=[t[r][0],[o/l,d*h,d*h]];else{var T=1==e?t[r][1][0]:null;p[r]=[t[r][0],[T,T,T]]}}else{if(1==e)return t;for(r=0;rn;n++)s=t[n][1],null===s||isNaN(s)||(l++,o+=t[n][1]);p[r]=l?[t[r][0],o/l]:[t[r][0],null]}}return p},t.prototype.detectTypeFromString_=function(t){var e=!1,a=t.indexOf("-");a>0&&"e"!=t[a-1]&&"E"!=t[a-1]||t.indexOf("/")>=0||isNaN(parseFloat(t))?e=!0:8==t.length&&t>"19700101"&&"20371231">t&&(e=!0),this.setXAxisOptions_(e)},t.prototype.setXAxisOptions_=function(e){e?(this.attrs_.xValueParser=t.dateParser,this.attrs_.axes.x.valueFormatter=t.dateString_,this.attrs_.axes.x.ticker=t.dateTicker,this.attrs_.axes.x.axisLabelFormatter=t.dateAxisFormatter):(this.attrs_.xValueParser=function(t){return parseFloat(t)},this.attrs_.axes.x.valueFormatter=function(t){return t},this.attrs_.axes.x.ticker=t.numericLinearTicks,this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter)};var p=function(e,a,i){var r=parseFloat(e);if(!isNaN(r))return r;if(/^ *$/.test(e))return null;if(/^ *nan *$/i.test(e))return 0/0;var n="Unable to parse '"+e+"' as a number";return null!==i&&null!==a&&(n+=" on line "+(1+a)+" ('"+i+"') of CSV."),t.error(n),null};t.prototype.parseCSV_=function(e){var a,i,r=[],n=t.detectLineDelimiter(e),s=e.split(n||"\n"),o=this.attr_("delimiter");-1==s[0].indexOf(o)&&s[0].indexOf(" ")>=0&&(o=" ");var l=0;"labels"in this.user_attrs_||(l=1,this.attrs_.labels=s[0].split(o),this.attributes_.reparseSeries());for(var h,d=0,u=!1,g=this.attr_("labels").length,c=!1,y=l;y0&&f[0]0;)e=String.fromCharCode(65+(t-1)%26)+e.toLowerCase(),t=Math.floor((t-1)/26);return e},i=e.getNumberOfColumns(),r=e.getNumberOfRows(),n=e.getColumnType(0);if("date"==n||"datetime"==n)this.attrs_.xValueParser=t.dateParser,this.attrs_.axes.x.valueFormatter=t.dateString_,this.attrs_.axes.x.ticker=t.dateTicker,this.attrs_.axes.x.axisLabelFormatter=t.dateAxisFormatter;else{if("number"!=n)return t.error("only 'date', 'datetime' and 'number' types are supported for column 1 of DataTable input (Got '"+n+"')"),null;this.attrs_.xValueParser=function(t){return parseFloat(t)},this.attrs_.axes.x.valueFormatter=function(t){return t},this.attrs_.axes.x.ticker=t.numericLinearTicks,this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}var s,o,l=[],h={},p=!1;for(s=1;i>s;s++){var d=e.getColumnType(s);if("number"==d)l.push(s);else if("string"==d&&this.attr_("displayAnnotations")){var u=l[l.length-1];h.hasOwnProperty(u)?h[u].push(s):h[u]=[s],p=!0}else t.error("Only 'number' is supported as a dependent type with Gviz. 'string' is only supported if displayAnnotations is true")}var g=[e.getColumnLabel(0)];for(s=0;ss;s++){var _=[];if("undefined"!=typeof e.getValue(s,0)&&null!==e.getValue(s,0)){if("date"==n||"datetime"==n?_.push(e.getValue(s,0).getTime()):_.push(e.getValue(s,0)),this.attr_("errorBars"))for(o=0;i-1>o;o++)_.push([e.getValue(s,1+2*o),e.getValue(s,2+2*o)]);else{for(o=0;o0&&_[0]0&&this.setAnnotations(v,!0),this.attributes_.reparseSeries()},t.prototype.start_=function(){var e=this.file_;if("function"==typeof e&&(e=e()),t.isArrayLike(e))this.rawData_=this.parseArray_(e),this.predraw_();else if("object"==typeof e&&"function"==typeof e.getColumnRange)this.parseDataTable_(e),this.predraw_();else if("string"==typeof e){var a=t.detectLineDelimiter(e);if(a)this.loadedEvent_(e);else{var i=new XMLHttpRequest,r=this;i.onreadystatechange=function(){4==i.readyState&&(200===i.status||0===i.status)&&r.loadedEvent_(i.responseText)},i.open("GET",e,!0),i.send(null)}}else t.error("Unknown data format: "+typeof e)},t.prototype.updateOptions=function(e,a){"undefined"==typeof a&&(a=!1);var i=e.file,r=t.mapLegacyOptions_(e);"rollPeriod"in r&&(this.rollPeriod_=r.rollPeriod),"dateWindow"in r&&(this.dateWindow_=r.dateWindow,"isZoomedIgnoreProgrammaticZoom"in r||(this.zoomed_x_=null!==r.dateWindow)),"valueRange"in r&&!("isZoomedIgnoreProgrammaticZoom"in r)&&(this.zoomed_y_=null!==r.valueRange);var n=t.isPixelChangingOptionList(this.attr_("labels"),r);t.updateDeep(this.user_attrs_,r),this.attributes_.reparseSeries(),i?(this.file_=i,a||this.start_()):a||(n?this.predraw_():this.renderGraph_(!1))},t.mapLegacyOptions_=function(e){var a={};for(var i in e)"file"!=i&&e.hasOwnProperty(i)&&(a[i]=e[i]);var r=function(t,e,i){a.axes||(a.axes={}),a.axes[t]||(a.axes[t]={}),a.axes[t][e]=i},n=function(i,n,s){"undefined"!=typeof e[i]&&(t.warn("Option "+i+" is deprecated. Use the "+s+" option for the "+n+" axis instead. "+"(e.g. { axes : { "+n+" : { "+s+" : ... } } } "+"(see http://dygraphs.com/per-axis.html for more information."),r(n,s,e[i]),delete a[i])};return n("xValueFormatter","x","valueFormatter"),n("pixelsPerXLabel","x","pixelsPerLabel"),n("xAxisLabelFormatter","x","axisLabelFormatter"),n("xTicker","x","ticker"),n("yValueFormatter","y","valueFormatter"),n("pixelsPerYLabel","y","pixelsPerLabel"),n("yAxisLabelFormatter","y","axisLabelFormatter"),n("yTicker","y","ticker"),a},t.prototype.resize=function(e,a){if(!this.resize_lock){this.resize_lock=!0,null===e!=(null===a)&&(t.warn("Dygraph.resize() should be called with zero parameters or two non-NULL parameters. Pretending it was zero."),e=a=null);var i=this.width_,r=this.height_;e?(this.maindiv_.style.width=e+"px",this.maindiv_.style.height=a+"px",this.width_=e,this.height_=a):(this.width_=this.maindiv_.clientWidth,this.height_=this.maindiv_.clientHeight),(i!=this.width_||r!=this.height_)&&(this.resizeElements_(),this.predraw_()),this.resize_lock=!1}},t.prototype.adjustRoll=function(t){this.rollPeriod_=t,this.predraw_()},t.prototype.visibility=function(){for(this.attr_("visibility")||(this.attrs_.visibility=[]);this.attr_("visibility").lengthe||e>=i.length?t.warn("invalid series number in setVisibility: "+e):(i[e]=a,this.predraw_())},t.prototype.size=function(){return{width:this.width_,height:this.height_}};var c=function(){if(!g){var e="border: 1px solid black; background-color: white; text-align: center;",a=document.createElement("style");a.type="text/css",document.getElementsByTagName("head")[0].appendChild(a);for(var i=0;it?"0"+t:""+t},Dygraph.hmsString_=function(t){var e=Dygraph.zeropad,a=new Date(t);return a.getSeconds()?e(a.getHours())+":"+e(a.getMinutes())+":"+e(a.getSeconds()):e(a.getHours())+":"+e(a.getMinutes())},Dygraph.dateString_=function(t){var e=Dygraph.zeropad,a=new Date(t),i=""+a.getFullYear(),r=e(a.getMonth()+1),n=e(a.getDate()),s="",o=3600*a.getHours()+60*a.getMinutes()+a.getSeconds();return o&&(s=" "+Dygraph.hmsString_(t)),i+"/"+r+"/"+n+s},Dygraph.round_=function(t,e){var a=Math.pow(10,e);return Math.round(t*a)/a},Dygraph.binarySearch=function(t,e,a,i,r){if((null===i||void 0===i||null===r||void 0===r)&&(i=0,r=e.length-1),i>r)return-1;(null===a||void 0===a)&&(a=0);var n,s=function(t){return t>=0&&tt?a>0&&(n=o-1,s(n)&&e[n]l?0>a&&(n=o+1,s(n)&&e[n]>t)?o:Dygraph.binarySearch(t,e,a,o+1,r):-1},Dygraph.dateParser=function(t){var e,a;if((-1==t.search("-")||-1!=t.search("T")||-1!=t.search("Z"))&&(a=Dygraph.dateStrToMillis(t),a&&!isNaN(a)))return a;if(-1!=t.search("-")){for(e=t.replace("-","/","g");-1!=e.search("-");)e=e.replace("-","/");a=Dygraph.dateStrToMillis(e)}else 8==t.length?(e=t.substr(0,4)+"/"+t.substr(4,2)+"/"+t.substr(6,2),a=Dygraph.dateStrToMillis(e)):a=Dygraph.dateStrToMillis(t);return(!a||isNaN(a))&&Dygraph.error("Couldn't parse "+t+" as a date"),a},Dygraph.dateStrToMillis=function(t){return new Date(t).getTime()},Dygraph.update=function(t,e){if("undefined"!=typeof e&&null!==e)for(var a in e)e.hasOwnProperty(a)&&(t[a]=e[a]);return t},Dygraph.updateDeep=function(t,e){function a(t){return"object"==typeof Node?t instanceof Node:"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}if("undefined"!=typeof e&&null!==e)for(var i in e)e.hasOwnProperty(i)&&(null===e[i]?t[i]=null:Dygraph.isArrayLike(e[i])?t[i]=e[i].slice():a(e[i])?t[i]=e[i]:"object"==typeof e[i]?(("object"!=typeof t[i]||null===t[i])&&(t[i]={}),Dygraph.updateDeep(t[i],e[i])):t[i]=e[i]);return t},Dygraph.isArrayLike=function(t){var e=typeof t;return"object"!=e&&("function"!=e||"function"!=typeof t.item)||null===t||"number"!=typeof t.length||3===t.nodeType?!1:!0},Dygraph.isDateLike=function(t){return"object"!=typeof t||null===t||"function"!=typeof t.getTime?!1:!0 +},Dygraph.clone=function(t){for(var e=[],a=0;a=e||r.call(window,function(){var e=(new Date).getTime(),r=e-o;n=s,s=Math.floor(r/a);var p=s-n,d=s+p>l;d||s>=l?(t(l),i()):(0!==p&&t(s),h())})}()},Dygraph.isPixelChangingOptionList=function(t,e){var a={annotationClickHandler:!0,annotationDblClickHandler:!0,annotationMouseOutHandler:!0,annotationMouseOverHandler:!0,axisLabelColor:!0,axisLineColor:!0,axisLineWidth:!0,clickCallback:!0,digitsAfterDecimal:!0,drawCallback:!0,drawHighlightPointCallback:!0,drawPoints:!0,drawPointCallback:!0,drawXGrid:!0,drawYGrid:!0,fillAlpha:!0,gridLineColor:!0,gridLineWidth:!0,hideOverlayOnMouseOut:!0,highlightCallback:!0,highlightCircleSize:!0,interactionModel:!0,isZoomedIgnoreProgrammaticZoom:!0,labelsDiv:!0,labelsDivStyles:!0,labelsDivWidth:!0,labelsKMB:!0,labelsKMG2:!0,labelsSeparateLines:!0,labelsShowZeroValues:!0,legend:!0,maxNumberWidth:!0,panEdgeFraction:!0,pixelsPerYLabel:!0,pointClickCallback:!0,pointSize:!0,rangeSelectorPlotFillColor:!0,rangeSelectorPlotStrokeColor:!0,showLabelsOnHighlight:!0,showRoller:!0,sigFigs:!0,strokeWidth:!0,underlayCallback:!0,unhighlightCallback:!0,xAxisLabelFormatter:!0,xTicker:!0,xValueFormatter:!0,yAxisLabelFormatter:!0,yValueFormatter:!0,zoomCallback:!0},i=!1,r={};if(t)for(var n=1;ne?1/Math.pow(t,-e):Math.pow(t,e)},Dygraph.dateSetters={ms:Date.prototype.setMilliseconds,s:Date.prototype.setSeconds,m:Date.prototype.setMinutes,h:Date.prototype.setHours},Dygraph.setDateSameTZ=function(t,e){var a=t.getTimezoneOffset();for(var i in e)if(e.hasOwnProperty(i)){var r=Dygraph.dateSetters[i];if(!r)throw"Invalid setter: "+i;r.call(t,e[i]),t.getTimezoneOffset()!=a&&t.setTime(t.getTime()+1e3*60*(a-t.getTimezoneOffset()))}},Dygraph.toRGB_=function(t){var e=document.createElement("div");e.style.backgroundColor=t,e.style.visibility="hidden",document.body.appendChild(e);var a=window.getComputedStyle(e).backgroundColor;document.body.removeChild(e);var i=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(a);return{r:parseInt(i[1],10),g:parseInt(i[2],10),b:parseInt(i[3],10)}}}(),Dygraph.GVizChart=function(t){this.container=t},Dygraph.GVizChart.prototype.draw=function(t,e){this.container.innerHTML="","undefined"!=typeof this.date_graph&&this.date_graph.destroy(),this.date_graph=new Dygraph(this.container,t,e)},Dygraph.GVizChart.prototype.setSelection=function(t){var e=!1;t.length&&(e=t[0].row),this.date_graph.setSelection(e)},Dygraph.GVizChart.prototype.getSelection=function(){var t=[],e=this.date_graph.getSelection();if(0>e)return t;for(var a=this.date_graph.layout_.points,i=0;ia.boundedDates[1]&&(i-=r-a.boundedDates[1],r=i+a.dateRange),e.dateWindow_=[i,r],a.is2DPan)for(var n=a.dragEndY-a.dragStartY,s=0;si&&2>r&&void 0!==e.lastx_&&-1!=e.lastx_&&Dygraph.Interaction.treatMouseOpAsClick(e,t,a),a.isPanning=!1,a.is2DPan=!1,a.initialLeftmostDate=null,a.dateRange=null,a.valueRange=null,a.boundedDates=null,a.boundedValues=null,a.axes=null},Dygraph.Interaction.startZoom=function(t,e,a){a.isZooming=!0,a.zoomMoved=!1},Dygraph.Interaction.moveZoom=function(t,e,a){a.zoomMoved=!0,a.dragEndX=e.dragGetX_(t,a),a.dragEndY=e.dragGetY_(t,a);var i=Math.abs(a.dragStartX-a.dragEndX),r=Math.abs(a.dragStartY-a.dragEndY);a.dragDirection=r/2>i?Dygraph.VERTICAL:Dygraph.HORIZONTAL,e.drawZoomRect_(a.dragDirection,a.dragStartX,a.dragEndX,a.dragStartY,a.dragEndY,a.prevDragDirection,a.prevEndX,a.prevEndY),a.prevEndX=a.dragEndX,a.prevEndY=a.dragEndY,a.prevDragDirection=a.dragDirection},Dygraph.Interaction.treatMouseOpAsClick=function(t,e,a){var i=t.attr_("clickCallback"),r=t.attr_("pointClickCallback"),n=null;if(r){for(var s=-1,o=Number.MAX_VALUE,l=0;lp)&&(o=p,s=l)}var d=t.attr_("highlightCircleSize")+2;d*d>=o&&(n=t.selPoints_[s])}n&&r(e,n),i&&i(e,t.lastx_,t.selPoints_)},Dygraph.Interaction.endZoom=function(t,e,a){a.isZooming=!1,a.dragEndX=e.dragGetX_(t,a),a.dragEndY=e.dragGetY_(t,a);var i=Math.abs(a.dragEndX-a.dragStartX),r=Math.abs(a.dragEndY-a.dragStartY);2>i&&2>r&&void 0!==e.lastx_&&-1!=e.lastx_&&Dygraph.Interaction.treatMouseOpAsClick(e,t,a);var n=e.getArea();if(i>=10&&a.dragDirection==Dygraph.HORIZONTAL){var s=Math.min(a.dragStartX,a.dragEndX),o=Math.max(a.dragStartX,a.dragEndX);s=Math.max(s,n.x),o=Math.min(o,n.x+n.w),o>s&&e.doZoomX_(s,o),a.cancelNextDblclick=!0}else if(r>=10&&a.dragDirection==Dygraph.VERTICAL){var l=Math.min(a.dragStartY,a.dragEndY),h=Math.max(a.dragStartY,a.dragEndY);l=Math.max(l,n.y),h=Math.min(h,n.y+n.h),h>l&&e.doZoomY_(l,h),a.cancelNextDblclick=!0}else a.zoomMoved&&e.clearZoomRect_();a.dragStartX=null,a.dragStartY=null},Dygraph.Interaction.startTouch=function(t,e,a){t.preventDefault(),t.touches.length>1&&(a.startTimeForDoubleTapMs=null);for(var i=[],r=0;r=2){a.initialPinchCenter={pageX:.5*(i[0].pageX+i[1].pageX),pageY:.5*(i[0].pageY+i[1].pageY),dataX:.5*(i[0].dataX+i[1].dataX),dataY:.5*(i[0].dataY+i[1].dataY)};var s=180/Math.PI*Math.atan2(a.initialPinchCenter.pageY-i[0].pageY,i[0].pageX-a.initialPinchCenter.pageX);s=Math.abs(s),s>90&&(s=90-s),a.touchDirections={x:67.5>s,y:s>22.5}}a.initialRange={x:e.xAxisRange(),y:e.yAxisRange()}},Dygraph.Interaction.moveTouch=function(t,e,a){a.startTimeForDoubleTapMs=null;var i,r=[];for(i=0;i=2){var c=o[1].pageX-l.pageX;u=(r[1].pageX-s.pageX)/c;var y=o[1].pageY-l.pageY;g=(r[1].pageY-s.pageY)/y}u=Math.min(8,Math.max(.125,u)),g=Math.min(8,Math.max(.125,g));var v=!1;if(a.touchDirections.x&&(e.dateWindow_=[l.dataX-h.dataX+(a.initialRange.x[0]-l.dataX)/u,l.dataX-h.dataX+(a.initialRange.x[1]-l.dataX)/u],v=!0),a.touchDirections.y)for(i=0;1>i;i++){var _=e.axes_[i],f=e.attributes_.getForAxis("logscale",i);f||(_.valueWindow=[l.dataY-h.dataY+(a.initialRange.y[0]-l.dataY)/g,l.dataY-h.dataY+(a.initialRange.y[1]-l.dataY)/g],v=!0)}if(e.drawGraph_(!1),v&&r.length>1&&e.attr_("zoomCallback")){var x=e.xAxisRange();e.attr_("zoomCallback")(x[0],x[1],e.yAxisRanges())}},Dygraph.Interaction.endTouch=function(t,e,a){if(0!==t.touches.length)Dygraph.Interaction.startTouch(t,e,a);else if(1==t.changedTouches.length){var i=(new Date).getTime(),r=t.changedTouches[0];a.startTimeForDoubleTapMs&&i-a.startTimeForDoubleTapMs<500&&a.doubleTapX&&Math.abs(a.doubleTapX-r.screenX)<50&&a.doubleTapY&&Math.abs(a.doubleTapY-r.screenY)<50?e.resetZoom():(a.startTimeForDoubleTapMs=i,a.doubleTapX=r.screenX,a.doubleTapY=r.screenY)}},Dygraph.Interaction.defaultModel={mousedown:function(t,e,a){t.button&&2==t.button||(a.initializeMouseDown(t,e,a),t.altKey||t.shiftKey?Dygraph.startPan(t,e,a):Dygraph.startZoom(t,e,a))},mousemove:function(t,e,a){a.isZooming?Dygraph.moveZoom(t,e,a):a.isPanning&&Dygraph.movePan(t,e,a)},mouseup:function(t,e,a){a.isZooming?Dygraph.endZoom(t,e,a):a.isPanning&&Dygraph.endPan(t,e,a)},touchstart:function(t,e,a){Dygraph.Interaction.startTouch(t,e,a)},touchmove:function(t,e,a){Dygraph.Interaction.moveTouch(t,e,a)},touchend:function(t,e,a){Dygraph.Interaction.endTouch(t,e,a)},mouseout:function(t,e,a){a.isZooming&&(a.dragEndX=null,a.dragEndY=null,e.clearZoomRect_())},dblclick:function(t,e,a){return a.cancelNextDblclick?(a.cancelNextDblclick=!1,void 0):(t.altKey||t.shiftKey||e.resetZoom(),void 0)}},Dygraph.DEFAULT_ATTRS.interactionModel=Dygraph.Interaction.defaultModel,Dygraph.defaultInteractionModel=Dygraph.Interaction.defaultModel,Dygraph.endZoom=Dygraph.Interaction.endZoom,Dygraph.moveZoom=Dygraph.Interaction.moveZoom,Dygraph.startZoom=Dygraph.Interaction.startZoom,Dygraph.endPan=Dygraph.Interaction.endPan,Dygraph.movePan=Dygraph.Interaction.movePan,Dygraph.startPan=Dygraph.Interaction.startPan,Dygraph.Interaction.nonInteractiveModel_={mousedown:function(t,e,a){a.initializeMouseDown(t,e,a)},mouseup:function(t,e,a){a.dragEndX=e.dragGetX_(t,a),a.dragEndY=e.dragGetY_(t,a);var i=Math.abs(a.dragEndX-a.dragStartX),r=Math.abs(a.dragEndY-a.dragStartY);2>i&&2>r&&void 0!==e.lastx_&&-1!=e.lastx_&&Dygraph.Interaction.treatMouseOpAsClick(e,t,a)}},Dygraph.Interaction.dragIsPanInteractionModel={mousedown:function(t,e,a){a.initializeMouseDown(t,e,a),Dygraph.startPan(t,e,a)},mousemove:function(t,e,a){a.isPanning&&Dygraph.movePan(t,e,a)},mouseup:function(t,e,a){a.isPanning&&Dygraph.endPan(t,e,a)}},function(){"use strict";var t;Dygraph.numericLinearTicks=function(t,e,a,i,r,n){var s=function(t){return"logscale"===t?!1:i(t)};return Dygraph.numericTicks(t,e,a,s,r,n)},Dygraph.numericTicks=function(e,a,i,r,n,s){var o,l,h,p,d=r("pixelsPerLabel"),u=[];if(s)for(o=0;o=p/4){for(var v=c;v>=g;v--){var _=t[v],f=Math.log(_/e)/Math.log(a/e)*i,x={v:_};null===y?y={tickValue:_,pixel_coord:f}:Math.abs(f-y.pixel_coord)>=d?y={tickValue:_,pixel_coord:f}:x.label="",u.push(x)}u.reverse()}}if(0===u.length){var m,b,w=r("labelsKMG2");w?(m=[1,2,4,8,16,32,64,128,256],b=16):(m=[1,2,5,10,20,50,100],b=10);var D,A,P,T,C=Math.ceil(i/d),S=Math.abs(a-e)/C,k=Math.floor(Math.log(S)/Math.log(b)),O=Math.pow(b,k);for(l=0;ld));l++);for(A>P&&(D*=-1),o=0;p>o;o++)h=A+o*D,u.push({v:h})}}var L=r("axisLabelFormatter");for(o=0;o=0?Dygraph.getDateAxis(t,e,n,i,r):[]};var e=0,a=1,i=2,r=3,n=4,s=5,o=6,l=7,h=8,p=9,d=10,u=11,g=12,c=13,y=14,v=15,_=16,f=17,x=18,m=19,b=20,w=21,D=[];D[e]=1e3,D[a]=2e3,D[i]=5e3,D[r]=1e4,D[n]=3e4,D[s]=6e4,D[o]=12e4,D[l]=3e5,D[h]=6e5,D[p]=18e5,D[d]=36e5,D[u]=72e5,D[g]=216e5,D[c]=864e5,D[y]=6048e5;var A=[];A[v]={months:[0,1,2,3,4,5,6,7,8,9,10,11],year_mod:1},A[_]={months:[0,3,6,9],year_mod:1},A[f]={months:[0,6],year_mod:1},A[x]={months:[0],year_mod:1},A[m]={months:[0],year_mod:10},A[b]={months:[0],year_mod:100},t=function(){for(var t=[],e=-39;39>=e;e++)for(var a=Math.pow(10,e),i=1;9>=i;i++){var r=a*i;t.push(r)}return t}(),Dygraph.pickDateTickGranularity=function(t,e,a,i){for(var r=i("pixelsPerLabel"),n=0;w>n;n++){var s=Dygraph.numDateTicks(t,e,n);if(a/s>=r)return n}return-1},Dygraph.numDateTicks=function(t,e,a){if(v>a){var i=D[a];return Math.floor(.5+1*(e-t)/i)}var r=A[a],n=31557807360,s=1*(e-t)/n;return Math.floor(.5+1*s*r.months.length/r.year_mod)},Dygraph.getDateAxis=function(t,e,a,i,r){var n,s=i("axisLabelFormatter"),o=[];if(v>a){var l=D[a],h=l/1e3,p=new Date(t);Dygraph.setDateSameTZ(p,{ms:0});var d;60>=h?(d=p.getSeconds(),Dygraph.setDateSameTZ(p,{s:d-d%h})):(Dygraph.setDateSameTZ(p,{s:0}),h/=60,60>=h?(d=p.getMinutes(),Dygraph.setDateSameTZ(p,{m:d-d%h})):(Dygraph.setDateSameTZ(p,{m:0}),h/=60,24>=h?(d=p.getHours(),p.setHours(d-d%h)):(p.setHours(0),h/=24,7==h&&p.setDate(p.getDate()-p.getDay())))),t=p.getTime();var g=new Date(t).getTimezoneOffset(),c=l>=D[u];for(n=t;e>=n;n+=l){if(p=new Date(n),c&&p.getTimezoneOffset()!=g){var y=p.getTimezoneOffset()-g;n+=1e3*60*y,p=new Date(n),g=p.getTimezoneOffset(),new Date(n+l).getTimezoneOffset()!=g&&(n+=l,p=new Date(n),g=p.getTimezoneOffset())}o.push({v:n,label:s(p,a,i,r)})}}else{var _,f=1;w>a?(_=A[a].months,f=A[a].year_mod):Dygraph.warn("Span of dates is too long");for(var x=new Date(t).getFullYear(),m=new Date(e).getFullYear(),b=Dygraph.zeropad,P=x;m>=P;P++)if(0===P%f)for(var T=0;T<_.length;T++){var C=P+"/"+b(1+_[T])+"/01";n=Dygraph.dateStrToMillis(C),t>n||n>e||o.push({v:n,label:s(new Date(n),a,i,r)})}}return o},Dygraph&&Dygraph.DEFAULT_ATTRS&&Dygraph.DEFAULT_ATTRS.axes&&Dygraph.DEFAULT_ATTRS.axes.x&&Dygraph.DEFAULT_ATTRS.axes.y&&Dygraph.DEFAULT_ATTRS.axes.y2&&(Dygraph.DEFAULT_ATTRS.axes.x.ticker=Dygraph.dateTicker,Dygraph.DEFAULT_ATTRS.axes.y.ticker=Dygraph.numericTicks,Dygraph.DEFAULT_ATTRS.axes.y2.ticker=Dygraph.numericTicks)}(),Dygraph.Plugins={},Dygraph.Plugins.Annotations=function(){"use strict";var t=function(){this.annotations_=[]};return t.prototype.toString=function(){return"Annotations Plugin"},t.prototype.activate=function(){return{clearChart:this.clearChart,didDrawChart:this.didDrawChart}},t.prototype.detachLabels=function(){for(var t=0;ts.x+s.w||h.canvasys.y+s.h)){var p=h.annotation,d=6;p.hasOwnProperty("tickHeight")&&(d=p.tickHeight);var u=document.createElement("div");for(var g in r)r.hasOwnProperty(g)&&(u.style[g]=r[g]);p.hasOwnProperty("icon")||(u.className="dygraphDefaultAnnotation"),p.hasOwnProperty("cssClass")&&(u.className+=" "+p.cssClass);var c=p.hasOwnProperty("width")?p.width:16,y=p.hasOwnProperty("height")?p.height:16;if(p.hasOwnProperty("icon")){var v=document.createElement("img");v.src=p.icon,v.width=c,v.height=y,u.appendChild(v)}else h.annotation.hasOwnProperty("shortText")&&u.appendChild(document.createTextNode(h.annotation.shortText));var _=h.canvasx-c/2;u.style.left=_+"px";var f=0;if(p.attachAtBottom){var x=s.y+s.h-y-d;o[_]?x-=o[_]:o[_]=0,o[_]+=d+y,f=x}else f=h.canvasy-y-d;u.style.top=f+"px",u.style.width=c+"px",u.style.height=y+"px",u.title=h.annotation.text,u.style.color=e.colorsMap_[h.name],u.style.borderColor=e.colorsMap_[h.name],p.div=u,e.addAndTrackEvent(u,"click",n("clickHandler","annotationClickHandler",h,this)),e.addAndTrackEvent(u,"mouseover",n("mouseOverHandler","annotationMouseOverHandler",h,this)),e.addAndTrackEvent(u,"mouseout",n("mouseOutHandler","annotationMouseOutHandler",h,this)),e.addAndTrackEvent(u,"dblclick",n("dblClickHandler","annotationDblClickHandler",h,this)),i.appendChild(u),this.annotations_.push(u);var m=t.drawingContext;if(m.save(),m.strokeStyle=e.colorsMap_[h.name],m.beginPath(),p.attachAtBottom){var x=f+y;m.moveTo(h.canvasx,x),m.lineTo(h.canvasx,x+d)}else m.moveTo(h.canvasx,h.canvasy),m.lineTo(h.canvasx,h.canvasy-2-d);m.closePath(),m.stroke(),m.restore()}}},t.prototype.destroy=function(){this.detachLabels()},t}(),Dygraph.Plugins.Axes=function(){"use strict";var t=function(){this.xlabels_=[],this.ylabels_=[]};return t.prototype.toString=function(){return"Axes Plugin"},t.prototype.activate=function(){return{layout:this.layout,clearChart:this.clearChart,willDrawChart:this.willDrawChart}},t.prototype.layout=function(t){var e=t.dygraph;if(e.getOption("drawYAxis")){var a=e.getOption("yAxisLabelWidth")+2*e.getOption("axisTickSize");t.reserveSpaceLeft(a)}if(e.getOption("drawXAxis")){var i;i=e.getOption("xAxisHeight")?e.getOption("xAxisHeight"):e.getOptionForAxis("axisLabelFontSize","x")+2*e.getOption("axisTickSize"),t.reserveSpaceBottom(i)}if(2==e.numAxes()){if(e.getOption("drawYAxis")){var a=e.getOption("yAxisLabelWidth")+2*e.getOption("axisTickSize");t.reserveSpaceRight(a)}}else e.numAxes()>2&&e.error("Only two y-axes are supported at this time. (Trying to use "+e.numAxes()+")")},t.prototype.detachLabels=function(){function t(t){for(var e=0;e0){var f=i.numAxes();for(l=0;lw&&(w=0),w+b+3>u?r.style.bottom="0px":r.style.top=w+"px",0===o[0]?(r.style.left=_.x-i.getOption("yAxisLabelWidth")-i.getOption("axisTickSize")+"px",r.style.textAlign="right"):1==o[0]&&(r.style.left=_.x+_.w+i.getOption("axisTickSize")+"px",r.style.textAlign="left"),r.style.width=i.getOption("yAxisLabelWidth")+"px",p.appendChild(r),this.ylabels_.push(r)}var D=this.ylabels_[0],b=i.getOptionForAxis("axisLabelFontSize","y"),A=parseInt(D.style.top,10)+b;A>u-b&&(D.style.top=parseInt(D.style.top,10)-b/2+"px")}var P;if(i.getOption("drawAxesAtZero")){var T=i.toPercentXCoord(0);(T>1||0>T||isNaN(T))&&(T=0),P=e(_.x+T*_.w)}else P=e(_.x);h.strokeStyle=i.getOptionForAxis("axisLineColor","y"),h.lineWidth=i.getOptionForAxis("axisLineWidth","y"),h.beginPath(),h.moveTo(P,a(_.y)),h.lineTo(P,a(_.y+_.h)),h.closePath(),h.stroke(),2==i.numAxes()&&(h.strokeStyle=i.getOptionForAxis("axisLineColor","y2"),h.lineWidth=i.getOptionForAxis("axisLineWidth","y2"),h.beginPath(),h.moveTo(a(_.x+_.w),a(_.y)),h.lineTo(a(_.x+_.w),a(_.y+_.h)),h.closePath(),h.stroke())}if(i.getOption("drawXAxis")){if(v.xticks)for(l=0;ld&&(C=d-i.getOption("xAxisLabelWidth"),r.style.textAlign="right"),0>C&&(C=0,r.style.textAlign="left"),r.style.left=C+"px",r.style.width=i.getOption("xAxisLabelWidth")+"px",p.appendChild(r),this.xlabels_.push(r)}h.strokeStyle=i.getOptionForAxis("axisLineColor","x"),h.lineWidth=i.getOptionForAxis("axisLineWidth","x"),h.beginPath();var S;if(i.getOption("drawAxesAtZero")){var T=i.toPercentYCoord(0,0);(T>1||0>T)&&(T=1),S=a(_.y+T*_.h)}else S=a(_.y+_.h);h.moveTo(e(_.x),S),h.lineTo(e(_.x+_.w),S),h.closePath(),h.stroke()}h.restore()}},t}(),Dygraph.Plugins.ChartLabels=function(){"use strict";var t=function(){this.title_div_=null,this.xlabel_div_=null,this.ylabel_div_=null,this.y2label_div_=null};t.prototype.toString=function(){return"ChartLabels Plugin"},t.prototype.activate=function(){return{layout:this.layout,didDrawChart:this.didDrawChart}};var e=function(t){var e=document.createElement("div");return e.style.position="absolute",e.style.left=t.x+"px",e.style.top=t.y+"px",e.style.width=t.w+"px",e.style.height=t.h+"px",e};t.prototype.detachLabels_=function(){for(var t=[this.title_div_,this.xlabel_div_,this.ylabel_div_,this.y2label_div_],e=0;e=2);for(s=h.yticks,l.save(),n=0;n=2;for(y&&l.installPattern(v),l.strokeStyle=o.getOptionForAxis("gridLineColor","x"),l.lineWidth=o.getOptionForAxis("gridLineWidth","x"),n=0;n":" "),h=t.getOption("strokePattern",p[o]),l=a(h,d.color,r),n+=""+l+" "+p[o]+"")}return n}var u=t.optionsViewForAxis_("x"),g=u("valueFormatter");n=g(e,u,p[0],t),""!==n&&(n+=":");var c=[],y=t.numAxes();for(o=0;y>o;o++)c[o]=t.optionsViewForAxis_("y"+(o?1+o:""));var v=t.getOption("labelsShowZeroValues");s=t.getOption("labelsSeparateLines");var _=t.getHighlightSeries();for(o=0;o");var d=t.getPropertiesForSeries(f.name),x=c[d.axis-1],m=x("valueFormatter"),b=m(f.yval,x,f.name,t),w=f.name==_?" class='highlight'":"";n+=""+" "+f.name+": "+b+""}}return n},a=function(t,e,a){var i=/MSIE/.test(navigator.userAgent)&&!window.opera;if(i)return"—";if(!t||t.length<=1)return'
'; +var r,n,s,o,l,h=0,p=0,d=[];for(r=0;r<=t.length;r++)h+=t[r%t.length];if(l=Math.floor(a/(h-t[0])),l>1){for(r=0;rn;n++)for(r=0;p>r;r+=2)s=d[r%d.length],o=r';return u},t}(),Dygraph.Plugins.RangeSelector=function(){"use strict";var t=function(){this.isIE_=/MSIE/.test(navigator.userAgent)&&!window.opera,this.hasTouchInterface_="undefined"!=typeof TouchEvent,this.isMobileDevice_=/mobile|android/gi.test(navigator.appVersion),this.interfaceCreated_=!1};return t.prototype.toString=function(){return"RangeSelector Plugin"},t.prototype.activate=function(t){return this.dygraph_=t,this.isUsingExcanvas_=t.isUsingExcanvas_,this.getOption_("showRangeSelector")&&this.createInterface_(),{layout:this.reserveSpace_,predraw:this.renderStaticLayer_,didDrawChart:this.renderInteractiveLayer_}},t.prototype.destroy=function(){this.bgcanvas_=null,this.fgcanvas_=null,this.leftZoomHandle_=null,this.rightZoomHandle_=null,this.iePanOverlay_=null},t.prototype.getOption_=function(t){return this.dygraph_.getOption(t)},t.prototype.setDefaultOption_=function(t,e){return this.dygraph_.attrs_[t]=e},t.prototype.createInterface_=function(){this.createCanvases_(),this.isUsingExcanvas_&&this.createIEPanOverlay_(),this.createZoomHandles_(),this.initInteraction_(),this.getOption_("animatedZooms")&&(Dygraph.warn("Animated zooms and range selector are not compatible; disabling animatedZooms."),this.dygraph_.updateOptions({animatedZooms:!1},!0)),this.interfaceCreated_=!0,this.addToGraph_()},t.prototype.addToGraph_=function(){var t=this.graphDiv_=this.dygraph_.graphDiv;t.appendChild(this.bgcanvas_),t.appendChild(this.fgcanvas_),t.appendChild(this.leftZoomHandle_),t.appendChild(this.rightZoomHandle_)},t.prototype.removeFromGraph_=function(){var t=this.graphDiv_;t.removeChild(this.bgcanvas_),t.removeChild(this.fgcanvas_),t.removeChild(this.leftZoomHandle_),t.removeChild(this.rightZoomHandle_),this.graphDiv_=null},t.prototype.reserveSpace_=function(t){this.getOption_("showRangeSelector")&&t.reserveSpaceBottom(this.getOption_("rangeSelectorHeight")+4)},t.prototype.renderStaticLayer_=function(){this.updateVisibility_()&&(this.resize_(),this.drawStaticLayer_())},t.prototype.renderInteractiveLayer_=function(){this.updateVisibility_()&&!this.isChangingRange_&&(this.placeZoomHandles_(),this.drawInteractiveLayer_())},t.prototype.updateVisibility_=function(){var t=this.getOption_("showRangeSelector");if(t)this.interfaceCreated_?this.graphDiv_&&this.graphDiv_.parentNode||this.addToGraph_():this.createInterface_();else if(this.graphDiv_){this.removeFromGraph_();var e=this.dygraph_;setTimeout(function(){e.width_=0,e.resize()},1)}return t},t.prototype.resize_=function(){function t(t,e){t.style.top=e.y+"px",t.style.left=e.x+"px",t.width=e.w,t.height=e.h,t.style.width=t.width+"px",t.style.height=t.height+"px"}var e=this.dygraph_.layout_.getPlotArea(),a=0;this.getOption_("drawXAxis")&&(a=this.getOption_("xAxisHeight")||this.getOption_("axisLabelFontSize")+2*this.getOption_("axisTickSize")),this.canvasRect_={x:e.x,y:e.y+e.h+a+4,w:e.w,h:this.getOption_("rangeSelectorHeight")},t(this.bgcanvas_,this.canvasRect_),t(this.fgcanvas_,this.canvasRect_)},t.prototype.createCanvases_=function(){this.bgcanvas_=Dygraph.createCanvas(),this.bgcanvas_.className="dygraph-rangesel-bgcanvas",this.bgcanvas_.style.position="absolute",this.bgcanvas_.style.zIndex=9,this.bgcanvas_ctx_=Dygraph.getContext(this.bgcanvas_),this.fgcanvas_=Dygraph.createCanvas(),this.fgcanvas_.className="dygraph-rangesel-fgcanvas",this.fgcanvas_.style.position="absolute",this.fgcanvas_.style.zIndex=9,this.fgcanvas_.style.cursor="default",this.fgcanvas_ctx_=Dygraph.getContext(this.fgcanvas_)},t.prototype.createIEPanOverlay_=function(){this.iePanOverlay_=document.createElement("div"),this.iePanOverlay_.style.position="absolute",this.iePanOverlay_.style.backgroundColor="white",this.iePanOverlay_.style.filter="alpha(opacity=0)",this.iePanOverlay_.style.display="none",this.iePanOverlay_.style.cursor="move",this.fgcanvas_.appendChild(this.iePanOverlay_)},t.prototype.createZoomHandles_=function(){var t=new Image;t.className="dygraph-rangesel-zoomhandle",t.style.position="absolute",t.style.zIndex=10,t.style.visibility="hidden",t.style.cursor="col-resize",/MSIE 7/.test(navigator.userAgent)?(t.width=7,t.height=14,t.style.backgroundColor="white",t.style.border="1px solid #333333"):(t.width=9,t.height=16,t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAAzwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7sqSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII="),this.isMobileDevice_&&(t.width*=2,t.height*=2),this.leftZoomHandle_=t,this.rightZoomHandle_=t.cloneNode(!1)},t.prototype.initInteraction_=function(){var t,e,a,i,r,n,s,o,l,h,p,d,u,g,c=this,y=this.isIE_?document:window,v=0,_=null,f=!1,x=!1,m=!this.isMobileDevice_&&!this.isUsingExcanvas_,b=new Dygraph.IFrameTarp;t=function(t){var e=c.dygraph_.xAxisExtremes(),a=(e[1]-e[0])/c.canvasRect_.w,i=e[0]+(t.leftHandlePos-c.canvasRect_.x)*a,r=e[0]+(t.rightHandlePos-c.canvasRect_.x)*a;return[i,r]},e=function(t){return Dygraph.cancelEvent(t),f=!0,v=t.clientX,_=t.target?t.target:t.srcElement,("mousedown"===t.type||"dragstart"===t.type)&&(Dygraph.addEvent(y,"mousemove",a),Dygraph.addEvent(y,"mouseup",i)),c.fgcanvas_.style.cursor="col-resize",b.cover(),!0},a=function(t){if(!f)return!1;Dygraph.cancelEvent(t);var e=t.clientX-v;if(Math.abs(e)<4)return!0;v=t.clientX;var a,i=c.getZoomHandleStatus_();_==c.leftZoomHandle_?(a=i.leftHandlePos+e,a=Math.min(a,i.rightHandlePos-_.width-3),a=Math.max(a,c.canvasRect_.x)):(a=i.rightHandlePos+e,a=Math.min(a,c.canvasRect_.x+c.canvasRect_.w),a=Math.max(a,i.leftHandlePos+_.width+3));var n=_.width/2;return _.style.left=a-n+"px",c.drawInteractiveLayer_(),m&&r(),!0},i=function(){return f?(f=!1,b.uncover(),Dygraph.removeEvent(y,"mousemove",a),Dygraph.removeEvent(y,"mouseup",i),c.fgcanvas_.style.cursor="default",m||r(),!0):!1},r=function(){try{var e=c.getZoomHandleStatus_();if(c.isChangingRange_=!0,e.isZoomed){var a=t(e);c.dygraph_.doZoomXDates_(a[0],a[1])}else c.dygraph_.resetZoom()}finally{c.isChangingRange_=!1}},n=function(t){if(c.isUsingExcanvas_)return t.srcElement==c.iePanOverlay_;var e=c.leftZoomHandle_.getBoundingClientRect(),a=e.left+e.width/2;e=c.rightZoomHandle_.getBoundingClientRect();var i=e.left+e.width/2;return t.clientX>a&&t.clientX=c.canvasRect_.x+c.canvasRect_.w?(r=c.canvasRect_.x+c.canvasRect_.w,i=r-n):(i+=e,r+=e);var s=c.leftZoomHandle_.width/2;return c.leftZoomHandle_.style.left=i-s+"px",c.rightZoomHandle_.style.left=r-s+"px",c.drawInteractiveLayer_(),m&&h(),!0},l=function(){return x?(x=!1,Dygraph.removeEvent(y,"mousemove",o),Dygraph.removeEvent(y,"mouseup",l),m||h(),!0):!1},h=function(){try{c.isChangingRange_=!0,c.dygraph_.dateWindow_=t(c.getZoomHandleStatus_()),c.dygraph_.drawGraph_(!1)}finally{c.isChangingRange_=!1}},p=function(t){if(!f&&!x){var e=n(t)?"move":"default";e!=c.fgcanvas_.style.cursor&&(c.fgcanvas_.style.cursor=e)}},d=function(t){"touchstart"==t.type&&1==t.targetTouches.length?e(t.targetTouches[0])&&Dygraph.cancelEvent(t):"touchmove"==t.type&&1==t.targetTouches.length?a(t.targetTouches[0])&&Dygraph.cancelEvent(t):i(t)},u=function(t){"touchstart"==t.type&&1==t.targetTouches.length?s(t.targetTouches[0])&&Dygraph.cancelEvent(t):"touchmove"==t.type&&1==t.targetTouches.length?o(t.targetTouches[0])&&Dygraph.cancelEvent(t):l(t)},g=function(t,e){for(var a=["touchstart","touchend","touchmove","touchcancel"],i=0;i1&&null!==l[i][1]){if(a="number"!=typeof l[i][1])for(t=[],e=[],n=0;n0)&&(g=Math.min(g,o),c=Math.max(c,o));var y=.25;if(h)for(c=Dygraph.log10(c),c+=c*y,g=Dygraph.log10(g),i=0;ithis.canvasRect_.x||a+1