stop exporting _calcYNormal
authorDan Vanderkam <danvdk@gmail.com>
Sun, 21 Jul 2013 15:14:36 +0000 (11:14 -0400)
committerDan Vanderkam <danvdk@gmail.com>
Sun, 21 Jul 2013 15:14:36 +0000 (11:14 -0400)
dygraph-combined.js
dygraph-layout.js

index e6380de..95ce938 100644 (file)
@@ -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;i<a.length;i++)for(var o=a[i],l=o[0][0],h=o[0][1],p=1;p<o.length;p++){var d=o[p][0],u=o[p][1];this.save();var g=d-l,c=u-h,y=Math.sqrt(g*g+c*c),v=Math.atan2(c,g);this.translate(l,h),n.call(this,0,0),this.rotate(v);for(var _=e[0],f=0;y>f;){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;r<this.labels_.length;r++){var n=this.labels_[r],s=this.user_[n]||{},o=0,l=s.axis;"object"==typeof l&&(o=++i,this.yAxes_[o]={series:[n],options:l}),l||this.yAxes_[0].series.push(n),this.series_[n]={idx:r,yAxis:o,options:s}}for(var r=0;r<this.labels_.length;r++){var n=this.labels_[r],s=this.series_[n].options,l=s.axis;if("string"==typeof l){if(!this.series_.hasOwnProperty(l))return Dygraph.error("Series "+n+" wants to share a y-axis with "+"series "+l+", which does not define its own axis."),void 0;var o=this.series_[l].yAxis;this.series_[n].yAxis=o,this.yAxes_[o].series.push(n)}}}else for(var r=0;r<this.labels_.length;r++){var n=this.labels_[r],s=this.user_.series[n]||{},o=a(s.axis);this.series_[n]={idx:r,yAxis:o,options:s},this.yAxes_[o]?this.yAxes_[o].series.push(n):this.yAxes_[o]={series:[n],options:{}}}var h=this.user_.axes||{};Dygraph.update(this.yAxes_[0].options,h.y||{}),this.yAxes_.length>1&&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<t.length;a++){var i={};if(!t[a].xval&&void 0===t[a].x)return Dygraph.error("Annotations must have an 'x' property"),void 0;if(t[a].icon&&(!t[a].hasOwnProperty("width")||!t[a].hasOwnProperty("height")))return Dygraph.error("Must set width and height when setting annotation.icon property"),void 0;Dygraph.update(i,t[a]),i.xval||(i.xval=e(i.x)),this.annotations.push(i)}},DygraphLayout.prototype.setXTicks=function(t){this.xTicks_=t},DygraphLayout.prototype.setYAxes=function(t){this.yAxes_=t},DygraphLayout.prototype.evaluate=function(){this._evaluateLimits(),this._evaluateLineCharts(),this._evaluateLineTicks(),this._evaluateAnnotations()},DygraphLayout.prototype._evaluateLimits=function(){var t=this.dygraph_.xAxisRange();this.minxval=t[0],this.maxxval=t[1];var e=t[1]-t[0];this.xscale=0!==e?1/e:1;for(var a=0;a<this.yAxes_.length;a++){var i=this.yAxes_[a];i.minyval=i.computedValueRange[0],i.maxyval=i.computedValueRange[1],i.yrange=i.maxyval-i.minyval,i.yscale=0!==i.yrange?1/i.yrange:1,i.g.attr_("logscale")&&(i.ylogrange=Dygraph.log10(i.maxyval)-Dygraph.log10(i.minyval),i.ylogscale=0!==i.ylogrange?1/i.ylogrange:1,(!isFinite(i.ylogrange)||isNaN(i.ylogrange))&&Dygraph.error("axis "+a+" of graph at "+i.g+" can't be displayed in log scale for range ["+i.minyval+" - "+i.maxyval+"]"))}},DygraphLayout._calcYNormal=function(t,e,a){return a?1-(Dygraph.log10(e)-Dygraph.log10(t.minyval))*t.ylogscale:1-(e-t.minyval)*t.yscale},DygraphLayout.prototype._evaluateLineCharts=function(){for(var t=this.attr_("connectSeparatedPoints"),e=this.attr_("stackedGraph"),a=this.attr_("errorBars")||this.attr_("customBars"),i=0;i<this.points.length;i++)for(var r=this.points[i],n=this.setNames[i],s=this.dygraph_.axisPropertiesForSeries(n),o=this.dygraph_.attributes_.getForSeries("logscale",n),l=0;l<r.length;l++){var h=r[l];h.x=(h.xval-this.minxval)*this.xscale;var p=h.yval;e&&(h.y_stacked=DygraphLayout._calcYNormal(s,h.yval_stacked,o),null===p||isNaN(p)||(p=h.yval_stacked)),null===p&&(p=0/0,t||(h.yval=0/0)),h.y=DygraphLayout._calcYNormal(s,p,o),a&&(h.y_top=DygraphLayout._calcYNormal(s,p-h.yval_minus,o),h.y_bottom=DygraphLayout._calcYNormal(s,p+h.yval_plus,o))}},DygraphLayout.prototype._evaluateLineTicks=function(){var t,e,a,i;for(this.xticks=[],t=0;t<this.xTicks_.length;t++)e=this.xTicks_[t],a=e.label,i=this.xscale*(e.v-this.minxval),i>=0&&1>=i&&this.xticks.push([i,a]);for(this.yticks=[],t=0;t<this.yAxes_.length;t++)for(var r=this.yAxes_[t],n=0;n<r.ticks.length;n++)e=r.ticks[n],a=e.label,i=this.dygraph_.toPercentYCoord(e.v,t),i>=0&&1>=i&&this.yticks.push([t,i,a])},DygraphLayout.prototype._evaluateAnnotations=function(){var t,e={};for(t=0;t<this.annotations.length;t++){var a=this.annotations[t];e[a.xval+","+a.series]=a}if(this.annotated_points=[],this.annotations&&this.annotations.length)for(var i=0;i<this.points.length;i++){var r=this.points[i];for(t=0;t<r.length;t++){var n=r[t],s=n.xval+","+n.name;s in e&&(n.annotation=e[s],this.annotated_points.push(n))}}},DygraphLayout.prototype.removeAllDatasets=function(){delete this.points,delete this.setNames,delete this.setPointsLengths,delete this.setPointsOffsets,this.points=[],this.setNames=[],this.setPointsLengths=[],this.setPointsOffsets=[]};var DygraphCanvasRenderer=function(){"use strict";var t,e,a,i,r,n,s,o,l=function(e,a,i,r){if(this.dygraph_=e,this.layout=r,this.element=a,this.elementContext=i,this.container=this.element.parentNode,this.height=this.element.height,this.width=this.element.width,!this.isIE&&!t(this.element))throw"Canvas is not supported.";if(this.area=r.getPlotArea(),this.container.style.position="relative",this.container.style.width=this.width+"px",this.dygraph_.isUsingExcanvas_)this._createIEClipArea();else if(!Dygraph.isAndroid()){var n=this.dygraph_.canvas_ctx_;n.beginPath(),n.rect(this.area.x,this.area.y,this.area.w,this.area.h),n.clip(),n=this.dygraph_.hidden_ctx_,n.beginPath(),n.rect(this.area.x,this.area.y,this.area.w,this.area.h),n.clip()}};l.prototype.clear=function(){var t;if(this.isIE)try{this.clearDelay&&(this.clearDelay.cancel(),this.clearDelay=null),t=this.elementContext}catch(e){return}t=this.elementContext,t.clearRect(0,0,this.width,this.height)},t=function(t){var e=null;try{e="undefined"==typeof t||null===t?document.createElement("canvas"):t,e.getContext("2d")}catch(a){var i=navigator.appVersion.match(/MSIE (\d\.\d)/),r=-1!=navigator.userAgent.toLowerCase().indexOf("opera");return!i||i[1]<6||r?!1:!0}return!0},l.prototype.render=function(){this._updatePoints(),this._renderLineChart()},l.prototype._createIEClipArea=function(){function t(t){if(0!==t.w&&0!==t.h){var i=document.createElement("div");i.className=e,i.style.backgroundColor=r,i.style.position="absolute",i.style.left=t.x+"px",i.style.top=t.y+"px",i.style.width=t.w+"px",i.style.height=t.h+"px",a.appendChild(i)}}for(var e="dygraph-clip-div",a=this.dygraph_.graphDiv,i=a.childNodes.length-1;i>=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<e.length;s++){var o=e[s];n.save(),a(t.dygraph,t.setName,n,o[0],o[1],i,r,o[2]),n.restore()}},l.prototype._updatePoints=function(){for(var t=this.layout.points,e=t.length;e--;)for(var a=t[e],i=a.length;i--;){var r=a[i];r.canvasx=this.area.w*r.x+this.area.x,r.canvasy=this.area.h*r.y+this.area.y}},l.prototype._renderLineChart=function(t,e){var a,i,r=e||this.elementContext,n=this.layout.points,s=this.layout.setNames;this.colors=this.dygraph_.colorsMap_;var o=this.dygraph_.attr_("plotter"),l=o;Dygraph.isArrayLike(l)||(l=[l]);var h={};for(a=0;a<s.length;a++){i=s[a];var p=this.dygraph_.attr_("plotter",i);p!=o&&(h[i]=p)}for(a=0;a<l.length;a++)for(var d=l[a],u=a==l.length-1,g=0;g<n.length;g++)if(i=s[g],!t||i==t){var c=n[g],y=d;if(i in h){if(!u)continue;y=h[i]}var v=this.colors[i],_=this.dygraph_.getOption("strokeWidth",i);r.save(),r.strokeStyle=v,r.lineWidth=_,y({points:c,setName:i,drawingContext:r,color:v,strokeWidth:_,dygraph:this.dygraph_,axis:this.dygraph_.axisPropertiesForSeries(i),plotArea:this.area,seriesIndex:g,seriesCount:n.length,singleSeriesName:t,allSeriesPoints:n}),r.restore()}},n=function(t){var e=t.dygraph,a=t.setName,i=t.strokeWidth,r=e.getOption("strokeBorderWidth",a),n=e.getOption("drawPointCallback",a)||Dygraph.Circles.DEFAULT,s=e.getOption("strokePattern",a),o=e.getOption("drawPoints",a),l=e.getOption("pointSize",a);r&&i&&h(t,e.getOption("strokeBorderColor",a),i+2*r,s,o,n,l),h(t,t.color,i,s,o,n,l)},o=function(t){var a=t.dygraph,i=t.setName,r=a.getOption("errorBars")||a.getOption("customBars");if(r){var n=a.getOption("fillGraph",i);n&&Dygraph.warn("Can't use fillGraph option with error bars");var s,o=t.drawingContext,l=t.color,h=a.getOption("fillAlpha",i),p=a.getOption("stepPlot",i),d=t.points,u=Dygraph.createIterator(d,0,d.length,e(a.getOption("connectSeparatedPoints"))),g=0/0,c=0/0,y=[-1,-1],v=Dygraph.toRGB_(l),_="rgba("+v.r+","+v.g+","+v.b+","+h+")";o.fillStyle=_,o.beginPath();for(var f=function(t){return null===t||void 0===t||isNaN(t)};u.hasNext;){var x=u.next();!p&&f(x.y)||p&&!isNaN(c)&&f(c)?g=0/0:(p?(s=[x.y_bottom,x.y_top],c=x.y):s=[x.y_bottom,x.y_top],s[0]=t.plotArea.h*s[0]+t.plotArea.y,s[1]=t.plotArea.h*s[1]+t.plotArea.y,isNaN(g)||(p?(o.moveTo(g,y[0]),o.lineTo(x.canvasx,y[0]),o.lineTo(x.canvasx,y[1])):(o.moveTo(g,y[0]),o.lineTo(x.canvasx,s[0]),o.lineTo(x.canvasx,s[1])),o.lineTo(g,y[1]),o.closePath()),y=s,g=x.canvasx)}o.fill()}},s=function(t){if(!t.singleSeriesName&&0===t.seriesIndex){for(var a=t.dygraph,i=a.getLabels().slice(1),r=i.length;r>=0;r--)a.visibility()[r]||i.splice(r,1);var n=function(){for(var t=0;t<i.length;t++)if(a.getOption("fillGraph",i[t]))return!0;return!1}();if(n)for(var s,o,l=t.drawingContext,h=t.plotArea,p=t.allSeriesPoints,d=p.length,u=a.getOption("fillAlpha"),g=a.getOption("stackedGraph"),c=a.getColors(),y={},v=d-1;v>=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)<Math.pow(10,-n))?e.toExponential(n):""+t.round_(e,n),p||d){var u,g=[],c=[];p&&(u=1e3,g=s),d&&(p&&t.warn("Setting both labelsKMB and labelsKMG2. Pick one!"),u=1024,g=o,c=l);for(var y=Math.abs(e),v=t.pow(u,g.length),_=g.length-1;_>=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<i.length;s++)n.push(i[s]);t.update(r,{labels:n})}this.__init__(e,a,r)},t.prototype.__init__=function(r,n,s){if(/MSIE/.test(navigator.userAgent)&&!window.opera&&"undefined"!=typeof G_vmlCanvasManager&&"complete"!=document.readyState){var o=this;return setTimeout(function(){o.__init__(r,n,s)},100),void 0}if((null===s||void 0===s)&&(s={}),s=t.mapLegacyOptions_(s),"string"==typeof r&&(r=document.getElementById(r)),!r)return t.error("Constructing dygraph with a non-existent div!"),void 0;this.isUsingExcanvas_="undefined"!=typeof G_vmlCanvasManager,this.maindiv_=r,this.file_=n,this.rollPeriod_=s.rollPeriod||e,this.previousVerticalX_=-1,this.fractions_=s.fractions||!1,this.dateWindow_=s.dateWindow||null,this.is_initial_draw_=!0,this.annotations_=[],this.zoomed_x_=!1,this.zoomed_y_=!1,r.innerHTML="",""===r.style.width&&s.width&&(r.style.width=s.width+"px"),""===r.style.height&&s.height&&(r.style.height=s.height+"px"),""===r.style.height&&0===r.clientHeight&&(r.style.height=i+"px",""===r.style.width&&(r.style.width=a+"px")),this.width_=r.clientWidth||s.width||0,this.height_=r.clientHeight||s.height||0,s.stackedGraph&&(s.fillGraph=!0),this.user_attrs_={},t.update(this.user_attrs_,s),this.attrs_={},t.updateDeep(this.attrs_,t.DEFAULT_ATTRS),this.boundaryIds_=[],this.setIndexByName_={},this.datasetIndex_=[],this.registeredEvents_=[],this.eventListeners_={},this.attributes_=new DygraphOptions(this),this.createInterface_(),this.plugins_=[];for(var l=t.PLUGINS.concat(this.getOption("plugins")),h=0;h<l.length;h++){var p=l[h],d=new p,u={plugin:d,events:{},options:{},pluginOptions:{}},g=d.activate(this);for(var c in g)u.events[c]=g[c];this.plugins_.push(u)}for(var h=0;h<this.plugins_.length;h++){var y=this.plugins_[h];for(var c in y.events)if(y.events.hasOwnProperty(c)){var v=y.events[c],_=[y.plugin,v];c in this.eventListeners_?this.eventListeners_[c].push(_):this.eventListeners_[c]=[_]}}this.createDragInterface_(),this.start_()},t.prototype.cascadeEvents_=function(e,a){if(!(e in this.eventListeners_))return!0;var i={dygraph:this,cancelable:!1,defaultPrevented:!1,preventDefault:function(){if(!i.cancelable)throw"Cannot call preventDefault on non-cancelable event.";i.defaultPrevented=!0},propagationStopped:!1,stopPropagation:function(){i.propagationStopped=!0}};t.update(i,a);var r=this.eventListeners_[e];if(r)for(var n=r.length-1;n>=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;e<this.axes_.length;e++)t.push(this.yAxisRange(e));return t},t.prototype.toDomCoords=function(t,e,a){return[this.toDomXCoord(t),this.toDomYCoord(e,a)]},t.prototype.toDomXCoord=function(t){if(null===t)return null;var e=this.plotter_.area,a=this.xAxisRange();return e.x+(t-a[0])/(a[1]-a[0])*e.w},t.prototype.toDomYCoord=function(t,e){var a=this.toPercentYCoord(t,e);if(null===a)return null;var i=this.plotter_.area;return i.y+a*i.h},t.prototype.toDataCoords=function(t,e,a){return[this.toDataXCoord(t),this.toDataYCoord(e,a)]},t.prototype.toDataXCoord=function(t){if(null===t)return null;var e=this.plotter_.area,a=this.xAxisRange();return a[0]+(t-e.x)/e.w*(a[1]-a[0])},t.prototype.toDataYCoord=function(e,a){if(null===e)return null;var i=this.plotter_.area,r=this.yAxisRange(a);if("undefined"==typeof a&&(a=0),this.axes_[a].logscale){var n=(e-i.y)/i.h,s=t.log10(r[1]),o=s-n*(s-t.log10(r[0])),l=Math.pow(10,o);return l}return r[0]+(i.y+i.h-e)/i.h*(r[1]-r[0])},t.prototype.toPercentYCoord=function(e,a){if(null===e)return null;"undefined"==typeof a&&(a=0);var i,r=this.yAxisRange(a),n=this.attributes_.getForAxis("logscale",a);if(n){var s=t.log10(r[1]);i=(s-t.log10(e))/(s-t.log10(r[0]))}else i=(r[1]-e)/(r[1]-r[0]);return i},t.prototype.toPercentXCoord=function(t){if(null===t)return null;var e=this.xAxisRange();return(t-e[0])/(e[1]-e[0])},t.prototype.numColumns=function(){return this.rawData_?this.rawData_[0]?this.rawData_[0].length:this.attr_("labels").length:0},t.prototype.numRows=function(){return this.rawData_?this.rawData_.length:0},t.prototype.getValue=function(t,e){return 0>t||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<a.length;i++)if(a[i]==t){e=i;break}return-1==e?null:{name:t,column:e,visible:this.visibility()[e-1],color:this.colorsMap_[t],axis:1+this.attributes_.axisForSeries(t)}},t.prototype.createRollInterface_=function(){this.roller_||(this.roller_=document.createElement("input"),this.roller_.type="text",this.roller_.style.display="none",this.graphDiv.appendChild(this.roller_));var t=this.attr_("showRoller")?"block":"none",e=this.plotter_.area,a={position:"absolute",zIndex:10,top:e.y+e.h-25+"px",left:e.x+1+"px",display:t};this.roller_.size="2",this.roller_.value=this.rollPeriod_;for(var i in a)a.hasOwnProperty(i)&&(this.roller_.style[i]=a[i]);var r=this;this.roller_.onchange=function(){r.adjustRoll(r.roller_.value)}},t.prototype.dragGetX_=function(e,a){return t.pageX(e)-a.px},t.prototype.dragGetY_=function(e,a){return t.pageY(e)-a.py},t.prototype.createDragInterface_=function(){var e={isZooming:!1,isPanning:!1,is2DPan:!1,dragStartX:null,dragStartY:null,dragEndX:null,dragEndY:null,dragDirection:null,prevEndX:null,prevEndY:null,prevDragDirection:null,cancelNextDblclick:!1,initialLeftmostDate:null,xUnitsPerPixel:null,dateRange:null,px:0,py:0,boundedDates:null,boundedValues:null,tarp:new t.IFrameTarp,initializeMouseDown:function(e,a,i){e.preventDefault?e.preventDefault():(e.returnValue=!1,e.cancelBubble=!0);var r=t.findPos(a.canvas_);i.px=r.x,i.py=r.y,i.dragStartX=a.dragGetX_(e,i),i.dragStartY=a.dragGetY_(e,i),i.cancelNextDblclick=!1,i.tarp.cover()}},a=this.attr_("interactionModel"),i=this,r=function(t){return function(a){t(a,i,e)}};for(var n in a)a.hasOwnProperty(n)&&this.addAndTrackEvent(this.mouseEventElement_,n,r(a[n]));var s=function(){if((e.isZooming||e.isPanning)&&(e.isZooming=!1,e.dragStartX=null,e.dragStartY=null),e.isPanning){e.isPanning=!1,e.draggingDate=null,e.dateRange=null;for(var t=0;t<i.axes_.length;t++)delete i.axes_[t].draggingValue,delete i.axes_[t].dragValueRange}e.tarp.uncover()};this.addAndTrackEvent(document,"mouseup",s)},t.prototype.drawZoomRect_=function(t,e,a,i,r,n,s,o){var l=this.canvas_ctx_;n==d?l.clearRect(Math.min(e,s),this.layout_.getPlotArea().y,Math.abs(e-s),this.layout_.getPlotArea().h):n==u&&l.clearRect(this.layout_.getPlotArea().x,Math.min(i,o),this.layout_.getPlotArea().w,Math.abs(i-o)),t==d?a&&e&&(l.fillStyle="rgba(128,128,128,0.33)",l.fillRect(Math.min(e,a),this.layout_.getPlotArea().y,Math.abs(a-e),this.layout_.getPlotArea().h)):t==u&&r&&i&&(l.fillStyle="rgba(128,128,128,0.33)",l.fillRect(this.layout_.getPlotArea().x,Math.min(i,r),this.layout_.getPlotArea().w,Math.abs(r-i))),this.isUsingExcanvas_&&(this.currentZoomRectArgs_=[t,e,a,i,r,0,0,0])},t.prototype.clearZoomRect_=function(){this.currentZoomRectArgs_=null,this.canvas_ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height)},t.prototype.doZoomX_=function(t,e){this.currentZoomRectArgs_=null;var a=this.toDataXCoord(t),i=this.toDataXCoord(e);this.doZoomXDates_(a,i)},t.zoomAnimationFunction=function(t,e){var a=1.5;return(1-Math.pow(a,-t))/(1-Math.pow(a,-e))},t.prototype.doZoomXDates_=function(t,e){var a=this.xAxisRange(),i=[t,e];this.zoomed_x_=!0;var r=this;this.doAnimatedZoom(a,i,null,null,function(){r.attr_("zoomCallback")&&r.attr_("zoomCallback")(t,e,r.yAxisRanges())})},t.prototype.doZoomY_=function(t,e){this.currentZoomRectArgs_=null;for(var a=this.yAxisRanges(),i=[],r=0;r<this.axes_.length;r++){var n=this.toDataYCoord(t,r),s=this.toDataYCoord(e,r);i.push([s,n])}this.zoomed_y_=!0;var o=this;this.doAnimatedZoom(null,null,a,i,function(){if(o.attr_("zoomCallback")){var t=o.xAxisRange();o.attr_("zoomCallback")(t[0],t[1],o.yAxisRanges())}})},t.prototype.resetZoom=function(){var t=!1,e=!1,a=!1;
+null!==this.dateWindow_&&(t=!0,e=!0);for(var i=0;i<this.axes_.length;i++)"undefined"!=typeof this.axes_[i].valueWindow&&null!==this.axes_[i].valueWindow&&(t=!0,a=!0);if(this.clearSelection(),t){this.zoomed_x_=!1,this.zoomed_y_=!1;var r=this.rawData_[0][0],n=this.rawData_[this.rawData_.length-1][0];if(!this.attr_("animatedZooms")){for(this.dateWindow_=null,i=0;i<this.axes_.length;i++)null!==this.axes_[i].valueWindow&&delete this.axes_[i].valueWindow;return this.drawGraph_(),this.attr_("zoomCallback")&&this.attr_("zoomCallback")(r,n,this.yAxisRanges()),void 0}var s=null,o=null,l=null,h=null;if(e&&(s=this.xAxisRange(),o=[r,n]),a){l=this.yAxisRanges();var p=this.gatherDatasets_(this.rolledSeries_,null),d=p.extremes;for(this.computeYAxisRanges_(d),h=[],i=0;i<this.axes_.length;i++){var u=this.axes_[i];h.push(null!==u.valueRange&&void 0!==u.valueRange?u.valueRange:u.extremeRange)}}var g=this;this.doAnimatedZoom(s,o,l,h,function(){g.dateWindow_=null;for(var t=0;t<g.axes_.length;t++)null!==g.axes_[t].valueWindow&&delete g.axes_[t].valueWindow;g.attr_("zoomCallback")&&g.attr_("zoomCallback")(r,n,g.yAxisRanges())})}},t.prototype.doAnimatedZoom=function(e,a,i,s,o){var l,h,p=this.attr_("animatedZooms")?r:1,d=[],u=[];if(null!==e&&null!==a)for(l=1;p>=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;c<this.axes_.length;c++)g.push([i[c][0]*(1-h)+h*s[c][0],i[c][1]*(1-h)+h*s[c][1]]);u[l-1]=g}var y=this;t.repeatAndCleanup(function(t){if(u.length)for(var e=0;e<y.axes_.length;e++){var a=u[t][e];y.axes_[e].valueWindow=[a[0],a[1]]}d.length&&(y.dateWindow_=d[t]),y.drawGraph_()},p,n/p,o)},t.prototype.getArea=function(){return this.plotter_.area},t.prototype.eventToDomCoords=function(e){if(e.offsetX&&e.offsetY)return[e.offsetX,e.offsetY];var a=t.findPos(this.mouseEventElement_),i=t.pageX(e)-a.x,r=t.pageY(e)-a.y;return[i,r]},t.prototype.findClosestRow=function(e){for(var a=1/0,i=-1,r=this.layout_.points,n=0;n<r.length;n++)for(var s=r[n],o=s.length,l=0;o>l;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;g<u.length;++g)s=u[g],t.isValidPoint(s)&&(r=s.canvasx-e,n=s.canvasy-a,i=r*r+n*n,p>i&&(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<this.layout_.points.length;++s){var o=this.getLeftBoundary_(s),l=n-o,h=this.layout_.points[s];if(!(l>=h.length)){var p=h[l];if(t.isValidPoint(p)){var d=p.canvasy;if(e>p.canvasx&&l+1<h.length){var u=h[l+1];if(t.isValidPoint(u)){var g=u.canvasx-p.canvasx;if(g>0){var c=(e-p.canvasx)/g;d+=c*(u.canvasy-p.canvasy)}}}else if(e<p.canvasx&&l>0){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;e<this.boundaryIds_.length;e++)if(void 0!==this.boundaryIds_[e])return this.boundaryIds_[e][0];return 0},t.prototype.animateSelection_=function(e){var a=10,i=30;void 0===this.fadeLevel&&(this.fadeLevel=0),void 0===this.animateId&&(this.animateId=0);var r=this.fadeLevel,n=0>e?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;a<o.length;a++){var l=this.attr_("highlightCircleSize",o[a]);l>s&&(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<this.selPoints_.length;a++){var d=this.selPoints_[a];if(t.isOK(d.canvasy)){var u=this.attr_("highlightCircleSize",d.name),g=this.attr_("drawHighlightPointCallback",d.name),c=this.plotter_.colors[d.name];g||(g=t.Circles.DEFAULT),i.lineWidth=this.attr_("strokeWidth",d.name),i.strokeStyle=c,i.fillStyle=c,g(this.g,d.name,i,p,d.canvasy,c,u,d.idx)}}i.restore(),this.previousVerticalX_=p}},t.prototype.setSelection=function(t,e,a){this.selPoints_=[];var i=!1;if(t!==!1&&t>=0){t!=this.lastRow_&&(i=!0),this.lastRow_=t;for(var r=0;r<this.layout_.points.length;++r){var n=this.layout_.points[r],s=t-this.getLeftBoundary_(r);if(s<n.length){var o=n[s];null!==o.yval&&this.selPoints_.push(o)}}}else this.lastRow_>=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;t<this.layout_.points.length;t++)for(var e=this.layout_.points[t],a=0;a<e.length;a++)if(e[a].x==this.selPoints_[0].x)return e[a].idx;return-1},t.prototype.getHighlightSeries=function(){return this.highlightSet_},t.prototype.isSeriesLocked=function(){return this.lockedSet_},t.prototype.loadedEvent_=function(t){this.rawData_=this.parseCSV_(t),this.predraw_()},t.prototype.addXTicks_=function(){var t;t=this.dateWindow_?[this.dateWindow_[0],this.dateWindow_[1]]:this.xAxisExtremes();var e=this.optionsViewForAxis_("x"),a=e("ticker")(t[0],t[1],this.width_,e,this);this.layout_.setXTicks(a)},t.prototype.extremeValues_=function(t){var e,a,i=null,r=null,n=this.attr_("errorBars")||this.attr_("customBars");if(n){for(e=0;e<t.length;e++)if(a=t[e][1][0],null!==a&&!isNaN(a)){var s=a-t[e][1][1],o=a+t[e][1][2];s>a&&(s=a),a>o&&(o=a),(null===r||o>r)&&(r=o),(null===i||i>s)&&(i=s)}}else for(e=0;e<t.length;e++)a=t[e][1],null===a||isNaN(a)||((null===r||a>r)&&(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<this.numColumns();e++){var a=this.attr_("logscale"),i=this.extractSeries_(this.rawData_,e,a);i=this.rollingAverage(i,this.rollPeriod_),this.rolledSeries_.push(i)}this.drawGraph_();var r=new Date;this.drawingTimeMs_=r-t},t.PointType=void 0,t.seriesToPoints_=function(t,e,a,i){for(var r=[],n=0;n<t.length;++n){var s=t[n],o=e?s[1][0]:s[1],l=null===o?null:p(o),h={x:0/0,y:0/0,xval:p(s[0]),yval:l,name:a,idx:n+i};e&&(h.y_top=0/0,h.y_bottom=0/0,h.yval_minus=p(s[1][1]),h.yval_plus=p(s[1][2])),r.push(h)}return r},t.stackPoints_=function(t,e,a,i){for(var r=null,n=null,s=null,o=-1,l=function(e){if(!(o>=e))for(var a=e;a<t.length;++a)if(s=null,!isNaN(t[a].yval)&&null!==t[a].yval){o=a,s=t[a];break}},h=0;h<t.length;++h){var p=t[h],d=p.xval;void 0===e[d]&&(e[d]=0);var u=p.yval;isNaN(u)||null===u?(l(h),u=n&&s&&"none"!=i?n.yval+(s.yval-n.yval)*((d-n.xval)/(s.xval-n.xval)):n&&"all"==i?n.yval:s&&"all"==i?s.yval:0):n=p;var g=e[d];r!=d&&(g+=u,e[d]=g),r=d,p.yval_stacked=g,g>a[1]&&(a[1]=g),g<a[0]&&(a[0]=g)}},t.prototype.gatherDatasets_=function(e,a){var i,r,n,s=[],o=[],l=[],h={},p=this.attr_("errorBars"),d=this.attr_("customBars"),u=p||d,g=function(t){return u?d?null===t[1][1]:p?null===t[1][0]:!1:null===t[1]},c=e.length-1;for(i=c;i>=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<n.length;r++)n[r][0]>=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&&b<n.length-1;)b++,m=g(n[b]);x!==_&&(_=x),b!==f&&(f=b),s[i-1]=[_,f],n=n.slice(_,f+1)}else n=e[i],s[i-1]=[0,n.length-1];var w=this.attr_("labels")[i],D=this.extremeValues_(n),A=t.seriesToPoints_(n,u,w,s[i-1][0]);this.attr_("stackedGraph")&&t.stackPoints_(A,l,D,this.attr_("stackedGraphNaNFill")),h[w]=D,o[i]=A}return{points:o,extremes:h,boundaryIds:s}},t.prototype.drawGraph_=function(){var e=new Date,a=this.is_initial_draw_;this.is_initial_draw_=!1,this.layout_.removeAllDatasets(),this.setColors_(),this.attrs_.pointSize=.5*this.attr_("highlightCircleSize");var i=this.gatherDatasets_(this.rolledSeries_,this.dateWindow_),r=i.points,n=i.extremes;this.boundaryIds_=i.boundaryIds,this.setIndexByName_={};var s=this.attr_("labels");s.length>0&&(this.setIndexByName_[s[0]]=0);for(var o=0,l=1;l<r.length;l++)this.setIndexByName_[s[l]]=l,this.visibility()[l-1]&&(this.layout_.addDataset(s[l],r[l]),this.datasetIndex_[l]=o++);this.computeYAxisRanges_(n),this.layout_.setYAxes(this.axes_),this.addXTicks_();var h=this.zoomed_x_;if(this.zoomed_x_=h,this.layout_.evaluate(),this.renderGraph_(a),this.attr_("timingName")){var p=new Date;t.info(this.attr_("timingName")+" - drawGraph: "+(p-e)+"ms")}},t.prototype.renderGraph_=function(t){this.cascadeEvents_("clearChart"),this.plotter_.clear(),this.attr_("underlayCallback")&&this.attr_("underlayCallback")(this.hidden_ctx_,this.layout_.getPlotArea(),this,this);var e={canvas:this.hidden_,drawingContext:this.hidden_ctx_};this.cascadeEvents_("willDrawChart",e),this.plotter_.render(),this.cascadeEvents_("didDrawChart",e),this.lastRow_=-1,this.canvas_.getContext("2d").clearRect(0,0,this.canvas_.width,this.canvas_.height),null!==this.attr_("drawCallback")&&this.attr_("drawCallback")(this,t)},t.prototype.computeYAxes_=function(){var e,a,i,r,n;if(void 0!==this.axes_&&this.user_attrs_.hasOwnProperty("valueRange")===!1)for(e=[],i=0;i<this.axes_.length;i++)e.push(this.axes_[i].valueWindow);for(this.axes_=[],a=0;a<this.attributes_.numAxes();a++)r={g:this},t.update(r,this.attributes_.axisOptions(a)),this.axes_[a]=r;if(n=this.attr_("valueRange"),n&&(this.axes_[0].valueRange=n),void 0!==e){var s=Math.min(e.length,this.axes_.length);for(i=0;s>i;i++)this.axes_[i].valueWindow=e[i]}for(a=0;a<this.axes_.length;a++)if(0===a)r=this.optionsViewForAxis_("y"+(a?"2":"")),n=r("valueRange"),n&&(this.axes_[a].valueRange=n);else{var o=this.user_attrs_.axes;o&&o.y2&&(n=o.y2.valueRange,n&&(this.axes_[a].valueRange=n))}},t.prototype.numAxes=function(){return this.attributes_.numAxes()},t.prototype.axisPropertiesForSeries=function(t){return this.axes_[this.attributes_.axisForSeries(t)]},t.prototype.computeYAxisRanges_=function(t){for(var e,a,i,r,n,s=function(t){return isNaN(parseFloat(t))},o=this.attributes_.numAxes(),l=0;o>l;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;_<i.length;_++)t.hasOwnProperty(i[_])&&(g=t[i[_]][0],null!==g&&(y=Math.min(g,y)),c=t[i[_]][1],null!==c&&(v=Math.max(c,v)));d&&!p&&(y>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<P.length;k++){var O=(P[k].v-n.computedValueRange[0])/T,L=h.computedValueRange[0]+O*C;S.push(L)}h.ticks=A(h.computedValueRange[0],h.computedValueRange[1],this.height_,D,this,S)}}},t.prototype.extractSeries_=function(t,e,a){for(var i=[],r=this.attr_("errorBars"),n=this.attr_("customBars"),s=0;s<t.length;s++){var o=t[s][0],l=t[s][e];if(a)if(r||n){for(var h=0;h<l.length;h++)if(l[h]<=0){l=null;break}}else 0>=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<t.length;r++){u+=t[r][1][0],g+=t[r][1][1],r-e>=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<t.length;r++){var D=t[r][1];if(s=D[1],p[r]=[t[r][0],[s,s-D[0],D[2]-s]],null===s||isNaN(s)||(a+=D[0],b+=s,i+=D[2],w+=1),r-e>=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;r<t.length;r++){o=0;var P=0;for(l=0,n=Math.max(0,r-e+1);r+1>n;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;r<t.length;r++){for(o=0,l=0,n=Math.max(0,r-e+1);r+1>n;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;y<s.length;y++){var v=s[y];if(d=y,0!==v.length&&"#"!=v[0]){var _=v.split(o);if(!(_.length<2)){var f=[];if(u||(this.detectTypeFromString_(_[0]),h=this.attr_("xValueParser"),u=!0),f[0]=h(_[0],this),this.fractions_)for(i=1;i<_.length;i++)a=_[i].split("/"),2!=a.length?(t.error('Expected fractional "num/den" values in CSV data but found a value \''+_[i]+"' on line "+(1+y)+" ('"+v+"') which is not of this "+"form."),f[i]=[0,0]):f[i]=[p(a[0],y,v),p(a[1],y,v)];else if(this.attr_("errorBars"))for(1!=_.length%2&&t.error("Expected alternating (value, stdev.) pairs in CSV data but line "+(1+y)+" has an odd number of "+"values ("+(_.length-1)+"): '"+v+"'"),i=1;i<_.length;i+=2)f[(i+1)/2]=[p(_[i],y,v),p(_[i+1],y,v)];else if(this.attr_("customBars"))for(i=1;i<_.length;i++){var x=_[i];/^ *$/.test(x)?f[i]=[null,null,null]:(a=x.split(";"),3==a.length?f[i]=[p(a[0],y,v),p(a[1],y,v),p(a[2],y,v)]:t.warn('When using customBars, values must be either blank or "low;center;high" tuples (got "'+x+'" on line '+(1+y)))}else for(i=1;i<_.length;i++)f[i]=p(_[i],y,v);if(r.length>0&&f[0]<r[r.length-1][0]&&(c=!0),f.length!=g&&t.error("Number of columns in line "+y+" ("+f.length+") does not agree with number of labels ("+g+") "+v),0===y&&this.attr_("labels")){var m=!0;for(i=0;m&&i<f.length;i++)f[i]&&(m=!1);if(m){t.warn("The dygraphs 'labels' option is set, but the first row of CSV data ('"+v+"') appears to also contain labels. "+"Will drop the CSV labels and use the option labels.");continue}}r.push(f)}}}return c&&(t.warn("CSV is out of order; order it correctly to speed loading."),r.sort(function(t,e){return t[0]-e[0]})),r},t.prototype.parseArray_=function(e){if(0===e.length)return t.error("Can't plot empty data set"),null;if(0===e[0].length)return t.error("Data set cannot contain an empty row"),null;var a;if(null===this.attr_("labels")){for(t.warn("Using default labels. Set labels explicitly via 'labels' in the options parameter"),this.attrs_.labels=["X"],a=1;a<e[0].length;a++)this.attrs_.labels.push("Y"+a);this.attributes_.reparseSeries()}else{var i=this.attr_("labels");if(i.length!=e[0].length)return t.error("Mismatch between number of labels ("+i+") "+"and number of columns in array ("+e[0].length+")"),null}if(t.isDateLike(e[0][0])){this.attrs_.axes.x.valueFormatter=t.dateString_,this.attrs_.axes.x.ticker=t.dateTicker,this.attrs_.axes.x.axisLabelFormatter=t.dateAxisFormatter;var r=t.clone(e);for(a=0;a<e.length;a++){if(0===r[a].length)return t.error("Row "+(1+a)+" of data is empty"),null;if(null===r[a][0]||"function"!=typeof r[a][0].getTime||isNaN(r[a][0].getTime()))return t.error("x value in row "+(1+a)+" is not a Date"),null;r[a][0]=r[a][0].getTime()}return r}return this.attrs_.axes.x.valueFormatter=function(t){return t},this.attrs_.axes.x.ticker=t.numericLinearTicks,this.attrs_.axes.x.axisLabelFormatter=t.numberAxisLabelFormatter,e},t.prototype.parseDataTable_=function(e){var a=function(t){var e=String.fromCharCode(65+t%26);for(t=Math.floor(t/26);t>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;s<l.length;s++)g.push(e.getColumnLabel(l[s])),this.attr_("errorBars")&&(s+=1);this.attrs_.labels=g,i=g.length;var c=[],y=!1,v=[];for(s=0;r>s;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;o<l.length;o++){var f=l[o];if(_.push(e.getValue(s,f)),p&&h.hasOwnProperty(f)&&null!==e.getValue(s,h[f][0])){var x={};x.series=e.getColumnLabel(f),x.xval=_[0],x.shortText=a(v.length),x.text="";for(var m=0;m<h[f].length;m++)m&&(x.text+="\n"),x.text+=e.getValue(s,h[f][m]);v.push(x)}}for(o=0;o<_.length;o++)isFinite(_[o])||(_[o]=null)}c.length>0&&_[0]<c[c.length-1][0]&&(y=!0),c.push(_)}else t.warn("Ignoring row "+s+" of DataTable because of undefined or null first column.")}y&&(t.warn("DataTable is out of order; order it correctly to speed loading."),c.sort(function(t,e){return t[0]-e[0]})),this.rawData_=c,v.length>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").length<this.numColumns()-1;)this.attrs_.visibility.push(!0);return this.attr_("visibility")},t.prototype.setVisibility=function(e,a){var i=this.visibility();0>e||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;i<document.styleSheets.length;i++)if(!document.styleSheets[i].disabled){var r=document.styleSheets[i];try{if(r.insertRule){var n=r.cssRules?r.cssRules.length:0;r.insertRule(".dygraphDefaultAnnotation { "+e+" }",n)}else r.addRule&&r.addRule(".dygraphDefaultAnnotation",e);return g=!0,void 0}catch(s){}}t.warn("Unable to add default annotation CSS rule; display may be off.")}};return t.prototype.setAnnotations=function(e,a){return c(),this.annotations_=e,this.layout_?(this.layout_.setAnnotations(this.annotations_),a||this.predraw_(),void 0):(t.warn("Tried to setAnnotations before dygraph was ready. Try setting them in a drawCallback. See dygraphs.com/tests/annotation.html"),void 0)},t.prototype.annotations=function(){return this.annotations_},t.prototype.getLabels=function(){var t=this.attr_("labels");return t?t.slice():null},t.prototype.indexFromSetName=function(t){return this.setIndexByName_[t]},t}();!function(){"use strict";Dygraph.LN_TEN=Math.log(10),Dygraph.log10=function(t){return Math.log(t)/Dygraph.LN_TEN};var t=1,e=2,a=3,i=3;Dygraph.LOG_STACK_TRACES=!1,Dygraph.DOTTED_LINE=[2,2],Dygraph.DASHED_LINE=[7,3],Dygraph.DOT_DASH_LINE=[7,2,2,2],Dygraph.log=function(r,n){if("undefined"!=typeof window.console){var s=window.console,o=function(t,e,a){e&&"function"==typeof e?e.call(t,a):t.log(a)};switch(r){case t:o(s,s.debug,"dygraphs: "+n);break;case e:o(s,s.info,"dygraphs: "+n);break;case a:o(s,s.warn,"dygraphs: "+n);break;case i:o(s,s.error,"dygraphs: "+n)}}},Dygraph.info=function(t){Dygraph.log(e,t)},Dygraph.warn=function(t){Dygraph.log(a,t)},Dygraph.error=function(t){Dygraph.log(i,t)},Dygraph.getContext=function(t){return t.getContext("2d")},Dygraph.addEvent=function(t,e,a){t.addEventListener?t.addEventListener(e,a,!1):(t[e+a]=function(){a(window.event)},t.attachEvent("on"+e,t[e+a]))},Dygraph.prototype.addAndTrackEvent=function(t,e,a){Dygraph.addEvent(t,e,a),this.registeredEvents_.push({elem:t,type:e,fn:a})},Dygraph.removeEvent=function(t,e,a){if(t.removeEventListener)t.removeEventListener(e,a,!1);else{try{t.detachEvent("on"+e,t[e+a])}catch(i){}t[e+a]=null}},Dygraph.prototype.removeTrackedEvents_=function(){if(this.registeredEvents_)for(var t=0;t<this.registeredEvents_.length;t++){var e=this.registeredEvents_[t];Dygraph.removeEvent(e.elem,e.type,e.fn)}this.registeredEvents_=[]},Dygraph.cancelEvent=function(t){return t=t?t:window.event,t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,t.cancel=!0,t.returnValue=!1,!1},Dygraph.hsvToRGB=function(t,e,a){var i,r,n;if(0===e)i=a,r=a,n=a;else{var s=Math.floor(6*t),o=6*t-s,l=a*(1-e),h=a*(1-e*o),p=a*(1-e*(1-o));switch(s){case 1:i=h,r=a,n=l;break;case 2:i=l,r=a,n=p;break;case 3:i=l,r=h,n=a;break;case 4:i=p,r=l,n=a;break;case 5:i=a,r=l,n=h;break;case 6:case 0:i=a,r=p,n=l}}return i=Math.floor(255*i+.5),r=Math.floor(255*r+.5),n=Math.floor(255*n+.5),"rgb("+i+","+r+","+n+")"},Dygraph.findPos=function(t){var e=0,a=0;if(t.offsetParent)for(var i=t;;){var r="0",n="0";if(window.getComputedStyle){var s=window.getComputedStyle(i,null);r=s.borderLeft||"0",n=s.borderTop||"0"}if(e+=parseInt(r,10),a+=parseInt(n,10),e+=i.offsetLeft,a+=i.offsetTop,!i.offsetParent)break;i=i.offsetParent}else t.x&&(e+=t.x),t.y&&(a+=t.y);for(;t&&t!=document.body;)e-=t.scrollLeft,a-=t.scrollTop,t=t.parentNode;return{x:e,y:a}},Dygraph.pageX=function(t){if(t.pageX)return!t.pageX||t.pageX<0?0:t.pageX;var e=document.documentElement,a=document.body;return t.clientX+(e.scrollLeft||a.scrollLeft)-(e.clientLeft||0)},Dygraph.pageY=function(t){if(t.pageY)return!t.pageY||t.pageY<0?0:t.pageY;var e=document.documentElement,a=document.body;return t.clientY+(e.scrollTop||a.scrollTop)-(e.clientTop||0)},Dygraph.isOK=function(t){return!!t&&!isNaN(t)},Dygraph.isValidPoint=function(t,e){return t?null===t.yval?!1:null===t.x||void 0===t.x?!1:null===t.y||void 0===t.y?!1:isNaN(t.x)||!e&&isNaN(t.y)?!1:!0:!1},Dygraph.floatFormat=function(t,e){var a=Math.min(Math.max(1,e||2),21);return Math.abs(t)<.001&&0!==t?t.toExponential(a-1):t.toPrecision(a)},Dygraph.zeropad=function(t){return 10>t?"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&&t<e.length},o=parseInt((i+r)/2,10),l=e[o];return l==t?o:l>t?a>0&&(n=o-1,s(n)&&e[n]<t)?o:Dygraph.binarySearch(t,e,a,i,o-1):t>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<t.length;a++)Dygraph.isArrayLike(t[a])?e.push(Dygraph.clone(t[a])):e.push(t[a]);return e},Dygraph.createCanvas=function(){var t=document.createElement("canvas"),e=/MSIE/.test(navigator.userAgent)&&!window.opera;return e&&"undefined"!=typeof G_vmlCanvasManager&&(t=G_vmlCanvasManager.initElement(t)),t},Dygraph.isAndroid=function(){return/Android/.test(navigator.userAgent)},Dygraph.Iterator=function(t,e,a,i){e=e||0,a=a||t.length,this.hasNext=!0,this.peek=null,this.start_=e,this.array_=t,this.predicate_=i,this.end_=Math.min(t.length,e+a),this.nextIdx_=e-1,this.next()},Dygraph.Iterator.prototype.next=function(){if(!this.hasNext)return null;for(var t=this.peek,e=this.nextIdx_+1,a=!1;e<this.end_;){if(!this.predicate_||this.predicate_(this.array_,e)){this.peek=this.array_[e],a=!0;break}e++}return this.nextIdx_=e,a||(this.hasNext=!1,this.peek=null),t},Dygraph.createIterator=function(t,e,a,i){return new Dygraph.Iterator(t,e,a,i)};var r=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}();Dygraph.repeatAndCleanup=function(t,e,a,i){var n,s=0,o=(new Date).getTime();if(t(s),1==e)return i(),void 0;var l=e-1;!function h(){s>=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;n<t.length;n++)r[t[n]]=!0;for(var s in e){if(i)break;if(e.hasOwnProperty(s))if(r[s])for(var o in e[s]){if(i)break;e[s].hasOwnProperty(o)&&!a[o]&&(i=!0)}else a[s]||(i=!0)}return i},Dygraph.Circles={DEFAULT:function(t,e,a,i,r,n,s){a.beginPath(),a.fillStyle=n,a.arc(i,r,s,0,2*Math.PI,!1),a.fill()}},Dygraph.IFrameTarp=function(){this.tarps=[]},Dygraph.IFrameTarp.prototype.cover=function(){for(var t=document.getElementsByTagName("iframe"),e=0;e<t.length;e++){var a=t[e],i=Dygraph.findPos(a),r=i.x,n=i.y,s=a.offsetWidth,o=a.offsetHeight,l=document.createElement("div");l.style.position="absolute",l.style.left=r+"px",l.style.top=n+"px",l.style.width=s+"px",l.style.height=o+"px",l.style.zIndex=999,document.body.appendChild(l),this.tarps.push(l)}},Dygraph.IFrameTarp.prototype.uncover=function(){for(var t=0;t<this.tarps.length;t++)this.tarps[t].parentNode.removeChild(this.tarps[t]);this.tarps=[]},Dygraph.detectLineDelimiter=function(t){for(var e=0;e<t.length;e++){var a=t.charAt(e);if("\r"===a)return e+1<t.length&&"\n"===t.charAt(e+1)?"\r\n":a;if("\n"===a)return e+1<t.length&&"\r"===t.charAt(e+1)?"\n\r":a}return null},Dygraph.isNodeContainedBy=function(t,e){if(null===e||null===t)return!1;for(var a=t;a&&a!==e;)a=a.parentNode;return a===e},Dygraph.pow=function(t,e){return 0>e?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;i<a.length;++i)t.push({row:e,column:i+1});return t},Dygraph.Interaction={},Dygraph.Interaction.startPan=function(t,e,a){var i,r;a.isPanning=!0;var n=e.xAxisRange();if(a.dateRange=n[1]-n[0],a.initialLeftmostDate=n[0],a.xUnitsPerPixel=a.dateRange/(e.plotter_.area.w-1),e.attr_("panEdgeFraction")){var s=e.width_*e.attr_("panEdgeFraction"),o=e.xAxisExtremes(),l=e.toDomXCoord(o[0])-s,h=e.toDomXCoord(o[1])+s,p=e.toDataXCoord(l),d=e.toDataXCoord(h);a.boundedDates=[p,d];var u=[],g=e.height_*e.attr_("panEdgeFraction");for(i=0;i<e.axes_.length;i++){r=e.axes_[i];var c=r.extremeRange,y=e.toDomYCoord(c[0],i)+g,v=e.toDomYCoord(c[1],i)-g,_=e.toDataYCoord(y,i),f=e.toDataYCoord(v,i);u[i]=[_,f]}a.boundedValues=u}for(a.is2DPan=!1,a.axes=[],i=0;i<e.axes_.length;i++){r=e.axes_[i];var x={},m=e.yAxisRange(i),b=e.attributes_.getForAxis("logscale",i);b?(x.initialTopValue=Dygraph.log10(m[1]),x.dragValueRange=Dygraph.log10(m[1])-Dygraph.log10(m[0])):(x.initialTopValue=m[1],x.dragValueRange=m[1]-m[0]),x.unitsPerPixel=x.dragValueRange/(e.plotter_.area.h-1),a.axes.push(x),(r.valueWindow||r.valueRange)&&(a.is2DPan=!0)}},Dygraph.Interaction.movePan=function(t,e,a){a.dragEndX=e.dragGetX_(t,a),a.dragEndY=e.dragGetY_(t,a);var i=a.initialLeftmostDate-(a.dragEndX-a.dragStartX)*a.xUnitsPerPixel;a.boundedDates&&(i=Math.max(i,a.boundedDates[0]));var r=i+a.dateRange;if(a.boundedDates&&r>a.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;s<e.axes_.length;s++){var o=e.axes_[s],l=a.axes[s],h=n*l.unitsPerPixel,p=a.boundedValues?a.boundedValues[s]:null,d=l.initialTopValue+h;p&&(d=Math.min(d,p[1]));var u=d-l.dragValueRange;p&&u<p[0]&&(d-=u-p[0],u=d-l.dragValueRange);var g=e.attributes_.getForAxis("logscale",s);o.valueWindow=g?[Math.pow(Dygraph.LOG_SCALE,u),Math.pow(Dygraph.LOG_SCALE,d)]:[u,d]}e.drawGraph_(!1)},Dygraph.Interaction.endPan=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),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;l<t.selPoints_.length;l++){var h=t.selPoints_[l],p=Math.pow(h.canvasx-a.dragEndX,2)+Math.pow(h.canvasy-a.dragEndY,2);!isNaN(p)&&(-1==s||o>p)&&(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<t.touches.length;r++){var n=t.touches[r];i.push({pageX:n.pageX,pageY:n.pageY,dataX:e.toDataXCoord(n.pageX),dataY:e.toDataYCoord(n.pageY)})}if(a.initialTouches=i,1==i.length)a.initialPinchCenter=i[0],a.touchDirections={x:!0,y:!0};else if(i.length>=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<t.touches.length;i++){var n=t.touches[i];r.push({pageX:n.pageX,pageY:n.pageY})}var s,o=a.initialTouches,l=a.initialPinchCenter;s=1==r.length?r[0]:{pageX:.5*(r[0].pageX+r[1].pageX),pageY:.5*(r[0].pageY+r[1].pageY)};var h={pageX:s.pageX-l.pageX,pageY:s.pageY-l.pageY},p=a.initialRange.x[1]-a.initialRange.x[0],d=a.initialRange.y[0]-a.initialRange.y[1];h.dataX=h.pageX/e.plotter_.area.w*p,h.dataY=h.pageY/e.plotter_.area.h*d;var u,g;if(1==r.length)u=1,g=1;else if(r.length>=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<s.length;o++)u.push({v:s[o]});else{if(r("logscale")){p=Math.floor(i/d);var g=Dygraph.binarySearch(e,t,1),c=Dygraph.binarySearch(a,t,-1);-1==g&&(g=0),-1==c&&(c=t.length-1);var y=null;if(c-g>=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;l<m.length&&(D=O*m[l],A=Math.floor(e/D)*D,P=Math.ceil(a/D)*D,p=Math.abs(P-A)/D,T=i/p,!(T>d));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<u.length;o++)void 0===u[o].label&&(u[o].label=L(u[o].v,0,r,n));return u},Dygraph.dateTicker=function(t,e,a,i,r){var n=Dygraph.pickDateTickGranularity(t,e,a,i);return n>=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;t<this.annotations_.length;t++){var e=this.annotations_[t];e.parentNode&&e.parentNode.removeChild(e),this.annotations_[t]=null}this.annotations_=[]},t.prototype.clearChart=function(){this.detachLabels()},t.prototype.didDrawChart=function(t){var e=t.dygraph,a=e.layout_.annotated_points;if(a&&0!==a.length)for(var i=t.canvas.parentNode,r={position:"absolute",fontSize:e.getOption("axisLabelFontSize")+"px",zIndex:10,overflow:"hidden"},n=function(t,a,i){return function(r){var n=i.annotation;n.hasOwnProperty(t)?n[t](n,i,e,r):e.getOption(a)&&e.getOption(a)(n,i,e,r)}},s=t.dygraph.plotter_.area,o={},l=0;l<a.length;l++){var h=a[l];if(!(h.canvasx<s.x||h.canvasx>s.x+s.w||h.canvasy<s.y||h.canvasy>s.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;e<t.length;e++){var a=t[e];a.parentNode&&a.parentNode.removeChild(a)}}t(this.xlabels_),t(this.ylabels_),this.xlabels_=[],this.ylabels_=[]},t.prototype.clearChart=function(){this.detachLabels()},t.prototype.willDrawChart=function(t){function e(t){return Math.round(t)+.5}function a(t){return Math.round(t)-.5}var i=t.dygraph;if(i.getOption("drawXAxis")||i.getOption("drawYAxis")){var r,n,s,o,l,h=t.drawingContext,p=t.canvas.parentNode,d=t.canvas.width,u=t.canvas.height,g=function(t){return{position:"absolute",fontSize:i.getOptionForAxis("axisLabelFontSize",t)+"px",zIndex:10,color:i.getOptionForAxis("axisLabelColor",t),width:i.getOption("axisLabelWidth")+"px",lineHeight:"normal",overflow:"hidden"}},c={x:g("x"),y:g("y"),y2:g("y2")},y=function(t,e,a){var i=document.createElement("div"),r=c["y2"==a?"y2":e];for(var n in r)r.hasOwnProperty(n)&&(i.style[n]=r[n]);var s=document.createElement("div");return s.className="dygraph-axis-label dygraph-axis-label-"+e+(a?" dygraph-axis-label-"+a:""),s.innerHTML=t,i.appendChild(s),i};h.save();var v=i.layout_,_=t.dygraph.plotter_.area;if(i.getOption("drawYAxis")){if(v.yticks&&v.yticks.length>0){var f=i.numAxes();for(l=0;l<v.yticks.length;l++){if(o=v.yticks[l],"function"==typeof o)return;n=_.x;var x=1,m="y1";1==o[0]&&(n=_.x+_.w,x=-1,m="y2");var b=i.getOptionForAxis("axisLabelFontSize",m);s=_.y+o[1]*_.h,r=y(o[2],"y",2==f?m:null);var w=s-b/2;0>w&&(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;l<v.xticks.length;l++){o=v.xticks[l],n=_.x+o[0]*_.w,s=_.y+_.h,r=y(o[1],"x"),r.style.textAlign="center",r.style.top=s+i.getOption("axisTickSize")+"px";var C=n-i.getOption("axisLabelWidth")/2;C+i.getOption("axisLabelWidth")>d&&(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<t.length;e++){var a=t[e];a&&a.parentNode&&a.parentNode.removeChild(a)}this.title_div_=null,this.xlabel_div_=null,this.ylabel_div_=null,this.y2label_div_=null};var a=function(t,e,a,i,r){var n=document.createElement("div");n.style.position="absolute",n.style.left=1==a?"0px":e.x+"px",n.style.top=e.y+"px",n.style.width=e.w+"px",n.style.height=e.h+"px",n.style.fontSize=t.getOption("yLabelWidth")-2+"px";var s=document.createElement("div");s.style.position="absolute",s.style.width=e.h+"px",s.style.height=e.w+"px",s.style.top=e.h/2-e.w/2+"px",s.style.left=e.w/2-e.h/2+"px",s.style.textAlign="center";var o="rotate("+(1==a?"-":"")+"90deg)";s.style.transform=o,s.style.WebkitTransform=o,s.style.MozTransform=o,s.style.OTransform=o,s.style.msTransform=o,"undefined"!=typeof document.documentMode&&document.documentMode<9&&(s.style.filter="progid:DXImageTransform.Microsoft.BasicImage(rotation="+(1==a?"3":"1")+")",s.style.left="0px",s.style.top="0px");var l=document.createElement("div");return l.className=i,l.innerHTML=r,s.appendChild(l),n.appendChild(s),n};return t.prototype.layout=function(t){this.detachLabels_();var i=t.dygraph,r=t.chart_div;if(i.getOption("title")){var n=t.reserveSpaceTop(i.getOption("titleHeight"));this.title_div_=e(n),this.title_div_.style.textAlign="center",this.title_div_.style.fontSize=i.getOption("titleHeight")-8+"px",this.title_div_.style.fontWeight="bold",this.title_div_.style.zIndex=10;var s=document.createElement("div");s.className="dygraph-label dygraph-title",s.innerHTML=i.getOption("title"),this.title_div_.appendChild(s),r.appendChild(this.title_div_)}if(i.getOption("xlabel")){var o=t.reserveSpaceBottom(i.getOption("xLabelHeight"));this.xlabel_div_=e(o),this.xlabel_div_.style.textAlign="center",this.xlabel_div_.style.fontSize=i.getOption("xLabelHeight")-2+"px";var s=document.createElement("div");s.className="dygraph-label dygraph-xlabel",s.innerHTML=i.getOption("xlabel"),this.xlabel_div_.appendChild(s),r.appendChild(this.xlabel_div_)}if(i.getOption("ylabel")){var l=t.reserveSpaceLeft(0);this.ylabel_div_=a(i,l,1,"dygraph-label dygraph-ylabel",i.getOption("ylabel")),r.appendChild(this.ylabel_div_)}if(i.getOption("y2label")&&2==i.numAxes()){var h=t.reserveSpaceRight(0);this.y2label_div_=a(i,h,2,"dygraph-label dygraph-y2label",i.getOption("y2label")),r.appendChild(this.y2label_div_)}},t.prototype.didDrawChart=function(t){var e=t.dygraph;this.title_div_&&(this.title_div_.children[0].innerHTML=e.getOption("title")),this.xlabel_div_&&(this.xlabel_div_.children[0].innerHTML=e.getOption("xlabel")),this.ylabel_div_&&(this.ylabel_div_.children[0].children[0].innerHTML=e.getOption("ylabel")),this.y2label_div_&&(this.y2label_div_.children[0].children[0].innerHTML=e.getOption("y2label"))},t.prototype.clearChart=function(){},t.prototype.destroy=function(){this.detachLabels_()},t}(),Dygraph.Plugins.Grid=function(){"use strict";var t=function(){};return t.prototype.toString=function(){return"Gridline Plugin"},t.prototype.activate=function(){return{willDrawChart:this.willDrawChart}},t.prototype.willDrawChart=function(t){function e(t){return Math.round(t)+.5}function a(t){return Math.round(t)-.5}var i,r,n,s,o=t.dygraph,l=t.drawingContext,h=o.layout_,p=t.dygraph.plotter_.area;if(o.getOption("drawYGrid")){for(var d=["y","y2"],u=[],g=[],c=[],y=[],v=[],n=0;n<d.length;n++)c[n]=o.getOptionForAxis("drawGrid",d[n]),c[n]&&(u[n]=o.getOptionForAxis("gridLineColor",d[n]),g[n]=o.getOptionForAxis("gridLineWidth",d[n]),v[n]=o.getOptionForAxis("gridLinePattern",d[n]),y[n]=v[n]&&v[n].length>=2);for(s=h.yticks,l.save(),n=0;n<s.length;n++){var _=s[n][0];c[_]&&(y[_]&&l.installPattern(v[_]),l.strokeStyle=u[_],l.lineWidth=g[_],i=e(p.x),r=a(p.y+s[n][1]*p.h),l.beginPath(),l.moveTo(i,r),l.lineTo(i+p.w,r),l.closePath(),l.stroke(),y[_]&&l.uninstallPattern())}l.restore()}if(o.getOption("drawXGrid")&&o.getOptionForAxis("drawGrid","x")){s=h.xticks,l.save();var v=o.getOptionForAxis("gridLinePattern","x"),y=v&&v.length>=2;for(y&&l.installPattern(v),l.strokeStyle=o.getOptionForAxis("gridLineColor","x"),l.lineWidth=o.getOptionForAxis("gridLineWidth","x"),n=0;n<s.length;n++)i=e(p.x+s[n][0]*p.w),r=a(p.y+p.h),l.beginPath(),l.moveTo(i,r),l.lineTo(i,p.y),l.closePath(),l.stroke();y&&l.uninstallPattern(),l.restore()}},t.prototype.destroy=function(){},t}(),Dygraph.Plugins.Legend=function(){"use strict";var t=function(){this.legend_div_=null,this.is_generated_div_=!1};t.prototype.toString=function(){return"Legend Plugin"};var e,a;t.prototype.activate=function(t){var e,a=t.getOption("labelsDivWidth"),i=t.getOption("labelsDiv");if(i&&null!==i)e="string"==typeof i||i instanceof String?document.getElementById(i):i;else{var r={position:"absolute",fontSize:"14px",zIndex:10,width:a+"px",top:"0px",left:t.size().width-a-2+"px",background:"white",lineHeight:"normal",textAlign:"left",overflow:"hidden"};Dygraph.update(r,t.getOption("labelsDivStyles")),e=document.createElement("div"),e.className="dygraph-legend";for(var n in r)if(r.hasOwnProperty(n))try{e.style[n]=r[n]}catch(s){Dygraph.warn("You are using unsupported css properties for your browser in labelsDivStyles")}t.graphDiv.appendChild(e),this.is_generated_div_=!0}return this.legend_div_=e,this.one_em_width_=10,{select:this.select,deselect:this.deselect,predraw:this.predraw,didDrawChart:this.didDrawChart}};var i=function(t){var e=document.createElement("span");e.setAttribute("style","margin: 0; padding: 0 0 0 1em; border: 0;"),t.appendChild(e);var a=e.offsetWidth;return t.removeChild(e),a};return t.prototype.select=function(t){var a=t.selectedX,i=t.selectedPoints,r=e(t.dygraph,a,i,this.one_em_width_);this.legend_div_.innerHTML=r},t.prototype.deselect=function(t){var a=i(this.legend_div_);this.one_em_width_=a;var r=e(t.dygraph,void 0,void 0,a);this.legend_div_.innerHTML=r},t.prototype.didDrawChart=function(t){this.deselect(t)},t.prototype.predraw=function(t){if(this.is_generated_div_){t.dygraph.graphDiv.appendChild(this.legend_div_);var e=t.dygraph.plotter_.area,a=t.dygraph.getOption("labelsDivWidth");this.legend_div_.style.left=e.x+e.w-a-1+"px",this.legend_div_.style.top=e.y+"px",this.legend_div_.style.width=a+"px"}},t.prototype.destroy=function(){this.legend_div_=null},e=function(t,e,i,r){if(t.getOption("showLabelsOnHighlight")!==!0)return"";var n,s,o,l,h,p=t.getLabels();if("undefined"==typeof e){if("always"!=t.getOption("legend"))return"";for(s=t.getOption("labelsSeparateLines"),n="",o=1;o<p.length;o++){var d=t.getPropertiesForSeries(p[o]);d.visible&&(""!==n&&(n+=s?"<br/>":" "),h=t.getOption("strokePattern",p[o]),l=a(h,d.color,r),n+="<span style='font-weight: bold; color: "+d.color+";'>"+l+" "+p[o]+"</span>")}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<i.length;o++){var f=i[o];if((0!==f.yval||v)&&Dygraph.isOK(f.canvasy)){s&&(n+="<br/>");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+="<span"+w+">"+" <b><span style='color: "+d.color+";'>"+f.name+"</span></b>:&nbsp;"+b+"</span>"}}return n},a=function(t,e,a){var i=/MSIE/.test(navigator.userAgent)&&!window.opera;if(i)return"&mdash;";if(!t||t.length<=1)return'<div style="display: inline-block; position: relative; bottom: .5ex; padding-left: 1em; height: 1px; border-bottom: 2px solid '+e+';"></div>';
+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;r<t.length;r++)d[r]=t[r]/a;p=d.length}else{for(l=1,r=0;r<t.length;r++)d[r]=t[r]/h;p=d.length+1}var u="";for(n=0;l>n;n++)for(r=0;p>r;r+=2)s=d[r%d.length],o=r<t.length?d[(r+1)%d.length]:0,u+='<div style="display: inline-block; position: relative; bottom: .5ex; margin-right: '+o+"em; padding-left: "+s+"em; height: 1px; border-bottom: 2px solid "+e+';"></div>';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<i},s=function(t){return!x&&n(t)&&c.getZoomHandleStatus_().isZoomed?(Dygraph.cancelEvent(t),x=!0,v=t.clientX,"mousedown"===t.type&&(Dygraph.addEvent(y,"mousemove",o),Dygraph.addEvent(y,"mouseup",l)),!0):!1},o=function(t){if(!x)return!1;Dygraph.cancelEvent(t);var e=t.clientX-v;if(Math.abs(e)<4)return!0;v=t.clientX;var a=c.getZoomHandleStatus_(),i=a.leftHandlePos,r=a.rightHandlePos,n=r-i;i+e<=c.canvasRect_.x?(i=c.canvasRect_.x,r=i+n):r+e>=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;i<a.length;i++)c.dygraph_.addAndTrackEvent(t,a[i],e)},this.setDefaultOption_("interactionModel",Dygraph.Interaction.dragIsPanInteractionModel),this.setDefaultOption_("panEdgeFraction",1e-4);var w=window.opera?"mousedown":"dragstart";this.dygraph_.addAndTrackEvent(this.leftZoomHandle_,w,e),this.dygraph_.addAndTrackEvent(this.rightZoomHandle_,w,e),this.isUsingExcanvas_?this.dygraph_.addAndTrackEvent(this.iePanOverlay_,"mousedown",s):(this.dygraph_.addAndTrackEvent(this.fgcanvas_,"mousedown",s),this.dygraph_.addAndTrackEvent(this.fgcanvas_,"mousemove",p)),this.hasTouchInterface_&&(g(this.leftZoomHandle_,d),g(this.rightZoomHandle_,d),g(this.fgcanvas_,u))},t.prototype.drawStaticLayer_=function(){var t=this.bgcanvas_ctx_;t.clearRect(0,0,this.canvasRect_.w,this.canvasRect_.h);try{this.drawMiniPlot_()}catch(e){Dygraph.warn(e)}var a=.5;this.bgcanvas_ctx_.lineWidth=1,t.strokeStyle="gray",t.beginPath(),t.moveTo(a,a),t.lineTo(a,this.canvasRect_.h-a),t.lineTo(this.canvasRect_.w-a,this.canvasRect_.h-a),t.lineTo(this.canvasRect_.w-a,a),t.stroke()},t.prototype.drawMiniPlot_=function(){var t=this.getOption_("rangeSelectorPlotFillColor"),e=this.getOption_("rangeSelectorPlotStrokeColor");if(t||e){var a=this.getOption_("stepPlot"),i=this.computeCombinedSeriesAndLimits_(),r=i.yMax-i.yMin,n=this.bgcanvas_ctx_,s=.5,o=this.dygraph_.xAxisExtremes(),l=Math.max(o[1]-o[0],1e-30),h=(this.canvasRect_.w-s)/l,p=(this.canvasRect_.h-s)/r,d=this.canvasRect_.w-s,u=this.canvasRect_.h-s,g=null,c=null;n.beginPath(),n.moveTo(s,u);for(var y=0;y<i.data.length;y++){var v=i.data[y],_=null!==v[0]?(v[0]-o[0])*h:0/0,f=null!==v[1]?u-(v[1]-i.yMin)*p:0/0;isFinite(_)&&isFinite(f)?(null===g?n.lineTo(_,u):a&&n.lineTo(_,c),n.lineTo(_,f),g=_,c=f):(null!==g&&(a?(n.lineTo(_,c),n.lineTo(_,u)):n.lineTo(g,u)),g=c=null)}if(n.lineTo(d,u),n.closePath(),t){var x=this.bgcanvas_ctx_.createLinearGradient(0,0,0,u);x.addColorStop(0,"white"),x.addColorStop(1,t),this.bgcanvas_ctx_.fillStyle=x,n.fill()}e&&(this.bgcanvas_ctx_.strokeStyle=e,this.bgcanvas_ctx_.lineWidth=1.5,n.stroke())}},t.prototype.computeCombinedSeriesAndLimits_=function(){var t,e,a,i,r,n,s,o,l=this.dygraph_.rawData_,h=this.getOption_("logscale"),p=[];for(i=0;i<l.length;i++)if(l[i].length>1&&null!==l[i][1]){if(a="number"!=typeof l[i][1])for(t=[],e=[],n=0;n<l[i][1].length;n++)t.push(0),e.push(0);break}for(i=0;i<l.length;i++){var d=l[i];if(s=d[0],a)for(n=0;n<t.length;n++)t[n]=e[n]=0;else t=e=0;for(r=1;r<d.length;r++)if(this.dygraph_.visibility()[r-1]){var u;if(a)for(n=0;n<t.length;n++)u=d[r][n],null===u||isNaN(u)||(t[n]+=u,e[n]++);else{if(u=d[r],null===u||isNaN(u))continue;t+=u,e++}}if(a){for(n=0;n<t.length;n++)t[n]/=e[n];o=t.slice(0)}else o=t/e;p.push([s,o])}if(p=this.dygraph_.rollingAverage(p,this.dygraph_.rollPeriod_),"number"!=typeof p[0][1])for(i=0;i<p.length;i++)o=p[i][1],p[i][1]=o[0];var g=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(i=0;i<p.length;i++)o=p[i][1],null!==o&&isFinite(o)&&(!h||o>0)&&(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;i<p.length;i++)p[i][1]=Dygraph.log10(p[i][1]);else{var v,_=c-g;v=_<=Number.MIN_VALUE?c*y:_*y,c+=v,g-=v}return{data:p,yMin:g,yMax:c}},t.prototype.placeZoomHandles_=function(){var t=this.dygraph_.xAxisExtremes(),e=this.dygraph_.xAxisRange(),a=t[1]-t[0],i=Math.max(0,(e[0]-t[0])/a),r=Math.max(0,(t[1]-e[1])/a),n=this.canvasRect_.x+this.canvasRect_.w*i,s=this.canvasRect_.x+this.canvasRect_.w*(1-r),o=Math.max(this.canvasRect_.y,this.canvasRect_.y+(this.canvasRect_.h-this.leftZoomHandle_.height)/2),l=this.leftZoomHandle_.width/2;this.leftZoomHandle_.style.left=n-l+"px",this.leftZoomHandle_.style.top=o+"px",this.rightZoomHandle_.style.left=s-l+"px",this.rightZoomHandle_.style.top=this.leftZoomHandle_.style.top,this.leftZoomHandle_.style.visibility="visible",this.rightZoomHandle_.style.visibility="visible"},t.prototype.drawInteractiveLayer_=function(){var t=this.fgcanvas_ctx_;t.clearRect(0,0,this.canvasRect_.w,this.canvasRect_.h);var e=1,a=this.canvasRect_.w-e,i=this.canvasRect_.h-e,r=this.getZoomHandleStatus_();if(t.strokeStyle="black",r.isZoomed){var n=Math.max(e,r.leftHandlePos-this.canvasRect_.x),s=Math.min(a,r.rightHandlePos-this.canvasRect_.x);t.fillStyle="rgba(240, 240, 240, 0.6)",t.fillRect(0,0,n,this.canvasRect_.h),t.fillRect(s,0,this.canvasRect_.w-s,this.canvasRect_.h),t.beginPath(),t.moveTo(e,e),t.lineTo(n,e),t.lineTo(n,i),t.lineTo(s,i),t.lineTo(s,e),t.lineTo(a,e),t.stroke(),this.isUsingExcanvas_&&(this.iePanOverlay_.style.width=s-n+"px",this.iePanOverlay_.style.left=n+"px",this.iePanOverlay_.style.height=i+"px",this.iePanOverlay_.style.display="inline")}else t.beginPath(),t.moveTo(e,e),t.lineTo(e,i),t.lineTo(a,i),t.lineTo(a,e),t.stroke(),this.iePanOverlay_&&(this.iePanOverlay_.style.display="none")},t.prototype.getZoomHandleStatus_=function(){var t=this.leftZoomHandle_.width/2,e=parseFloat(this.leftZoomHandle_.style.left)+t,a=parseFloat(this.rightZoomHandle_.style.left)+t;return{leftHandlePos:e,rightHandlePos:a,isZoomed:e-1>this.canvasRect_.x||a+1<this.canvasRect_.x+this.canvasRect_.w}},t}(),Dygraph.PLUGINS.push(Dygraph.Plugins.Legend,Dygraph.Plugins.Axes,Dygraph.Plugins.RangeSelector,Dygraph.Plugins.ChartLabels,Dygraph.Plugins.Annotations,Dygraph.Plugins.Grid);
\ No newline at end of file
index ad83292..7e05aa9 100644 (file)
@@ -211,7 +211,7 @@ DygraphLayout.prototype._evaluateLimits = function() {
   }
 };
 
-DygraphLayout._calcYNormal = function(axis, value, logscale) {
+var calcYNormal_ = function(axis, value, logscale) {
   if (logscale) {
     return 1.0 - ((Dygraph.log10(value) - Dygraph.log10(axis.minyval)) * axis.ylogscale);
   } else {
@@ -239,7 +239,7 @@ DygraphLayout.prototype._evaluateLineCharts = function() {
       // Range from 0-1 where 0 represents top and 1 represents bottom
       var yval = point.yval;
       if (isStacked) {
-        point.y_stacked = DygraphLayout._calcYNormal(
+        point.y_stacked = calcYNormal_(
             axis, point.yval_stacked, logscale);
         if (yval !== null && !isNaN(yval)) {
           yval = point.yval_stacked;
@@ -251,13 +251,11 @@ DygraphLayout.prototype._evaluateLineCharts = function() {
           point.yval = NaN;
         }
       }
-      point.y = DygraphLayout._calcYNormal(axis, yval, logscale);
+      point.y = calcYNormal_(axis, yval, logscale);
 
       if (hasBars) {
-        point.y_top = DygraphLayout._calcYNormal(
-            axis, yval - point.yval_minus, logscale);
-        point.y_bottom = DygraphLayout._calcYNormal(
-            axis, yval + point.yval_plus, logscale);
+        point.y_top = calcYNormal_(axis, yval - point.yval_minus, logscale);
+        point.y_bottom = calcYNormal_(axis, yval + point.yval_plus, logscale);
       }
     }
   }