dygraphs finally stays within its bounds! removed padding property and tweaked PlotKi...
[dygraphs.git] / dygraph-combined.js
index 8fd362c..6cf8d2d 100644 (file)
@@ -1593,7 +1593,7 @@ throw MochiKit.Iter.StopIteration;
 return rval;
 }};
 }});
-MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter",];
+MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter"];
 MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"];
 MochiKit.Iter.__new__=function(){
 var m=MochiKit.Base;
@@ -4304,7 +4304,7 @@ this.__init__(_69,_70,_71);
 PlotKit.CanvasRenderer.prototype.__init__=function(_72,_73,_74){
 var _75=MochiKit.Base.isUndefinedOrNull;
 var _76=MochiKit.Color.Color;
-this.options={"drawBackground":true,"backgroundColor":_76.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_76.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_76.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_76.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true};
+this.options={"drawBackground":true,"backgroundColor":_76.whiteColor(),"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_76.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_76.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_76.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true};
 MochiKit.Base.update(this.options,_74?_74:{});
 this.layout=_73;
 this.element=MochiKit.DOM.getElement(_72);
@@ -4331,7 +4331,9 @@ throw "CanvasRenderer() - <canvas> needs to be enclosed in <div>";
 this.xlabels=new Array();
 this.ylabels=new Array();
 this.isFirstRender=true;
-this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom};
+this.area={x:this.options.yAxisLabelWidth+2*this.options.axisTickSize,y:0};
+this.area.w=this.width-this.area.x-this.options.rightGap;
+this.area.h=this.height-this.options.axisLabelFontSize-2*this.options.axisTickSize;
 MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}});
 };
 PlotKit.CanvasRenderer.prototype.render=function(){
@@ -4432,14 +4434,29 @@ _93.lineTo(x-this.options.axisTickSize,y);
 _93.closePath();
 _93.stroke();
 var _98=DIV(_94,_96[1]);
-_98.style.top=(y-this.options.axisLabelFontSize)+"px";
-_98.style.left=(x-this.options.padding.left-this.options.axisTickSize)+"px";
+var top=(y-this.options.axisLabelFontSize/2);
+if(top<0){
+top=0;
+}
+if(top+this.options.axisLabelFontSize+3>this.height){
+_98.style.bottom="0px";
+}else{
+_98.style.top=top+"px";
+}
+_98.style.left="0px";
 _98.style.textAlign="right";
-_98.style.width=(this.options.padding.left-this.options.axisTickSize*2)+"px";
+_98.style.border="1px solid black";
+_98.style.width=this.options.yAxisLabelWidth+"px";
 MochiKit.DOM.appendChildNodes(this.container,_98);
 this.ylabels.push(_98);
 };
 MochiKit.Iter.forEach(this.layout.yticks,bind(_95,this));
+var _100=this.ylabels[0];
+var _101=this.options.axisLabelFontSize;
+var _102=parseInt(_100.style.top)+_101;
+if(_102>this.height-_101){
+_100.style.top=(parseInt(_100.style.top)-_101/2)+"px";
+}
 }
 _93.beginPath();
 _93.moveTo(this.area.x,this.area.y);
@@ -4449,24 +4466,34 @@ _93.stroke();
 }
 if(this.options.drawXAxis){
 if(this.layout.xticks){
-var _95=function(_99){
+var _95=function(tick){
 if(typeof (dataset)=="function"){
 return;
 }
-var x=this.area.x+_99[0]*this.area.w;
+var x=this.area.x+tick[0]*this.area.w;
 var y=this.area.y+this.area.h;
 _93.beginPath();
 _93.moveTo(x,y);
 _93.lineTo(x,y+this.options.axisTickSize);
 _93.closePath();
 _93.stroke();
-var _100=DIV(_94,_99[1]);
-_100.style.top=(y+this.options.axisTickSize)+"px";
-_100.style.left=(x-this.options.axisLabelWidth/2)+"px";
-_100.style.textAlign="center";
-_100.style.width=this.options.axisLabelWidth+"px";
-MochiKit.DOM.appendChildNodes(this.container,_100);
-this.xlabels.push(_100);
+var _104=DIV(_94,tick[1]);
+_104.style.textAlign="center";
+_104.style.bottom="0px";
+var left=(x-this.options.axisLabelWidth/2);
+if(left+this.options.axisLabelWidth>this.width){
+left=this.width-this.options.xAxisLabelWidth;
+_104.style.textAlign="right";
+}
+if(left<0){
+left=0;
+_104.style.textAlign="left";
+}
+_104.style.left=left+"px";
+_104.style.border="1px solid black";
+_104.style.width=this.options.xAxisLabelWidth+"px";
+MochiKit.DOM.appendChildNodes(this.container,_104);
+this.xlabels.push(_104);
 };
 MochiKit.Iter.forEach(this.layout.xticks,bind(_95,this));
 }
@@ -4479,11 +4506,11 @@ _93.stroke();
 _93.restore();
 };
 PlotKit.CanvasRenderer.prototype._renderBackground=function(){
-var _101=this.element.getContext("2d");
-_101.save();
-_101.fillStyle=this.options.backgroundColor.toRGBString();
-_101.fillRect(0,0,this.width,this.height);
-_101.restore();
+var _106=this.element.getContext("2d");
+_106.save();
+_106.fillStyle=this.options.backgroundColor.toRGBString();
+_106.fillRect(0,0,this.width,this.height);
+_106.restore();
 };
 PlotKit.CanvasRenderer.prototype.clear=function(){
 if(this.isIE){
@@ -4492,7 +4519,7 @@ if(this.clearDelay){
 this.clearDelay.cancel();
 this.clearDelay=null;
 }
-var _102=this.element.getContext("2d");
+var _107=this.element.getContext("2d");
 }
 catch(e){
 this.isFirstRender=false;
@@ -4501,88 +4528,88 @@ this.clearDelay.addCallback(bind(this.clear,this));
 return;
 }
 }
-var _102=this.element.getContext("2d");
-_102.clearRect(0,0,this.width,this.height);
+var _107=this.element.getContext("2d");
+_107.clearRect(0,0,this.width,this.height);
 MochiKit.Iter.forEach(this.xlabels,MochiKit.DOM.removeElement);
 MochiKit.Iter.forEach(this.ylabels,MochiKit.DOM.removeElement);
 this.xlabels=new Array();
 this.ylabels=new Array();
 };
 PlotKit.CanvasRenderer.prototype._initialiseEvents=function(){
-var _103=MochiKit.Signal.connect;
+var _108=MochiKit.Signal.connect;
 var bind=MochiKit.Base.bind;
-_103(this.element,"onclick",bind(this.onclick,this));
+_108(this.element,"onclick",bind(this.onclick,this));
 };
 PlotKit.CanvasRenderer.prototype._resolveObject=function(e){
 var x=(e.mouse().page.x-PlotKit.Base.findPosX(this.element)-this.area.x)/this.area.w;
 var y=(e.mouse().page.y-PlotKit.Base.findPosY(this.element)-this.area.y)/this.area.h;
-var _106=this.layout.hitTest(x,y);
-if(_106){
-return _106;
+var _111=this.layout.hitTest(x,y);
+if(_111){
+return _111;
 }
 return null;
 };
-PlotKit.CanvasRenderer.prototype._createEventObject=function(_107,e){
-if(_107==null){
+PlotKit.CanvasRenderer.prototype._createEventObject=function(_112,e){
+if(_112==null){
 return null;
 }
-e.chart=_107;
+e.chart=_112;
 return e;
 };
 PlotKit.CanvasRenderer.prototype.onclick=function(e){
-var _108=this._resolveObject(e);
-var _109=this._createEventObject(_108,e);
-if(_109!=null){
-MochiKit.Signal.signal(this,"onclick",_109);
+var _113=this._resolveObject(e);
+var _114=this._createEventObject(_113,e);
+if(_114!=null){
+MochiKit.Signal.signal(this,"onclick",_114);
 }
 };
 PlotKit.CanvasRenderer.prototype.onmouseover=function(e){
-var _110=this._resolveObject(e);
-var _111=this._createEventObject(_110,e);
-if(_111!=null){
-signal(this,"onmouseover",_111);
+var _115=this._resolveObject(e);
+var _116=this._createEventObject(_115,e);
+if(_116!=null){
+signal(this,"onmouseover",_116);
 }
 };
 PlotKit.CanvasRenderer.prototype.onmouseout=function(e){
-var _112=this._resolveObject(e);
-var _113=this._createEventObject(_112,e);
-if(_113==null){
+var _117=this._resolveObject(e);
+var _118=this._createEventObject(_117,e);
+if(_118==null){
 signal(this,"onmouseout",e);
 }else{
-signal(this,"onmouseout",_113);
+signal(this,"onmouseout",_118);
 }
 };
 PlotKit.CanvasRenderer.prototype.onmousemove=function(e){
-var _114=this._resolveObject(e);
-var _115=this._createEventObject(_114,e);
-if((_114==null)&&(this.event_isinside==null)){
+var _119=this._resolveObject(e);
+var _120=this._createEventObject(_119,e);
+if((_119==null)&&(this.event_isinside==null)){
 return;
 }
-if((_114!=null)&&(this.event_isinside==null)){
-signal(this,"onmouseover",_115);
+if((_119!=null)&&(this.event_isinside==null)){
+signal(this,"onmouseover",_120);
 }
-if((_114==null)&&(this.event_isinside!=null)){
-signal(this,"onmouseout",_115);
+if((_119==null)&&(this.event_isinside!=null)){
+signal(this,"onmouseout",_120);
 }
-if((_114!=null)&&(this.event_isinside!=null)){
-signal(this,"onmousemove",_115);
+if((_119!=null)&&(this.event_isinside!=null)){
+signal(this,"onmousemove",_120);
 }
-this.event_isinside=_114;
+this.event_isinside=_119;
 };
-PlotKit.CanvasRenderer.isSupported=function(_116){
-var _117=null;
+PlotKit.CanvasRenderer.isSupported=function(_121){
+var _122=null;
 try{
-if(MochiKit.Base.isUndefinedOrNull(_116)){
-_117=MochiKit.DOM.CANVAS({});
+if(MochiKit.Base.isUndefinedOrNull(_121)){
+_122=MochiKit.DOM.CANVAS({});
 }else{
-_117=MochiKit.DOM.getElement(_116);
+_122=MochiKit.DOM.getElement(_121);
 }
-var _118=_117.getContext("2d");
+var _123=_122.getContext("2d");
 }
 catch(e){
 var ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
-var _120=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
-if((!ie)||(ie[1]<6)||(_120)){
+var _125=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
+if((!ie)||(ie[1]<6)||(_125)){
 return false;
 }
 return true;
@@ -4603,11 +4630,11 @@ MochiKit.Base._exportSymbols(this,PlotKit.Canvas);
 
 
 Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};
-DateGraphLayout=function(_1){
+DygraphLayout=function(_1){
 PlotKit.Layout.call(this,"line",_1);
 };
-DateGraphLayout.prototype=new PlotKit.Layout();
-DateGraphLayout.prototype.evaluateWithError=function(){
+DygraphLayout.prototype=new PlotKit.Layout();
+DygraphLayout.prototype.evaluateWithError=function(){
 this.evaluate();
 if(!this.options.errorBars){
 return;
@@ -4630,14 +4657,14 @@ this.points[i].errorPlus=parseFloat(_6[3]);
 }
 }
 };
-DateGraphLayout.prototype.removeAllDatasets=function(){
+DygraphLayout.prototype.removeAllDatasets=function(){
 delete this.datasets;
 this.datasets=new Array();
 };
-DateGraphLayout.prototype.updateOptions=function(_9){
+DygraphLayout.prototype.updateOptions=function(_9){
 MochiKit.Base.update(this.options,_9?_9:{});
 };
-DateGraphCanvasRenderer=function(_10,_11,_12){
+DygraphCanvasRenderer=function(_10,_11,_12){
 PlotKit.CanvasRenderer.call(this,_10,_11,_12);
 this.options.shouldFill=false;
 this.options.shouldStroke=true;
@@ -4647,10 +4674,8 @@ this.options.gridLineColor=MochiKit.Color.Color.grayColor();
 MochiKit.Base.update(this.options,_12);
 this.options.drawBackground=false;
 };
-DateGraphCanvasRenderer.prototype=new PlotKit.CanvasRenderer();
-DateGraphCanvasRenderer.prototype.render=function(){
-this._renderLineChart();
-this._renderLineAxis();
+DygraphCanvasRenderer.prototype=new PlotKit.CanvasRenderer();
+DygraphCanvasRenderer.prototype.render=function(){
 var ctx=this.element.getContext("2d");
 if(this.options.drawYGrid){
 var _14=this.layout.yticks;
@@ -4682,8 +4707,10 @@ ctx.closePath();
 ctx.stroke();
 }
 }
+this._renderLineChart();
+this._renderLineAxis();
 };
-DateGraphCanvasRenderer.prototype._renderLineChart=function(){
+DygraphCanvasRenderer.prototype._renderLineChart=function(){
 var _17=this.element.getContext("2d");
 var _18=this.options.colorScheme.length;
 var _19=this.options.colorScheme;
@@ -4765,79 +4792,130 @@ _23(_35,this)(_17);
 _23(_27,this)(_17);
 _17.restore();
 };
-DateGraph=function(div,_49,_50,_51){
+Dygraph=function(div,_49,_50){
 if(arguments.length>0){
-this.__init__(div,_49,_50,_51);
+if(arguments.length==4){
+this.warn("Using deprecated four-argument dygraph constructor");
+this.__old_init__(div,_49,arguments[2],arguments[3]);
+}else{
+this.__init__(div,_49,_50);
+}
 }
 };
-DateGraph.NAME="DateGraph";
-DateGraph.VERSION="1.1";
-DateGraph.__repr__=function(){
+Dygraph.NAME="Dygraph";
+Dygraph.VERSION="1.2";
+Dygraph.__repr__=function(){
 return "["+this.NAME+" "+this.VERSION+"]";
 };
-DateGraph.toString=function(){
+Dygraph.toString=function(){
 return this.__repr__();
 };
-DateGraph.DEFAULT_ROLL_PERIOD=1;
-DateGraph.DEFAULT_WIDTH=480;
-DateGraph.DEFAULT_HEIGHT=320;
-DateGraph.DEFAULT_STROKE_WIDTH=1;
-DateGraph.AXIS_LINE_WIDTH=0.3;
-DateGraph.prototype.__init__=function(div,_52,_53,_54){
+Dygraph.DEFAULT_ROLL_PERIOD=1;
+Dygraph.DEFAULT_WIDTH=480;
+Dygraph.DEFAULT_HEIGHT=320;
+Dygraph.AXIS_LINE_WIDTH=0.3;
+Dygraph.DEFAULT_ATTRS={highlightCircleSize:3,pixelsPerXLabel:60,pixelsPerYLabel:30,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:false,labelsKMB:false,strokeWidth:1,axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:false,xValueFormatter:Dygraph.dateString_,xValueParser:Dygraph.dateParser,xTicker:Dygraph.dateTicker,sigma:2,errorBars:false,fractions:false,wilsonInterval:true,customBars:false};
+Dygraph.DEBUG=1;
+Dygraph.INFO=2;
+Dygraph.WARNING=3;
+Dygraph.ERROR=3;
+Dygraph.prototype.__old_init__=function(div,_51,_52,_53){
+if(_52!=null){
+var _54=["Date"];
+for(var i=0;i<_52.length;i++){
+_54.push(_52[i]);
+}
+MochiKit.Base.update(_53,{"labels":_54});
+}
+this.__init__(div,_51,_53);
+};
+Dygraph.prototype.__init__=function(div,_55,_56){
+if(_56==null){
+_56={};
+}
 this.maindiv_=div;
-this.labels_=_53;
-this.file_=_52;
-this.rollPeriod_=_54.rollPeriod||DateGraph.DEFAULT_ROLL_PERIOD;
+this.file_=_55;
+this.rollPeriod_=_56.rollPeriod||Dygraph.DEFAULT_ROLL_PERIOD;
 this.previousVerticalX_=-1;
+this.fractions_=_56.fractions||false;
+this.dateWindow_=_56.dateWindow||null;
+this.valueRange_=_56.valueRange||null;
+this.wilsonInterval_=_56.wilsonInterval||true;
+this.customBars_=_56.customBars||false;
+if(div.style.width==""){
+div.style.width=Dygraph.DEFAULT_WIDTH+"px";
+}
+if(div.style.height==""){
+div.style.height=Dygraph.DEFAULT_HEIGHT+"px";
+}
 this.width_=parseInt(div.style.width,10);
 this.height_=parseInt(div.style.height,10);
-this.errorBars_=_54.errorBars||false;
-this.fractions_=_54.fractions||false;
-this.strokeWidth_=_54.strokeWidth||DateGraph.DEFAULT_STROKE_WIDTH;
-this.dateWindow_=_54.dateWindow||null;
-this.valueRange_=_54.valueRange||null;
-this.labelsSeparateLines=_54.labelsSeparateLines||false;
-this.labelsDiv_=_54.labelsDiv||null;
-this.labelsKMB_=_54.labelsKMB||false;
-this.minTickSize_=_54.minTickSize||0;
-this.xValueParser_=_54.xValueParser||DateGraph.prototype.dateParser;
-this.xValueFormatter_=_54.xValueFormatter||DateGraph.prototype.dateString_;
-this.xTicker_=_54.xTicker||DateGraph.prototype.dateTicker;
-this.sigma_=_54.sigma||2;
-this.wilsonInterval_=_54.wilsonInterval||true;
-this.customBars_=_54.customBars||false;
-this.attrs_=_54;
-if(typeof this.attrs_.pixelsPerXLabel=="undefined"){
-this.attrs_.pixelsPerXLabel=60;
-}
-this.labelsFromCSV_=(this.labels_==null);
-if(this.labels_==null){
-this.labels_=[];
-}
-this.clickCallback_=_54.clickCallback||null;
-this.zoomCallback_=_54.zoomCallback||null;
+this.user_attrs_={};
+MochiKit.Base.update(this.user_attrs_,_56);
+this.attrs_={};
+MochiKit.Base.update(this.attrs_,Dygraph.DEFAULT_ATTRS);
+this.labelsFromCSV_=(this.attr_("labels")==null);
 this.createInterface_();
-this.layoutOptions_={"errorBars":(this.errorBars_||this.customBars_),"xOriginIsZero":false};
-MochiKit.Base.update(this.layoutOptions_,_54);
-this.setColors_(_54);
-this.layout_=new DateGraphLayout(this.layoutOptions_);
-this.renderOptions_={colorScheme:this.colors_,strokeColor:null,strokeWidth:this.strokeWidth_,axisLabelFontSize:14,axisLineWidth:DateGraph.AXIS_LINE_WIDTH};
-MochiKit.Base.update(this.renderOptions_,_54);
-this.plotter_=new DateGraphCanvasRenderer(this.hidden_,this.layout_,this.renderOptions_);
+this.layoutOptions_={"errorBars":(this.attr_("errorBars")||this.customBars_),"xOriginIsZero":false};
+MochiKit.Base.update(this.layoutOptions_,this.attrs_);
+MochiKit.Base.update(this.layoutOptions_,this.user_attrs_);
+this.layout_=new DygraphLayout(this.layoutOptions_);
+this.renderOptions_={colorScheme:this.colors_,strokeColor:null,axisLineWidth:Dygraph.AXIS_LINE_WIDTH};
+MochiKit.Base.update(this.renderOptions_,this.attrs_);
+MochiKit.Base.update(this.renderOptions_,this.user_attrs_);
+this.plotter_=new DygraphCanvasRenderer(this.hidden_,this.layout_,this.renderOptions_);
 this.createStatusMessage_();
 this.createRollInterface_();
 this.createDragInterface_();
 this.start_();
 };
-DateGraph.prototype.rollPeriod=function(){
+Dygraph.prototype.attr_=function(_57){
+if(typeof (this.user_attrs_[_57])!="undefined"){
+return this.user_attrs_[_57];
+}else{
+if(typeof (this.attrs_[_57])!="undefined"){
+return this.attrs_[_57];
+}else{
+return null;
+}
+}
+};
+Dygraph.prototype.log=function(_58,_59){
+if(typeof (console)!="undefined"){
+switch(_58){
+case Dygraph.DEBUG:
+console.debug("dygraphs: "+_59);
+break;
+case Dygraph.INFO:
+console.info("dygraphs: "+_59);
+break;
+case Dygraph.WARNING:
+console.warn("dygraphs: "+_59);
+break;
+case Dygraph.ERROR:
+console.error("dygraphs: "+_59);
+break;
+}
+}
+};
+Dygraph.prototype.info=function(_60){
+this.log(Dygraph.INFO,_60);
+};
+Dygraph.prototype.warn=function(_61){
+this.log(Dygraph.WARNING,_61);
+};
+Dygraph.prototype.error=function(_62){
+this.log(Dygraph.ERROR,_62);
+};
+Dygraph.prototype.rollPeriod=function(){
 return this.rollPeriod_;
 };
-DateGraph.prototype.createInterface_=function(){
-var _55=this.maindiv_;
+Dygraph.prototype.createInterface_=function(){
+var _63=this.maindiv_;
 this.graphDiv=MochiKit.DOM.DIV({style:{"width":this.width_+"px","height":this.height_+"px"}});
-appendChildNodes(_55,this.graphDiv);
-var _56=MochiKit.DOM.CANVAS;
-this.canvas_=_56({style:{"position":"absolute"},width:this.width_,height:this.height_});
+appendChildNodes(_63,this.graphDiv);
+var _64=MochiKit.DOM.CANVAS;
+this.canvas_=_64({style:{"position":"absolute"},width:this.width_,height:this.height_});
 appendChildNodes(this.graphDiv,this.canvas_);
 this.hidden_=this.createPlotKitCanvas_(this.canvas_);
 connect(this.hidden_,"onmousemove",this,function(e){
@@ -4847,475 +4925,511 @@ connect(this.hidden_,"onmouseout",this,function(e){
 this.mouseOut_(e);
 });
 };
-DateGraph.prototype.createPlotKitCanvas_=function(_58){
+Dygraph.prototype.createPlotKitCanvas_=function(_66){
 var h=document.createElement("canvas");
 h.style.position="absolute";
-h.style.top=_58.style.top;
-h.style.left=_58.style.left;
+h.style.top=_66.style.top;
+h.style.left=_66.style.left;
 h.width=this.width_;
 h.height=this.height_;
 MochiKit.DOM.appendChildNodes(this.graphDiv,h);
 return h;
 };
-DateGraph.prototype.setColors_=function(_60){
-var num=this.labels_.length;
+Dygraph.prototype.setColors_=function(){
+var num=this.attr_("labels").length-1;
 this.colors_=[];
-if(!_60.colors){
-var sat=_60.colorSaturation||1;
-var val=_60.colorValue||0.5;
+var _69=this.attr_("colors");
+if(!_69){
+var sat=this.attr_("colorSaturation")||1;
+var val=this.attr_("colorValue")||0.5;
 for(var i=1;i<=num;i++){
 var hue=(1*i/(1+num));
 this.colors_.push(MochiKit.Color.Color.fromHSV(hue,sat,val));
 }
 }else{
 for(var i=0;i<num;i++){
-var _65=_60.colors[i%_60.colors.length];
-this.colors_.push(MochiKit.Color.Color.fromString(_65));
+var _73=_69[i%_69.length];
+this.colors_.push(MochiKit.Color.Color.fromString(_73));
 }
 }
+this.renderOptions_.colorScheme=this.colors_;
+MochiKit.Base.update(this.plotter_.options,this.renderOptions_);
+MochiKit.Base.update(this.layoutOptions_,this.user_attrs_);
+MochiKit.Base.update(this.layoutOptions_,this.attrs_);
 };
-DateGraph.prototype.createStatusMessage_=function(){
-if(!this.labelsDiv_){
-var _66=250;
-var _67={"style":{"position":"absolute","fontSize":"14px","zIndex":10,"width":_66+"px","top":"0px","left":this.width_-_66+"px","background":"white","textAlign":"left","overflow":"hidden"}};
-this.labelsDiv_=MochiKit.DOM.DIV(_67);
-MochiKit.DOM.appendChildNodes(this.graphDiv,this.labelsDiv_);
+Dygraph.prototype.createStatusMessage_=function(){
+if(!this.attr_("labelsDiv")){
+var _74=this.attr_("labelsDivWidth");
+var _75={"style":{"position":"absolute","fontSize":"14px","zIndex":10,"width":_74+"px","top":"0px","left":(this.width_-_74-2)+"px","background":"white","textAlign":"left","overflow":"hidden"}};
+MochiKit.Base.update(_75["style"],this.attr_("labelsDivStyles"));
+var div=MochiKit.DOM.DIV(_75);
+MochiKit.DOM.appendChildNodes(this.graphDiv,div);
+this.attrs_.labelsDiv=div;
 }
 };
-DateGraph.prototype.createRollInterface_=function(){
-var _68=this.plotter_.options.padding;
-if(typeof this.attrs_.showRoller=="undefined"){
-this.attrs_.showRoller=false;
-}
-var _69=this.attrs_.showRoller?"block":"none";
-var _70={"type":"text","size":"2","value":this.rollPeriod_,"style":{"position":"absolute","zIndex":10,"top":(this.height_-25-_68.bottom)+"px","left":(_68.left+1)+"px","display":_69}};
-var _71=MochiKit.DOM.INPUT(_70);
+Dygraph.prototype.createRollInterface_=function(){
+var _76=this.attr_("showRoller")?"block":"none";
+var _77={"type":"text","size":"2","value":this.rollPeriod_,"style":{"position":"absolute","zIndex":10,"top":(this.plotter_.area.h-25)+"px","left":(this.plotter_.area.x+1)+"px","display":_76}};
+var _78=MochiKit.DOM.INPUT(_77);
 var pa=this.graphDiv;
-MochiKit.DOM.appendChildNodes(pa,_71);
-connect(_71,"onchange",this,function(){
-this.adjustRoll(_71.value);
+MochiKit.DOM.appendChildNodes(pa,_78);
+connect(_78,"onchange",this,function(){
+this.adjustRoll(_78.value);
 });
-return _71;
-};
-DateGraph.prototype.createDragInterface_=function(){
-var _73=this;
-var _74=false;
-var _75=null;
-var _76=null;
-var _77=null;
-var _78=null;
-var _79=null;
+return _78;
+};
+Dygraph.prototype.createDragInterface_=function(){
+var _80=this;
+var _81=false;
+var _82=null;
+var _83=null;
+var _84=null;
+var _85=null;
+var _86=null;
 var px=0;
 var py=0;
-var _82=function(e){
+var _89=function(e){
 return e.mouse().page.x-px;
 };
-var _83=function(e){
+var _90=function(e){
 return e.mouse().page.y-py;
 };
-connect(this.hidden_,"onmousemove",function(_84){
-if(_74){
-_77=_82(_84);
-_78=_83(_84);
-_73.drawZoomRect_(_75,_77,_79);
-_79=_77;
+connect(this.hidden_,"onmousemove",function(_91){
+if(_81){
+_84=_89(_91);
+_85=_90(_91);
+_80.drawZoomRect_(_82,_84,_86);
+_86=_84;
 }
 });
-connect(this.hidden_,"onmousedown",function(_85){
-_74=true;
-px=PlotKit.Base.findPosX(_73.canvas_);
-py=PlotKit.Base.findPosY(_73.canvas_);
-_75=_82(_85);
-_76=_83(_85);
+connect(this.hidden_,"onmousedown",function(_92){
+_81=true;
+px=PlotKit.Base.findPosX(_80.canvas_);
+py=PlotKit.Base.findPosY(_80.canvas_);
+_82=_89(_92);
+_83=_90(_92);
 });
-connect(document,"onmouseup",this,function(_86){
-if(_74){
-_74=false;
-_75=null;
-_76=null;
+connect(document,"onmouseup",this,function(_93){
+if(_81){
+_81=false;
+_82=null;
+_83=null;
 }
 });
-connect(this.hidden_,"onmouseout",this,function(_87){
-if(_74){
-_77=null;
-_78=null;
+connect(this.hidden_,"onmouseout",this,function(_94){
+if(_81){
+_84=null;
+_85=null;
 }
 });
-connect(this.hidden_,"onmouseup",this,function(_88){
-if(_74){
-_74=false;
-_77=_82(_88);
-_78=_83(_88);
-var _89=Math.abs(_77-_75);
-var _90=Math.abs(_78-_76);
-if(_89<2&&_90<2&&_73.clickCallback_!=null&&_73.lastx_!=undefined){
-_73.clickCallback_(_88,new Date(_73.lastx_));
+connect(this.hidden_,"onmouseup",this,function(_95){
+if(_81){
+_81=false;
+_84=_89(_95);
+_85=_90(_95);
+var _96=Math.abs(_84-_82);
+var _97=Math.abs(_85-_83);
+if(_96<2&&_97<2&&_80.attr_("clickCallback")!=null&&_80.lastx_!=undefined){
+_80.attr_("clickCallback")(_95,new Date(_80.lastx_));
 }
-if(_89>=10){
-_73.doZoom_(Math.min(_75,_77),Math.max(_75,_77));
+if(_96>=10){
+_80.doZoom_(Math.min(_82,_84),Math.max(_82,_84));
 }else{
-_73.canvas_.getContext("2d").clearRect(0,0,_73.canvas_.width,_73.canvas_.height);
+_80.canvas_.getContext("2d").clearRect(0,0,_80.canvas_.width,_80.canvas_.height);
 }
-_75=null;
-_76=null;
+_82=null;
+_83=null;
 }
 });
-connect(this.hidden_,"ondblclick",this,function(_91){
-_73.dateWindow_=null;
-_73.drawGraph_(_73.rawData_);
-var _92=_73.rawData_[0][0];
-var _93=_73.rawData_[_73.rawData_.length-1][0];
-if(_73.zoomCallback_){
-_73.zoomCallback_(_92,_93);
+connect(this.hidden_,"ondblclick",this,function(_98){
+_80.dateWindow_=null;
+_80.drawGraph_(_80.rawData_);
+var _99=_80.rawData_[0][0];
+var _100=_80.rawData_[_80.rawData_.length-1][0];
+if(_80.attr_("zoomCallback")){
+_80.attr_("zoomCallback")(_99,_100);
 }
 });
 };
-DateGraph.prototype.drawZoomRect_=function(_94,_95,_96){
+Dygraph.prototype.drawZoomRect_=function(_101,endX,_103){
 var ctx=this.canvas_.getContext("2d");
-if(_96){
-ctx.clearRect(Math.min(_94,_96),0,Math.abs(_94-_96),this.height_);
+if(_103){
+ctx.clearRect(Math.min(_101,_103),0,Math.abs(_101-_103),this.height_);
 }
-if(_95&&_94){
+if(endX&&_101){
 ctx.fillStyle="rgba(128,128,128,0.33)";
-ctx.fillRect(Math.min(_94,_95),0,Math.abs(_95-_94),this.height_);
+ctx.fillRect(Math.min(_101,endX),0,Math.abs(endX-_101),this.height_);
 }
 };
-DateGraph.prototype.doZoom_=function(_97,_98){
-var _99=this.layout_.points;
-var _100=null;
-var _101=null;
-for(var i=0;i<_99.length;i++){
-var cx=_99[i].canvasx;
-var x=_99[i].xval;
-if(cx<_97&&(_100==null||x>_100)){
-_100=x;
+Dygraph.prototype.doZoom_=function(lowX,_105){
+var _106=this.layout_.points;
+var _107=null;
+var _108=null;
+for(var i=0;i<_106.length;i++){
+var cx=_106[i].canvasx;
+var x=_106[i].xval;
+if(cx<lowX&&(_107==null||x>_107)){
+_107=x;
 }
-if(cx>_98&&(_101==null||x<_101)){
-_101=x;
+if(cx>_105&&(_108==null||x<_108)){
+_108=x;
 }
 }
-if(_100==null){
-_100=_99[0].xval;
+if(_107==null){
+_107=_106[0].xval;
 }
-if(_101==null){
-_101=_99[_99.length-1].xval;
+if(_108==null){
+_108=_106[_106.length-1].xval;
 }
-this.dateWindow_=[_100,_101];
+this.dateWindow_=[_107,_108];
 this.drawGraph_(this.rawData_);
-if(this.zoomCallback_){
-this.zoomCallback_(_100,_101);
+if(this.attr_("zoomCallback")){
+this.attr_("zoomCallback")(_107,_108);
 }
 };
-DateGraph.prototype.mouseMove_=function(_103){
-var _104=_103.mouse().page.x-PlotKit.Base.findPosX(this.hidden_);
-var _105=this.layout_.points;
-var _106=-1;
-var _107=-1;
-var _108=1e+100;
+Dygraph.prototype.mouseMove_=function(_110){
+var _111=_110.mouse().page.x-PlotKit.Base.findPosX(this.hidden_);
+var _112=this.layout_.points;
+var _113=-1;
+var _114=-1;
+var _115=1e+100;
 var idx=-1;
-for(var i=0;i<_105.length;i++){
-var dist=Math.abs(_105[i].canvasx-_104);
-if(dist>_108){
+for(var i=0;i<_112.length;i++){
+var dist=Math.abs(_112[i].canvasx-_111);
+if(dist>_115){
 break;
 }
-_108=dist;
+_115=dist;
 idx=i;
 }
 if(idx>=0){
-_106=_105[idx].xval;
+_113=_112[idx].xval;
 }
-if(_104>_105[_105.length-1].canvasx){
-_106=_105[_105.length-1].xval;
+if(_111>_112[_112.length-1].canvasx){
+_113=_112[_112.length-1].xval;
 }
-var _111=[];
-for(var i=0;i<_105.length;i++){
-if(_105[i].xval==_106){
-_111.push(_105[i]);
+var _118=[];
+for(var i=0;i<_112.length;i++){
+if(_112[i].xval==_113){
+_118.push(_112[i]);
 }
 }
-var _112=3;
+var _119=this.attr_("highlightCircleSize");
 var ctx=this.canvas_.getContext("2d");
 if(this.previousVerticalX_>=0){
 var px=this.previousVerticalX_;
-ctx.clearRect(px-_112-1,0,2*_112+2,this.height_);
+ctx.clearRect(px-_119-1,0,2*_119+2,this.height_);
 }
-if(_111.length>0){
-var _104=_111[0].canvasx;
-var _113=this.xValueFormatter_(_106)+":";
+if(_118.length>0){
+var _111=_118[0].canvasx;
+var _120=this.attr_("xValueFormatter")(_113,this)+":";
 var clen=this.colors_.length;
-for(var i=0;i<_111.length;i++){
-if(this.labelsSeparateLines){
-_113+="<br/>";
+for(var i=0;i<_118.length;i++){
+if(this.attr_("labelsSeparateLines")){
+_120+="<br/>";
 }
-var _115=_111[i];
-_113+=" <b><font color='"+this.colors_[i%clen].toHexString()+"'>"+_115.name+"</font></b>:"+this.round_(_115.yval,2);
+var _122=_118[i];
+_120+=" <b><font color='"+this.colors_[i%clen].toHexString()+"'>"+_122.name+"</font></b>:"+this.round_(_122.yval,2);
 }
-this.labelsDiv_.innerHTML=_113;
-this.lastx_=_106;
+this.attr_("labelsDiv").innerHTML=_120;
+this.lastx_=_113;
 ctx.save();
-for(var i=0;i<_111.length;i++){
+for(var i=0;i<_118.length;i++){
 ctx.beginPath();
 ctx.fillStyle=this.colors_[i%clen].toRGBString();
-ctx.arc(_104,_111[i%clen].canvasy,_112,0,360,false);
+ctx.arc(_111,_118[i%clen].canvasy,_119,0,360,false);
 ctx.fill();
 }
 ctx.restore();
-this.previousVerticalX_=_104;
+this.previousVerticalX_=_111;
 }
 };
-DateGraph.prototype.mouseOut_=function(_116){
+Dygraph.prototype.mouseOut_=function(_123){
 var ctx=this.canvas_.getContext("2d");
 ctx.clearRect(0,0,this.width_,this.height_);
-this.labelsDiv_.innerHTML="";
+this.attr_("labelsDiv").innerHTML="";
 };
-DateGraph.zeropad=function(x){
+Dygraph.zeropad=function(x){
 if(x<10){
 return "0"+x;
 }else{
 return ""+x;
 }
 };
-DateGraph.prototype.hmsString_=function(date){
-var _118=DateGraph.zeropad;
+Dygraph.prototype.hmsString_=function(date){
+var _125=Dygraph.zeropad;
 var d=new Date(date);
 if(d.getSeconds()){
-return _118(d.getHours())+":"+_118(d.getMinutes())+":"+_118(d.getSeconds());
+return _125(d.getHours())+":"+_125(d.getMinutes())+":"+_125(d.getSeconds());
 }else{
 if(d.getMinutes()){
-return _118(d.getHours())+":"+_118(d.getMinutes());
+return _125(d.getHours())+":"+_125(d.getMinutes());
 }else{
-return _118(d.getHours());
+return _125(d.getHours());
 }
 }
 };
-DateGraph.prototype.dateString_=function(date){
-var _120=DateGraph.zeropad;
+Dygraph.dateString_=function(date,self){
+var _128=Dygraph.zeropad;
 var d=new Date(date);
 var year=""+d.getFullYear();
-var _122=_120(d.getMonth()+1);
-var day=_120(d.getDate());
+var _130=_128(d.getMonth()+1);
+var day=_128(d.getDate());
 var ret="";
 var frac=d.getHours()*3600+d.getMinutes()*60+d.getSeconds();
 if(frac){
-ret=" "+this.hmsString_(date);
+ret=" "+self.hmsString_(date);
 }
-return year+"/"+_122+"/"+day+ret;
+return year+"/"+_130+"/"+day+ret;
 };
-DateGraph.prototype.round_=function(num,_126){
-var _127=Math.pow(10,_126);
-return Math.round(num*_127)/_127;
+Dygraph.prototype.round_=function(num,_134){
+var _135=Math.pow(10,_134);
+return Math.round(num*_135)/_135;
 };
-DateGraph.prototype.loadedEvent_=function(data){
+Dygraph.prototype.loadedEvent_=function(data){
 this.rawData_=this.parseCSV_(data);
 this.drawGraph_(this.rawData_);
 };
-DateGraph.prototype.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
-DateGraph.prototype.quarters=["Jan","Apr","Jul","Oct"];
-DateGraph.prototype.addXTicks_=function(){
-var _129,endDate;
+Dygraph.prototype.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
+Dygraph.prototype.quarters=["Jan","Apr","Jul","Oct"];
+Dygraph.prototype.addXTicks_=function(){
+var _137,endDate;
 if(this.dateWindow_){
-_129=this.dateWindow_[0];
+_137=this.dateWindow_[0];
 endDate=this.dateWindow_[1];
 }else{
-_129=this.rawData_[0][0];
+_137=this.rawData_[0][0];
 endDate=this.rawData_[this.rawData_.length-1][0];
 }
-var _130=this.xTicker_(_129,endDate);
-this.layout_.updateOptions({xTicks:_130});
-};
-DateGraph.SECONDLY=0;
-DateGraph.MINUTELY=1;
-DateGraph.HOURLY=2;
-DateGraph.DAILY=3;
-DateGraph.WEEKLY=4;
-DateGraph.MONTHLY=5;
-DateGraph.QUARTERLY=6;
-DateGraph.BIANNUAL=7;
-DateGraph.ANNUAL=8;
-DateGraph.DECADAL=9;
-DateGraph.NUM_GRANULARITIES=10;
-DateGraph.SHORT_SPACINGS=[];
-DateGraph.SHORT_SPACINGS[DateGraph.SECONDLY]=1000*1;
-DateGraph.SHORT_SPACINGS[DateGraph.MINUTELY]=1000*60;
-DateGraph.SHORT_SPACINGS[DateGraph.HOURLY]=1000*3600;
-DateGraph.SHORT_SPACINGS[DateGraph.DAILY]=1000*86400;
-DateGraph.SHORT_SPACINGS[DateGraph.WEEKLY]=1000*604800;
-DateGraph.prototype.NumXTicks=function(_131,_132,_133){
-if(_133<DateGraph.MONTHLY){
-var _134=DateGraph.SHORT_SPACINGS[_133];
-return Math.floor(0.5+1*(_132-_131)/_134);
-}else{
-var _135=1;
-var _136=12;
-if(_133==DateGraph.QUARTERLY){
-_136=3;
-}
-if(_133==DateGraph.BIANNUAL){
-_136=2;
-}
-if(_133==DateGraph.ANNUAL){
-_136=1;
-}
-if(_133==DateGraph.DECADAL){
-_136=1;
-_135=10;
-}
-var _137=365.2524*24*3600*1000;
-var _138=1*(_132-_131)/_137;
-return Math.floor(0.5+1*_138*_136/_135);
-}
-};
-DateGraph.prototype.GetXAxis=function(_139,_140,_141){
-var _142=[];
-if(_141<DateGraph.MONTHLY){
-var _143=DateGraph.SHORT_SPACINGS[_141];
-var _144="%d%b";
-for(var t=_139;t<=_140;t+=_143){
+var _138=this.attr_("xTicker")(_137,endDate,this);
+this.layout_.updateOptions({xTicks:_138});
+};
+Dygraph.SECONDLY=0;
+Dygraph.TEN_SECONDLY=1;
+Dygraph.THIRTY_SECONDLY=2;
+Dygraph.MINUTELY=3;
+Dygraph.TEN_MINUTELY=4;
+Dygraph.THIRTY_MINUTELY=5;
+Dygraph.HOURLY=6;
+Dygraph.SIX_HOURLY=7;
+Dygraph.DAILY=8;
+Dygraph.WEEKLY=9;
+Dygraph.MONTHLY=10;
+Dygraph.QUARTERLY=11;
+Dygraph.BIANNUAL=12;
+Dygraph.ANNUAL=13;
+Dygraph.DECADAL=14;
+Dygraph.NUM_GRANULARITIES=15;
+Dygraph.SHORT_SPACINGS=[];
+Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY]=1000*1;
+Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY]=1000*10;
+Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY]=1000*30;
+Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY]=1000*60;
+Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY]=1000*60*10;
+Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY]=1000*60*30;
+Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600;
+Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600*6;
+Dygraph.SHORT_SPACINGS[Dygraph.DAILY]=1000*86400;
+Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY]=1000*604800;
+Dygraph.prototype.NumXTicks=function(_139,_140,_141){
+if(_141<Dygraph.MONTHLY){
+var _142=Dygraph.SHORT_SPACINGS[_141];
+return Math.floor(0.5+1*(_140-_139)/_142);
+}else{
+var _143=1;
+var _144=12;
+if(_141==Dygraph.QUARTERLY){
+_144=3;
+}
+if(_141==Dygraph.BIANNUAL){
+_144=2;
+}
+if(_141==Dygraph.ANNUAL){
+_144=1;
+}
+if(_141==Dygraph.DECADAL){
+_144=1;
+_143=10;
+}
+var _145=365.2524*24*3600*1000;
+var _146=1*(_140-_139)/_145;
+return Math.floor(0.5+1*_146*_144/_143);
+}
+};
+Dygraph.prototype.GetXAxis=function(_147,_148,_149){
+var _150=[];
+if(_149<Dygraph.MONTHLY){
+var _151=Dygraph.SHORT_SPACINGS[_149];
+var _152="%d%b";
+if(_149<Dygraph.HOURLY){
+_147=_151*Math.floor(0.5+_147/_151);
+}
+for(var t=_147;t<=_148;t+=_151){
 var d=new Date(t);
 var frac=d.getHours()*3600+d.getMinutes()*60+d.getSeconds();
-if(frac==0||_141>=DateGraph.DAILY){
-_142.push({v:t,label:new Date(t+3600*1000).strftime(_144)});
+if(frac==0||_149>=Dygraph.DAILY){
+_150.push({v:t,label:new Date(t+3600*1000).strftime(_152)});
 }else{
-_142.push({v:t,label:this.hmsString_(t)});
+_150.push({v:t,label:this.hmsString_(t)});
 }
 }
 }else{
-var _146;
-var _147=1;
-if(_141==DateGraph.MONTHLY){
-_146=[0,1,2,3,4,5,6,7,8,9,10,11,12];
+var _154;
+var _155=1;
+if(_149==Dygraph.MONTHLY){
+_154=[0,1,2,3,4,5,6,7,8,9,10,11,12];
 }else{
-if(_141==DateGraph.QUARTERLY){
-_146=[0,3,6,9];
+if(_149==Dygraph.QUARTERLY){
+_154=[0,3,6,9];
 }else{
-if(_141==DateGraph.BIANNUAL){
-_146=[0,6];
+if(_149==Dygraph.BIANNUAL){
+_154=[0,6];
 }else{
-if(_141==DateGraph.ANNUAL){
-_146=[0];
+if(_149==Dygraph.ANNUAL){
+_154=[0];
 }else{
-if(_141==DateGraph.DECADAL){
-_146=[0];
-_147=10;
+if(_149==Dygraph.DECADAL){
+_154=[0];
+_155=10;
 }
 }
 }
 }
 }
-var _148=new Date(_139).getFullYear();
-var _149=new Date(_140).getFullYear();
-var _150=DateGraph.zeropad;
-for(var i=_148;i<=_149;i++){
-if(i%_147!=0){
+var _156=new Date(_147).getFullYear();
+var _157=new Date(_148).getFullYear();
+var _158=Dygraph.zeropad;
+for(var i=_156;i<=_157;i++){
+if(i%_155!=0){
 continue;
 }
-for(var j=0;j<_146.length;j++){
-var _151=i+"/"+_150(1+_146[j])+"/01";
-var t=Date.parse(_151);
-if(t<_139||t>_140){
+for(var j=0;j<_154.length;j++){
+var _159=i+"/"+_158(1+_154[j])+"/01";
+var t=Date.parse(_159);
+if(t<_147||t>_148){
 continue;
 }
-_142.push({v:t,label:new Date(t).strftime("%b %y")});
+_150.push({v:t,label:new Date(t).strftime("%b %y")});
 }
 }
 }
-return _142;
+return _150;
 };
-DateGraph.prototype.dateTicker=function(_152,_153){
-var _154=-1;
-for(var i=0;i<DateGraph.NUM_GRANULARITIES;i++){
-var _155=this.NumXTicks(_152,_153,i);
-if(this.width_/_155>=this.attrs_.pixelsPerXLabel){
-_154=i;
+Dygraph.dateTicker=function(_160,_161,self){
+var _162=-1;
+for(var i=0;i<Dygraph.NUM_GRANULARITIES;i++){
+var _163=self.NumXTicks(_160,_161,i);
+if(self.width_/_163>=self.attr_("pixelsPerXLabel")){
+_162=i;
 break;
 }
 }
-if(_154>=0){
-return this.GetXAxis(_152,_153,_154);
+if(_162>=0){
+return self.GetXAxis(_160,_161,_162);
 }else{
 }
 };
-DateGraph.prototype.numericTicks=function(minV,maxV){
-var _158;
-if(maxV<=0){
-_158=1;
-}else{
-_158=Math.pow(10,Math.floor(Math.log(maxV)/Math.log(10)));
+Dygraph.numericTicks=function(minV,maxV,self){
+var _166=[1,2,5];
+var _167,low_val,high_val,nTicks;
+var _168=self.attr_("pixelsPerYLabel");
+for(var i=-10;i<50;i++){
+var _169=Math.pow(10,i);
+for(var j=0;j<_166.length;j++){
+_167=_169*_166[j];
+low_val=Math.floor(minV/_167)*_167;
+high_val=Math.ceil(maxV/_167)*_167;
+nTicks=(high_val-low_val)/_167;
+var _170=self.height_/nTicks;
+if(_170>_168){
+break;
 }
-var _159=(maxV-minV)/_158;
-while(2*_159<20){
-_159*=2;
 }
-if((maxV-minV)/_159<this.minTickSize_){
-_159=this.round_((maxV-minV)/this.minTickSize_,1);
+if(_170>_168){
+break;
+}
 }
-var _160=[];
-for(var i=0;i<=_159;i++){
-var _161=minV+i*(maxV-minV)/_159;
-var _162=this.round_(_161,2);
-if(this.labelsKMB_){
+var _171=[];
+for(var i=0;i<nTicks;i++){
+var _172=low_val+i*_167;
+var _173=self.round_(_172,2);
+if(self.attr_("labelsKMB")){
 var k=1000;
-if(_161>=k*k*k){
-_162=this.round_(_161/(k*k*k),1)+"B";
+if(_172>=k*k*k){
+_173=self.round_(_172/(k*k*k),1)+"B";
 }else{
-if(_161>=k*k){
-_162=this.round_(_161/(k*k),1)+"M";
+if(_172>=k*k){
+_173=self.round_(_172/(k*k),1)+"M";
 }else{
-if(_161>=k){
-_162=this.round_(_161/k,1)+"K";
+if(_172>=k){
+_173=self.round_(_172/k,1)+"K";
 }
 }
 }
 }
-_160.push({label:_162,v:_161});
+_171.push({label:_173,v:_172});
 }
-return _160;
+return _171;
 };
-DateGraph.prototype.addYTicks_=function(minY,maxY){
-var _166=this.numericTicks(minY,maxY);
-this.layout_.updateOptions({yAxis:[minY,maxY],yTicks:_166});
+Dygraph.prototype.addYTicks_=function(minY,maxY){
+var _177=Dygraph.numericTicks(minY,maxY,this);
+this.layout_.updateOptions({yAxis:[minY,maxY],yTicks:_177});
 };
-DateGraph.prototype.drawGraph_=function(data){
+Dygraph.prototype.drawGraph_=function(data){
 var maxY=null;
 this.layout_.removeAllDatasets();
+this.setColors_();
 for(var i=1;i<data[0].length;i++){
-var _167=[];
+var _178=[];
 for(var j=0;j<data.length;j++){
 var date=data[j][0];
-_167[j]=[date,data[j][i]];
+_178[j]=[date,data[j][i]];
 }
-_167=this.rollingAverage(_167,this.rollPeriod_);
-var bars=this.errorBars_||this.customBars_;
+_178=this.rollingAverage(_178,this.rollPeriod_);
+var bars=this.attr_("errorBars")||this.customBars_;
 if(this.dateWindow_){
 var low=this.dateWindow_[0];
 var high=this.dateWindow_[1];
-var _171=[];
-for(var k=0;k<_167.length;k++){
-if(_167[k][0]>=low&&_167[k][0]<=high){
-_171.push(_167[k]);
-var y=bars?_167[k][1][0]:_167[k][1];
+var _182=[];
+for(var k=0;k<_178.length;k++){
+if(_178[k][0]>=low&&_178[k][0]<=high){
+_182.push(_178[k]);
+var y=bars?_178[k][1][0]:_178[k][1];
 if(maxY==null||y>maxY){
 maxY=y;
 }
 }
 }
-_167=_171;
+_178=_182;
+}else{
+if(!this.customBars_){
+for(var j=0;j<_178.length;j++){
+var y=bars?_178[j][1][0]:_178[j][1];
+if(maxY==null||y>maxY){
+maxY=bars?y+_178[j][1][1]:y;
+}
+}
 }else{
-for(var j=0;j<_167.length;j++){
-var y=bars?_167[j][1][0]:_167[j][1];
+for(var j=0;j<_178.length;j++){
+var y=_178[j][1][0];
+var high=_178[j][1][2];
+if(high>y){
+y=high;
+}
 if(maxY==null||y>maxY){
-maxY=bars?y+_167[j][1][1]:y;
+maxY=y;
+}
 }
 }
 }
 if(bars){
 var vals=[];
-for(var j=0;j<_167.length;j++){
-vals[j]=[_167[j][0],_167[j][1][0],_167[j][1][1],_167[j][1][2]];
+for(var j=0;j<_178.length;j++){
+vals[j]=[_178[j][0],_178[j][1][0],_178[j][1][1],_178[j][1][2]];
 }
-this.layout_.addDataset(this.labels_[i-1],vals);
+this.layout_.addDataset(this.attr_("labels")[i],vals);
 }else{
-this.layout_.addDataset(this.labels_[i-1],_167);
+this.layout_.addDataset(this.attr_("labels")[i],_178);
 }
 }
 if(this.valueRange_!=null){
@@ -5324,9 +5438,6 @@ this.addYTicks_(this.valueRange_[0],this.valueRange_[1]);
 maxY*=1.1;
 if(maxY<=0){
 maxY=1;
-}else{
-var _173=Math.pow(10,Math.floor(Math.log(maxY)/Math.log(10)));
-maxY=_173*Math.ceil(maxY/_173);
 }
 this.addYTicks_(0,maxY);
 }
@@ -5336,44 +5447,44 @@ this.plotter_.clear();
 this.plotter_.render();
 this.canvas_.getContext("2d").clearRect(0,0,this.canvas_.width,this.canvas_.height);
 };
-DateGraph.prototype.rollingAverage=function(_174,_175){
-if(_174.length<2){
-return _174;
+Dygraph.prototype.rollingAverage=function(_184,_185){
+if(_184.length<2){
+return _184;
 }
-var _175=Math.min(_175,_174.length-1);
-var _176=[];
-var _177=this.sigma_;
+var _185=Math.min(_185,_184.length-1);
+var _186=[];
+var _187=this.attr_("sigma");
 if(this.fractions_){
 var num=0;
 var den=0;
 var mult=100;
-for(var i=0;i<_174.length;i++){
-num+=_174[i][1][0];
-den+=_174[i][1][1];
-if(i-_175>=0){
-num-=_174[i-_175][1][0];
-den-=_174[i-_175][1][1];
-}
-var date=_174[i][0];
-var _180=den?num/den:0;
-if(this.errorBars_){
+for(var i=0;i<_184.length;i++){
+num+=_184[i][1][0];
+den+=_184[i][1][1];
+if(i-_185>=0){
+num-=_184[i-_185][1][0];
+den-=_184[i-_185][1][1];
+}
+var date=_184[i][0];
+var _190=den?num/den:0;
+if(this.attr_("errorBars")){
 if(this.wilsonInterval_){
 if(den){
-var p=_180<0?0:_180,n=den;
-var pm=_177*Math.sqrt(p*(1-p)/n+_177*_177/(4*n*n));
-var _183=1+_177*_177/den;
-var low=(p+_177*_177/(2*den)-pm)/_183;
-var high=(p+_177*_177/(2*den)+pm)/_183;
-_176[i]=[date,[p*mult,(p-low)*mult,(high-p)*mult]];
+var p=_190<0?0:_190,n=den;
+var pm=_187*Math.sqrt(p*(1-p)/n+_187*_187/(4*n*n));
+var _193=1+_187*_187/den;
+var low=(p+_187*_187/(2*den)-pm)/_193;
+var high=(p+_187*_187/(2*den)+pm)/_193;
+_186[i]=[date,[p*mult,(p-low)*mult,(high-p)*mult]];
 }else{
-_176[i]=[date,[0,0,0]];
+_186[i]=[date,[0,0,0]];
 }
 }else{
-var _184=den?_177*Math.sqrt(_180*(1-_180)/den):1;
-_176[i]=[date,[mult*_180,mult*_184,mult*_184]];
+var _194=den?_187*Math.sqrt(_190*(1-_190)/den):1;
+_186[i]=[date,[mult*_190,mult*_194,mult*_194]];
 }
 }else{
-_176[i]=[date,mult*_180];
+_186[i]=[date,mult*_190];
 }
 }
 }else{
@@ -5381,157 +5492,240 @@ if(this.customBars_){
 var low=0;
 var mid=0;
 var high=0;
-var _186=0;
-for(var i=0;i<_174.length;i++){
-var data=_174[i][1];
+var _196=0;
+for(var i=0;i<_184.length;i++){
+var data=_184[i][1];
 var y=data[1];
-_176[i]=[_174[i][0],[y,y-data[0],data[2]-y]];
+_186[i]=[_184[i][0],[y,y-data[0],data[2]-y]];
 low+=data[0];
 mid+=y;
 high+=data[2];
-_186+=1;
-if(i-_175>=0){
-var prev=_174[i-_175];
+_196+=1;
+if(i-_185>=0){
+var prev=_184[i-_185];
 low-=prev[1][0];
 mid-=prev[1][1];
 high-=prev[1][2];
-_186-=1;
+_196-=1;
 }
-_176[i]=[_174[i][0],[1*mid/_186,1*(mid-low)/_186,1*(high-mid)/_186]];
+_186[i]=[_184[i][0],[1*mid/_196,1*(mid-low)/_196,1*(high-mid)/_196]];
 }
 }else{
-var _188=Math.min(_175-1,_174.length-2);
-if(!this.errorBars_){
-for(var i=0;i<_188;i++){
+var _198=Math.min(_185-1,_184.length-2);
+if(!this.attr_("errorBars")){
+for(var i=0;i<_198;i++){
 var sum=0;
 for(var j=0;j<i+1;j++){
-sum+=_174[j][1];
+sum+=_184[j][1];
 }
-_176[i]=[_174[i][0],sum/(i+1)];
+_186[i]=[_184[i][0],sum/(i+1)];
 }
-for(var i=Math.min(_175-1,_174.length-2);i<_174.length;i++){
+for(var i=Math.min(_185-1,_184.length-2);i<_184.length;i++){
 var sum=0;
-for(var j=i-_175+1;j<i+1;j++){
-sum+=_174[j][1];
+for(var j=i-_185+1;j<i+1;j++){
+sum+=_184[j][1];
 }
-_176[i]=[_174[i][0],sum/_175];
+_186[i]=[_184[i][0],sum/_185];
 }
 }else{
-for(var i=0;i<_188;i++){
+for(var i=0;i<_198;i++){
 var sum=0;
-var _190=0;
+var _200=0;
 for(var j=0;j<i+1;j++){
-sum+=_174[j][1][0];
-_190+=Math.pow(_174[j][1][1],2);
+sum+=_184[j][1][0];
+_200+=Math.pow(_184[j][1][1],2);
 }
-var _184=Math.sqrt(_190)/(i+1);
-_176[i]=[_174[i][0],[sum/(i+1),_177*_184,_177*_184]];
+var _194=Math.sqrt(_200)/(i+1);
+_186[i]=[_184[i][0],[sum/(i+1),_187*_194,_187*_194]];
 }
-for(var i=Math.min(_175-1,_174.length-2);i<_174.length;i++){
+for(var i=Math.min(_185-1,_184.length-2);i<_184.length;i++){
 var sum=0;
-var _190=0;
-for(var j=i-_175+1;j<i+1;j++){
-sum+=_174[j][1][0];
-_190+=Math.pow(_174[j][1][1],2);
+var _200=0;
+for(var j=i-_185+1;j<i+1;j++){
+sum+=_184[j][1][0];
+_200+=Math.pow(_184[j][1][1],2);
 }
-var _184=Math.sqrt(_190)/_175;
-_176[i]=[_174[i][0],[sum/_175,_177*_184,_177*_184]];
+var _194=Math.sqrt(_200)/_185;
+_186[i]=[_184[i][0],[sum/_185,_187*_194,_187*_194]];
 }
 }
 }
 }
-return _176;
+return _186;
 };
-DateGraph.prototype.dateParser=function(_191){
-var _192;
-if(_191.length==10&&_191.search("-")!=-1){
-_192=_191.replace("-","/","g");
-while(_192.search("-")!=-1){
-_192=_192.replace("-","/");
+Dygraph.dateParser=function(_201,self){
+var _202;
+var d;
+if(_201.length==10&&_201.search("-")!=-1){
+_202=_201.replace("-","/","g");
+while(_202.search("-")!=-1){
+_202=_202.replace("-","/");
 }
-return Date.parse(_192);
+d=Date.parse(_202);
 }else{
-if(_191.length==8){
-_192=_191.substr(0,4)+"/"+_191.substr(4,2)+"/"+_191.substr(6,2);
-return Date.parse(_192);
+if(_201.length==8){
+_202=_201.substr(0,4)+"/"+_201.substr(4,2)+"/"+_201.substr(6,2);
+d=Date.parse(_202);
 }else{
-return Date.parse(_191);
+d=Date.parse(_201);
 }
 }
+if(!d||isNaN(d)){
+self.error("Couldn't parse "+_201+" as a date");
+}
+return d;
 };
-DateGraph.prototype.parseCSV_=function(data){
+Dygraph.prototype.detectTypeFromString_=function(str){
+var _204=false;
+if(str.indexOf("-")>=0||str.indexOf("/")>=0||isNaN(parseFloat(str))){
+_204=true;
+}else{
+if(str.length==8&&str>"19700101"&&str<"20371231"){
+_204=true;
+}
+}
+if(_204){
+this.attrs_.xValueFormatter=Dygraph.dateString_;
+this.attrs_.xValueParser=Dygraph.dateParser;
+this.attrs_.xTicker=Dygraph.dateTicker;
+}else{
+this.attrs_.xValueFormatter=function(x){
+return x;
+};
+this.attrs_.xValueParser=function(x){
+return parseFloat(x);
+};
+this.attrs_.xTicker=Dygraph.numericTicks;
+}
+};
+Dygraph.prototype.parseCSV_=function(data){
 var ret=[];
-var _193=data.split("\n");
-var _194=this.labelsFromCSV_?1:0;
+var _205=data.split("\n");
+var _206=0;
 if(this.labelsFromCSV_){
-var _195=_193[0].split(",");
-_195.shift();
-this.labels_=_195;
-this.setColors_(this.attrs_);
-this.renderOptions_.colorScheme=this.colors_;
-MochiKit.Base.update(this.plotter_.options,this.renderOptions_);
-MochiKit.Base.update(this.layoutOptions_,this.attrs_);
-}
-for(var i=_194;i<_193.length;i++){
-var line=_193[i];
+_206=1;
+this.attrs_.labels=_205[0].split(",");
+}
+var _207;
+var _208=false;
+var _209=this.attr_("labels").length;
+for(var i=_206;i<_205.length;i++){
+var line=_205[i];
 if(line.length==0){
 continue;
 }
-var _197=line.split(",");
-if(_197.length<2){
+var _211=line.split(",");
+if(_211.length<2){
 continue;
 }
-var _198=[];
-_198[0]=this.xValueParser_(_197[0]);
+var _212=[];
+if(!_208){
+this.detectTypeFromString_(_211[0]);
+_207=this.attr_("xValueParser");
+_208=true;
+}
+_212[0]=_207(_211[0],this);
 if(this.fractions_){
-for(var j=1;j<_197.length;j++){
-var vals=_197[j].split("/");
-_198[j]=[parseFloat(vals[0]),parseFloat(vals[1])];
+for(var j=1;j<_211.length;j++){
+var vals=_211[j].split("/");
+_212[j]=[parseFloat(vals[0]),parseFloat(vals[1])];
 }
 }else{
-if(this.errorBars_){
-for(var j=1;j<_197.length;j+=2){
-_198[(j+1)/2]=[parseFloat(_197[j]),parseFloat(_197[j+1])];
+if(this.attr_("errorBars")){
+for(var j=1;j<_211.length;j+=2){
+_212[(j+1)/2]=[parseFloat(_211[j]),parseFloat(_211[j+1])];
 }
 }else{
 if(this.customBars_){
-for(var j=1;j<_197.length;j++){
-var vals=_197[j].split(";");
-_198[j]=[parseFloat(vals[0]),parseFloat(vals[1]),parseFloat(vals[2])];
+for(var j=1;j<_211.length;j++){
+var vals=_211[j].split(";");
+_212[j]=[parseFloat(vals[0]),parseFloat(vals[1]),parseFloat(vals[2])];
 }
 }else{
-for(var j=1;j<_197.length;j++){
-_198[j]=parseFloat(_197[j]);
+for(var j=1;j<_211.length;j++){
+_212[j]=parseFloat(_211[j]);
 }
 }
 }
 }
-ret.push(_198);
+ret.push(_212);
+if(_212.length!=_209){
+this.error("Number of columns in line "+i+" ("+_212.length+") does not agree with number of labels ("+_209+") "+line);
+}
 }
 return ret;
 };
-DateGraph.prototype.parseDataTable_=function(data){
+Dygraph.prototype.parseArray_=function(data){
+if(data.length==0){
+this.error("Can't plot empty data set");
+return null;
+}
+if(data[0].length==0){
+this.error("Data set cannot contain an empty row");
+return null;
+}
+if(this.attr_("labels")==null){
+this.warn("Using default labels. Set labels explicitly via 'labels' "+"in the options parameter");
+this.attrs_.labels=["X"];
+for(var i=1;i<data[0].length;i++){
+this.attrs_.labels.push("Y"+i);
+}
+}
+if(MochiKit.Base.isDateLike(data[0][0])){
+this.attrs_.xValueFormatter=Dygraph.dateString_;
+this.attrs_.xTicker=Dygraph.dateTicker;
+var _213=MochiKit.Base.clone(data);
+for(var i=0;i<data.length;i++){
+if(_213[i].length==0){
+this.error("Row "<<(1+i)<<" of data is empty");
+return null;
+}
+if(_213[i][0]==null||typeof (_213[i][0].getTime)!="function"){
+this.error("x value in row "<<(1+i)<<" is not a Date");
+return null;
+}
+_213[i][0]=_213[i][0].getTime();
+}
+return _213;
+}else{
+this.attrs_.xValueFormatter=function(x){
+return x;
+};
+this.attrs_.xTicker=Dygraph.numericTicks;
+return data;
+}
+};
+Dygraph.prototype.parseDataTable_=function(data){
 var cols=data.getNumberOfColumns();
 var rows=data.getNumberOfRows();
-var _201=[];
+var _216=[];
 for(var i=0;i<cols;i++){
-_201.push(data.getColumnLabel(i));
+_216.push(data.getColumnLabel(i));
 }
-_201.shift();
-this.labels_=_201;
-this.setColors_(this.attrs_);
-this.renderOptions_.colorScheme=this.colors_;
-MochiKit.Base.update(this.plotter_.options,this.renderOptions_);
-MochiKit.Base.update(this.layoutOptions_,this.attrs_);
-var _202=data.getColumnType(0);
-if(_202!="date"&&_202!="number"){
-alert("only 'date' and 'number' types are supported for column 1"+"of DataTable input (Got '"+_202+"')");
+this.attrs_.labels=_216;
+var _217=data.getColumnType(0);
+if(_217=="date"){
+this.attrs_.xValueFormatter=Dygraph.dateString_;
+this.attrs_.xValueParser=Dygraph.dateParser;
+this.attrs_.xTicker=Dygraph.dateTicker;
+}else{
+if(_217!="number"){
+this.attrs_.xValueFormatter=function(x){
+return x;
+};
+this.attrs_.xValueParser=function(x){
+return parseFloat(x);
+};
+this.attrs_.xTicker=Dygraph.numericTicks;
+}else{
+this.error("only 'date' and 'number' types are supported for column 1"+"of DataTable input (Got '"+_217+"')");
 return null;
 }
+}
 var ret=[];
 for(var i=0;i<rows;i++){
 var row=[];
-if(_202=="date"){
+if(_217=="date"){
 row.push(data.getValue(i,0).getTime());
 }else{
 row.push(data.getValue(i,0));
@@ -5543,71 +5737,74 @@ ret.push(row);
 }
 return ret;
 };
-DateGraph.prototype.start_=function(){
+Dygraph.prototype.start_=function(){
 if(typeof this.file_=="function"){
 this.loadedEvent_(this.file_());
 }else{
+if(MochiKit.Base.isArrayLike(this.file_)){
+this.rawData_=this.parseArray_(this.file_);
+this.drawGraph_(this.rawData_);
+}else{
 if(typeof this.file_=="object"&&typeof this.file_.getColumnRange=="function"){
 this.rawData_=this.parseDataTable_(this.file_);
 this.drawGraph_(this.rawData_);
 }else{
+if(typeof this.file_=="string"){
+if(this.file_.indexOf("\n")>=0){
+this.loadedEvent_(this.file_);
+}else{
 var req=new XMLHttpRequest();
-var _205=this;
+var _220=this;
 req.onreadystatechange=function(){
 if(req.readyState==4){
 if(req.status==200){
-_205.loadedEvent_(req.responseText);
+_220.loadedEvent_(req.responseText);
 }
 }
 };
 req.open("GET",this.file_,true);
 req.send(null);
 }
+}else{
+this.error("Unknown data format: "+(typeof this.file_));
 }
-};
-DateGraph.prototype.updateOptions=function(_206){
-if(_206.errorBars){
-this.errorBars_=_206.errorBars;
-}
-if(_206.customBars){
-this.customBars_=_206.customBars;
 }
-if(_206.strokeWidth){
-this.strokeWidth_=_206.strokeWidth;
 }
-if(_206.rollPeriod){
-this.rollPeriod_=_206.rollPeriod;
 }
-if(_206.dateWindow){
-this.dateWindow_=_206.dateWindow;
+};
+Dygraph.prototype.updateOptions=function(_221){
+if(_221.customBars){
+this.customBars_=_221.customBars;
 }
-if(_206.valueRange){
-this.valueRange_=_206.valueRange;
+if(_221.rollPeriod){
+this.rollPeriod_=_221.rollPeriod;
 }
-if(_206.minTickSize){
-this.minTickSize_=_206.minTickSize;
+if(_221.dateWindow){
+this.dateWindow_=_221.dateWindow;
 }
-if(typeof (_206.labels)!="undefined"){
-this.labels_=_206.labels;
-this.labelsFromCSV_=(_206.labels==null);
+if(_221.valueRange){
+this.valueRange_=_221.valueRange;
 }
-this.layout_.updateOptions({"errorBars":this.errorBars_});
-if(_206["file"]&&_206["file"]!=this.file_){
-this.file_=_206["file"];
+MochiKit.Base.update(this.user_attrs_,_221);
+this.labelsFromCSV_=(this.attr_("labels")==null);
+this.layout_.updateOptions({"errorBars":this.attr_("errorBars")});
+if(_221["file"]&&_221["file"]!=this.file_){
+this.file_=_221["file"];
 this.start_();
 }else{
 this.drawGraph_(this.rawData_);
 }
 };
-DateGraph.prototype.adjustRoll=function(_207){
-this.rollPeriod_=_207;
+Dygraph.prototype.adjustRoll=function(_222){
+this.rollPeriod_=_222;
 this.drawGraph_(this.rawData_);
 };
-DateGraph.GVizChart=function(_208){
-this.container=_208;
+Dygraph.GVizChart=function(_223){
+this.container=_223;
 };
-DateGraph.GVizChart.prototype.draw=function(data,_209){
+Dygraph.GVizChart.prototype.draw=function(data,_224){
 this.container.innerHTML="";
-this.date_graph=new DateGraph(this.container,data,null,_209||{});
+this.date_graph=new Dygraph(this.container,data,_224);
 };
+DateGraph=Dygraph;