-MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_283){
-var dom=MochiKit.DOM;
-var d=dom._document;
-elem=dom.getElement(elem);
-_283=MochiKit.Base.camelize(_283);
-if(!elem||elem==d){
-return undefined;
-}
-if(_283=="opacity"&&elem.filters){
-var _286=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/);
-if(_286&&_286[1]){
-return parseFloat(_286[1])/100;
-}
-return 1;
-}
-var _287=elem.style?elem.style[_283]:null;
-if(!_287){
-if(d.defaultView&&d.defaultView.getComputedStyle){
-var css=d.defaultView.getComputedStyle(elem,null);
-_283=_283.replace(/([A-Z])/g,"-$1").toLowerCase();
-_287=css?css.getPropertyValue(_283):null;
-}else{
-if(elem.currentStyle){
-_287=elem.currentStyle[_283];
-}
-}
-}
-if(_283=="opacity"){
-_287=parseFloat(_287);
-}
-if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_283)!=-1)){
-if(MochiKit.Style.getStyle(elem,"position")=="static"){
-_287="auto";
-}
-}
-return _287=="auto"?null:_287;
-},setStyle:function(elem,_28a){
-elem=MochiKit.DOM.getElement(elem);
-for(var name in _28a){
-if(name=="opacity"){
-MochiKit.Style.setOpacity(elem,_28a[name]);
-}else{
-elem.style[MochiKit.Base.camelize(name)]=_28a[name];
-}
-}
-},setOpacity:function(elem,o){
-elem=MochiKit.DOM.getElement(elem);
-var self=MochiKit.Style;
-if(o==1){
-var _28f=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent));
-elem.style["opacity"]=_28f?0.999999:1;
-if(/MSIE/.test(navigator.userAgent)){
-elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"");
-}
-}else{
-if(o<0.00001){
-o=0;
-}
-elem.style["opacity"]=o;
-if(/MSIE/.test(navigator.userAgent)){
-elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")";
-}
-}
-},getElementPosition:function(elem,_291){
-var self=MochiKit.Style;
-var dom=MochiKit.DOM;
-elem=dom.getElement(elem);
-if(!elem||(!(elem.x&&elem.y)&&(!elem.parentNode===null||self.getStyle(elem,"display")=="none"))){
-return undefined;
-}
-var c=new self.Coordinates(0,0);
-var box=null;
-var _296=null;
-var d=MochiKit.DOM._document;
-var de=d.documentElement;
-var b=d.body;
-if(!elem.parentNode&&elem.x&&elem.y){
-c.x+=elem.x||0;
-c.y+=elem.y||0;
-}else{
-if(elem.getBoundingClientRect){
-box=elem.getBoundingClientRect();
-c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
-c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0);
-}else{
-if(elem.offsetParent){
-c.x+=elem.offsetLeft;
-c.y+=elem.offsetTop;
-_296=elem.offsetParent;
-if(_296!=elem){
-while(_296){
-c.x+=_296.offsetLeft;
-c.y+=_296.offsetTop;
-_296=_296.offsetParent;
-}
-}
-var ua=navigator.userAgent.toLowerCase();
-if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("AppleWebKit")!=-1&&self.getStyle(elem,"position")=="absolute")){
-c.x-=b.offsetLeft;
-c.y-=b.offsetTop;
-}
-}
-}
-}
-if(typeof (_291)!="undefined"){
-_291=arguments.callee(_291);
-if(_291){
-c.x-=(_291.x||0);
-c.y-=(_291.y||0);
-}
-}
-if(elem.parentNode){
-_296=elem.parentNode;
-}else{
-_296=null;
-}
-while(_296){
-var _29b=_296.tagName.toUpperCase();
-if(_29b==="BODY"||_29b==="HTML"){
-break;
-}
-var disp=self.getStyle(_296,"display");
-if(disp!="inline"&&disp!="table-row"){
-c.x-=_296.scrollLeft;
-c.y-=_296.scrollTop;
-}
-if(_296.parentNode){
-_296=_296.parentNode;
-}else{
-_296=null;
-}
-}
-return c;
-},setElementPosition:function(elem,_29e,_29f){
-elem=MochiKit.DOM.getElement(elem);
-if(typeof (_29f)=="undefined"){
-_29f="px";
-}
-var _2a0={};
-var _2a1=MochiKit.Base.isUndefinedOrNull;
-if(!_2a1(_29e.x)){
-_2a0["left"]=_29e.x+_29f;
-}
-if(!_2a1(_29e.y)){
-_2a0["top"]=_29e.y+_29f;
-}
-MochiKit.DOM.updateNodeAttributes(elem,{"style":_2a0});
-},getElementDimensions:function(elem){
-var self=MochiKit.Style;
-var dom=MochiKit.DOM;
-if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){
-return new self.Dimensions(elem.w||0,elem.h||0);
-}
-elem=dom.getElement(elem);
-if(!elem){
-return undefined;
-}
-var disp=self.getStyle(elem,"display");
-if(disp!="none"&&disp!==""&&typeof (disp)!="undefined"){
-return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0);
-}
-var s=elem.style;
-var _2a7=s.visibility;
-var _2a8=s.position;
-s.visibility="hidden";
-s.position="absolute";
-s.display="";
-var _2a9=elem.offsetWidth;
-var _2aa=elem.offsetHeight;
-s.display="none";
-s.position=_2a8;
-s.visibility=_2a7;
-return new self.Dimensions(_2a9,_2aa);
-},setElementDimensions:function(elem,_2ac,_2ad){
-elem=MochiKit.DOM.getElement(elem);
-if(typeof (_2ad)=="undefined"){
-_2ad="px";
-}
-var _2ae={};
-var _2af=MochiKit.Base.isUndefinedOrNull;
-if(!_2af(_2ac.w)){
-_2ae["width"]=_2ac.w+_2ad;
-}
-if(!_2af(_2ac.h)){
-_2ae["height"]=_2ac.h+_2ad;
-}
-MochiKit.DOM.updateNodeAttributes(elem,{"style":_2ae});
-},setDisplayForElement:function(_2b0,_2b1){
-var _2b2=MochiKit.Base.extend(null,arguments,1);
-var _2b3=MochiKit.DOM.getElement;
-for(var i=0;i<_2b2.length;i++){
-_2b1=_2b3(_2b2[i]);
-if(_2b1){
-_2b1.style.display=_2b0;
-}
-}
-},getViewportDimensions:function(){
-var d=new MochiKit.Style.Dimensions();
-var w=MochiKit.DOM._window;
-var b=MochiKit.DOM._document.body;
-if(w.innerWidth){
-d.w=w.innerWidth;
-d.h=w.innerHeight;
-}else{
-if(b.parentElement.clientWidth){
-d.w=b.parentElement.clientWidth;
-d.h=b.parentElement.clientHeight;
-}else{
-if(b&&b.clientWidth){
-d.w=b.clientWidth;
-d.h=b.clientHeight;
-}
-}
-}
-return d;
-},getViewportPosition:function(){
-var c=new MochiKit.Style.Coordinates(0,0);
-var d=MochiKit.DOM._document;
-var de=d.documentElement;
-var db=d.body;
-if(de&&(de.scrollTop||de.scrollLeft)){
-c.x=de.scrollLeft;
-c.y=de.scrollTop;
-}else{
-if(db){
-c.x=db.scrollLeft;
-c.y=db.scrollTop;
-}
-}
-return c;
-},__new__:function(){
-var m=MochiKit.Base;
-this.elementPosition=this.getElementPosition;
-this.elementDimensions=this.getElementDimensions;
-this.hideElement=m.partial(this.setDisplayForElement,"none");
-this.showElement=m.partial(this.setDisplayForElement,"block");
-this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
-m.nameFunctions(this);
-}});
-MochiKit.Style.__new__();
-MochiKit.Base._exportSymbols(this,MochiKit.Style);
-if(typeof (dojo)!="undefined"){
-dojo.provide("MochiKit.Color");
-dojo.require("MochiKit.Base");
-dojo.require("MochiKit.DOM");
-dojo.require("MochiKit.Style");
-}
-if(typeof (JSAN)!="undefined"){
-JSAN.use("MochiKit.Base",[]);
-JSAN.use("MochiKit.DOM",[]);
-JSAN.use("MochiKit.Style",[]);
-}
-try{
-if(typeof (MochiKit.Base)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "MochiKit.Color depends on MochiKit.Base";
-}
-try{
-if(typeof (MochiKit.DOM)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "MochiKit.Color depends on MochiKit.DOM";
-}
-try{
-if(typeof (MochiKit.Style)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "MochiKit.Color depends on MochiKit.Style";
-}
-if(typeof (MochiKit.Color)=="undefined"){
-MochiKit.Color={};
-}
-MochiKit.Color.NAME="MochiKit.Color";
-MochiKit.Color.VERSION="1.4";
-MochiKit.Color.__repr__=function(){
-return "["+this.NAME+" "+this.VERSION+"]";
-};
-MochiKit.Color.toString=function(){
-return this.__repr__();
-};
-MochiKit.Color.Color=function(red,_2be,blue,_2c0){
-if(typeof (_2c0)=="undefined"||_2c0===null){
-_2c0=1;
-}
-this.rgb={r:red,g:_2be,b:blue,a:_2c0};
-};
-MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_2c1){
-var rgb=this.rgb;
-var m=MochiKit.Color;
-return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_2c1);
-},colorWithHue:function(hue){
-var hsl=this.asHSL();
-hsl.h=hue;
-var m=MochiKit.Color;
-return m.Color.fromHSL(hsl);
-},colorWithSaturation:function(_2c7){
-var hsl=this.asHSL();
-hsl.s=_2c7;
-var m=MochiKit.Color;
-return m.Color.fromHSL(hsl);
-},colorWithLightness:function(_2ca){
-var hsl=this.asHSL();
-hsl.l=_2ca;
-var m=MochiKit.Color;
-return m.Color.fromHSL(hsl);
-},darkerColorWithLevel:function(_2cd){
-var hsl=this.asHSL();
-hsl.l=Math.max(hsl.l-_2cd,0);
-var m=MochiKit.Color;
-return m.Color.fromHSL(hsl);
-},lighterColorWithLevel:function(_2d0){
-var hsl=this.asHSL();
-hsl.l=Math.min(hsl.l+_2d0,1);
-var m=MochiKit.Color;
-return m.Color.fromHSL(hsl);
-},blendedColor:function(_2d3,_2d4){
-if(typeof (_2d4)=="undefined"||_2d4===null){
-_2d4=0.5;
-}
-var sf=1-_2d4;
-var s=this.rgb;
-var d=_2d3.rgb;
-var df=_2d4;
-return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df));
-},compareRGB:function(_2d9){
-var a=this.asRGB();
-var b=_2d9.asRGB();
-return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]);
-},isLight:function(){
-return this.asHSL().b>0.5;
-},isDark:function(){
-return (!this.isLight());
-},toHSLString:function(){
-var c=this.asHSL();
-var ccc=MochiKit.Color.clampColorComponent;
-var rval=this._hslString;
-if(!rval){
-var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%");
-var a=c.a;
-if(a>=1){
-a=1;
-rval="hsl("+mid+")";
-}else{
-if(a<=0){
-a=0;
-}
-rval="hsla("+mid+","+a+")";
-}
-this._hslString=rval;
-}
-return rval;
-},toRGBString:function(){
-var c=this.rgb;
-var ccc=MochiKit.Color.clampColorComponent;
-var rval=this._rgbString;
-if(!rval){
-var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0));
-if(c.a!=1){
-rval="rgba("+mid+","+c.a+")";
-}else{
-rval="rgb("+mid+")";
-}
-this._rgbString=rval;
-}
-return rval;
-},asRGB:function(){
-return MochiKit.Base.clone(this.rgb);
-},toHexString:function(){
-var m=MochiKit.Color;
-var c=this.rgb;
-var ccc=MochiKit.Color.clampColorComponent;
-var rval=this._hexString;
-if(!rval){
-rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255)));
-this._hexString=rval;
-}
-return rval;
-},asHSV:function(){
-var hsv=this.hsv;
-var c=this.rgb;
-if(typeof (hsv)=="undefined"||hsv===null){
-hsv=MochiKit.Color.rgbToHSV(this.rgb);
-this.hsv=hsv;
-}
-return MochiKit.Base.clone(hsv);
-},asHSL:function(){
-var hsl=this.hsl;
-var c=this.rgb;
-if(typeof (hsl)=="undefined"||hsl===null){
-hsl=MochiKit.Color.rgbToHSL(this.rgb);
-this.hsl=hsl;
-}
-return MochiKit.Base.clone(hsl);
-},toString:function(){
-return this.toRGBString();
-},repr:function(){
-var c=this.rgb;
-var col=[c.r,c.g,c.b,c.a];
-return this.__class__.NAME+"("+col.join(", ")+")";
-}};
-MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_2f0,blue,_2f2){
-var _2f3=MochiKit.Color.Color;
-if(arguments.length==1){
-var rgb=red;
-red=rgb.r;
-_2f0=rgb.g;
-blue=rgb.b;
-if(typeof (rgb.a)=="undefined"){
-_2f2=undefined;
-}else{
-_2f2=rgb.a;
-}
-}
-return new _2f3(red,_2f0,blue,_2f2);
-},fromHSL:function(hue,_2f6,_2f7,_2f8){
-var m=MochiKit.Color;
-return m.Color.fromRGB(m.hslToRGB.apply(m,arguments));
-},fromHSV:function(hue,_2fb,_2fc,_2fd){
-var m=MochiKit.Color;
-return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments));
-},fromName:function(name){
-var _300=MochiKit.Color.Color;
-if(name.charAt(0)=="\""){
-name=name.substr(1,name.length-2);
-}
-var _301=_300._namedColors[name.toLowerCase()];
-if(typeof (_301)=="string"){
-return _300.fromHexString(_301);
-}else{
-if(name=="transparent"){
-return _300.transparentColor();
-}
-}
-return null;
-},fromString:function(_302){
-var self=MochiKit.Color.Color;
-var _304=_302.substr(0,3);
-if(_304=="rgb"){
-return self.fromRGBString(_302);
-}else{
-if(_304=="hsl"){
-return self.fromHSLString(_302);
-}else{
-if(_302.charAt(0)=="#"){
-return self.fromHexString(_302);
-}
-}
-}
-return self.fromName(_302);
-},fromHexString:function(_305){
-if(_305.charAt(0)=="#"){
-_305=_305.substring(1);
-}
-var _306=[];
-var i,hex;
-if(_305.length==3){
-for(i=0;i<3;i++){
-hex=_305.substr(i,1);
-_306.push(parseInt(hex+hex,16)/255);
-}
-}else{
-for(i=0;i<6;i+=2){
-hex=_305.substr(i,2);
-_306.push(parseInt(hex,16)/255);
-}
-}
-var _309=MochiKit.Color.Color;
-return _309.fromRGB.apply(_309,_306);
-},_fromColorString:function(pre,_30b,_30c,_30d){
-if(_30d.indexOf(pre)===0){
-_30d=_30d.substring(_30d.indexOf("(",3)+1,_30d.length-1);
-}
-var _30e=_30d.split(/\s*,\s*/);
-var _30f=[];
-for(var i=0;i<_30e.length;i++){
-var c=_30e[i];
-var val;
-var _313=c.substring(c.length-3);
-if(c.charAt(c.length-1)=="%"){
-val=0.01*parseFloat(c.substring(0,c.length-1));
-}else{
-if(_313=="deg"){
-val=parseFloat(c)/360;
-}else{
-if(_313=="rad"){
-val=parseFloat(c)/(Math.PI*2);
-}else{
-val=_30c[i]*parseFloat(c);
-}
-}
-}
-_30f.push(val);
-}
-return this[_30b].apply(this,_30f);
-},fromComputedStyle:function(elem,_315){
-var d=MochiKit.DOM;
-var cls=MochiKit.Color.Color;
-for(elem=d.getElement(elem);elem;elem=elem.parentNode){
-var _318=MochiKit.Style.getStyle.apply(d,arguments);
-if(!_318){
-continue;
-}
-var _319=cls.fromString(_318);
-if(!_319){
-break;
-}
-if(_319.asRGB().a>0){
-return _319;
-}
-}
-return null;
-},fromBackground:function(elem){
-var cls=MochiKit.Color.Color;
-return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor();
-},fromText:function(elem){
-var cls=MochiKit.Color.Color;
-return cls.fromComputedStyle(elem,"color","color")||cls.blackColor();
-},namedColors:function(){
-return MochiKit.Base.clone(MochiKit.Color.Color._namedColors);
-}});
-MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_31f){
-v*=_31f;
-if(v<0){
-return 0;
-}else{
-if(v>_31f){
-return _31f;
-}else{
-return v;
-}
-}
-},_hslValue:function(n1,n2,hue){
-if(hue>6){
-hue-=6;
-}else{
-if(hue<0){
-hue+=6;
-}
-}
-var val;
-if(hue<1){
-val=n1+(n2-n1)*hue;
-}else{
-if(hue<3){
-val=n2;
-}else{
-if(hue<4){
-val=n1+(n2-n1)*(4-hue);
-}else{
-val=n1;
-}
-}
-}
-return val;
-},hsvToRGB:function(hue,_325,_326,_327){
-if(arguments.length==1){
-var hsv=hue;
-hue=hsv.h;
-_325=hsv.s;
-_326=hsv.v;
-_327=hsv.a;
-}
-var red;
-var _32a;
-var blue;
-if(_325===0){
-red=_326;
-_32a=_326;
-blue=_326;
-}else{
-var i=Math.floor(hue*6);
-var f=(hue*6)-i;
-var p=_326*(1-_325);
-var q=_326*(1-(_325*f));
-var t=_326*(1-(_325*(1-f)));
-switch(i){
-case 1:
-red=q;
-_32a=_326;
-blue=p;
-break;
-case 2:
-red=p;
-_32a=_326;
-blue=t;
-break;
-case 3:
-red=p;
-_32a=q;
-blue=_326;
-break;
-case 4:
-red=t;
-_32a=p;
-blue=_326;
-break;
-case 5:
-red=_326;
-_32a=p;
-blue=q;
-break;
-case 6:
-case 0:
-red=_326;
-_32a=t;
-blue=p;
-break;
-}
-}
-return {r:red,g:_32a,b:blue,a:_327};
-},hslToRGB:function(hue,_332,_333,_334){
-if(arguments.length==1){
-var hsl=hue;
-hue=hsl.h;
-_332=hsl.s;
-_333=hsl.l;
-_334=hsl.a;
-}
-var red;
-var _337;
-var blue;
-if(_332===0){
-red=_333;
-_337=_333;
-blue=_333;
-}else{
-var m2;
-if(_333<=0.5){
-m2=_333*(1+_332);
-}else{
-m2=_333+_332-(_333*_332);
-}
-var m1=(2*_333)-m2;
-var f=MochiKit.Color._hslValue;
-var h6=hue*6;
-red=f(m1,m2,h6+2);
-_337=f(m1,m2,h6);
-blue=f(m1,m2,h6-2);
-}
-return {r:red,g:_337,b:blue,a:_334};
-},rgbToHSV:function(red,_33e,blue,_340){
-if(arguments.length==1){
-var rgb=red;
-red=rgb.r;
-_33e=rgb.g;
-blue=rgb.b;
-_340=rgb.a;
-}
-var max=Math.max(Math.max(red,_33e),blue);
-var min=Math.min(Math.min(red,_33e),blue);
-var hue;
-var _345;
-var _346=max;
-if(min==max){
-hue=0;
-_345=0;
-}else{
-var _347=(max-min);
-_345=_347/max;
-if(red==max){
-hue=(_33e-blue)/_347;
-}else{
-if(_33e==max){
-hue=2+((blue-red)/_347);
-}else{
-hue=4+((red-_33e)/_347);
-}
-}
-hue/=6;
-if(hue<0){
-hue+=1;
-}
-if(hue>1){
-hue-=1;
-}
-}
-return {h:hue,s:_345,v:_346,a:_340};
-},rgbToHSL:function(red,_349,blue,_34b){
-if(arguments.length==1){
-var rgb=red;
-red=rgb.r;
-_349=rgb.g;
-blue=rgb.b;
-_34b=rgb.a;
-}
-var max=Math.max(red,Math.max(_349,blue));
-var min=Math.min(red,Math.min(_349,blue));
-var hue;
-var _350;
-var _351=(max+min)/2;
-var _352=max-min;
-if(_352===0){
-hue=0;
-_350=0;
-}else{
-if(_351<=0.5){
-_350=_352/(max+min);
-}else{
-_350=_352/(2-max-min);
-}
-if(red==max){
-hue=(_349-blue)/_352;
-}else{
-if(_349==max){
-hue=2+((blue-red)/_352);
-}else{
-hue=4+((red-_349)/_352);
-}
-}
-hue/=6;
-if(hue<0){
-hue+=1;
-}
-if(hue>1){
-hue-=1;
-}
-}
-return {h:hue,s:_350,l:_351,a:_34b};
-},toColorPart:function(num){
-num=Math.round(num);
-var _354=num.toString(16);
-if(num<16){
-return "0"+_354;
-}
-return _354;
-},__new__:function(){
-var m=MochiKit.Base;
-this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]);
-this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]);
-var _356=1/3;
-var _357={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_356,_356,_356],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_356,2*_356,2*_356],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]};
-var _358=function(name,r,g,b,a){
-var rval=this.fromRGB(r,g,b,a);
-this[name]=function(){
-return rval;
-};
-return rval;
-};
-for(var k in _357){
-var name=k+"Color";
-var _361=m.concat([_358,this.Color,name],_357[k]);
-this.Color[name]=m.bind.apply(null,_361);
-}
-var _362=function(){
-for(var i=0;i<arguments.length;i++){
-if(!(arguments[i] instanceof Color)){
-return false;
-}
-}
-return true;
-};
-var _364=function(a,b){
-return a.compareRGB(b);
-};
-m.nameFunctions(this);
-m.registerComparator(this.Color.NAME,_362,_364);
-this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
-}});
-MochiKit.Color.EXPORT=["Color"];
-MochiKit.Color.EXPORT_OK=["clampColorComponent","rgbToHSL","hslToRGB","rgbToHSV","hsvToRGB","toColorPart"];
-MochiKit.Color.__new__();
-MochiKit.Base._exportSymbols(this,MochiKit.Color);
-MochiKit.Color.Color._namedColors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};
-if(typeof (dojo)!="undefined"){
-dojo.provide("MochiKit.Signal");
-dojo.require("MochiKit.Base");
-dojo.require("MochiKit.DOM");
-dojo.require("MochiKit.Style");
-}
-if(typeof (JSAN)!="undefined"){
-JSAN.use("MochiKit.Base",[]);
-JSAN.use("MochiKit.DOM",[]);
-JSAN.use("MochiKit.Style",[]);
-}
-try{
-if(typeof (MochiKit.Base)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "MochiKit.Signal depends on MochiKit.Base!";
-}
-try{
-if(typeof (MochiKit.DOM)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "MochiKit.Signal depends on MochiKit.DOM!";
-}
-try{
-if(typeof (MochiKit.Style)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "MochiKit.Signal depends on MochiKit.Style!";
-}
-if(typeof (MochiKit.Signal)=="undefined"){
-MochiKit.Signal={};
-}
-MochiKit.Signal.NAME="MochiKit.Signal";
-MochiKit.Signal.VERSION="1.4";
-MochiKit.Signal._observers=[];
-MochiKit.Signal.Event=function(src,e){
-this._event=e||window.event;
-this._src=src;
-};
-MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){
-var repr=MochiKit.Base.repr;
-var str="{event(): "+repr(this.event())+", src(): "+repr(this.src())+", type(): "+repr(this.type())+", target(): "+repr(this.target());
-if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){
-str+=", modifier(): "+"{alt: "+repr(this.modifier().alt)+", ctrl: "+repr(this.modifier().ctrl)+", meta: "+repr(this.modifier().meta)+", shift: "+repr(this.modifier().shift)+", any: "+repr(this.modifier().any)+"}";
-}
-if(this.type()&&this.type().indexOf("key")===0){
-str+=", key(): {code: "+repr(this.key().code)+", string: "+repr(this.key().string)+"}";
-}
-if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){
-str+=", mouse(): {page: "+repr(this.mouse().page)+", client: "+repr(this.mouse().client);
-if(this.type()!="mousemove"){
-str+=", button: {left: "+repr(this.mouse().button.left)+", middle: "+repr(this.mouse().button.middle)+", right: "+repr(this.mouse().button.right)+"}}";
-}else{
-str+="}";
-}
-}
-if(this.type()=="mouseover"||this.type()=="mouseout"){
-str+=", relatedTarget(): "+repr(this.relatedTarget());
-}
-str+="}";
-return str;
-},toString:function(){
-return this.__repr__();
-},src:function(){
-return this._src;
-},event:function(){
-return this._event;
-},type:function(){
-return this._event.type||undefined;
-},target:function(){
-return this._event.target||this._event.srcElement;
-},_relatedTarget:null,relatedTarget:function(){
-if(this._relatedTarget!==null){
-return this._relatedTarget;
-}
-var elem=null;
-if(this.type()=="mouseover"){
-elem=(this._event.relatedTarget||this._event.fromElement);
-}else{
-if(this.type()=="mouseout"){
-elem=(this._event.relatedTarget||this._event.toElement);
-}
-}
-if(elem!==null){
-this._relatedTarget=elem;
-return elem;
-}
-return undefined;
-},_modifier:null,modifier:function(){
-if(this._modifier!==null){
-return this._modifier;
-}
-var m={};
-m.alt=this._event.altKey;
-m.ctrl=this._event.ctrlKey;
-m.meta=this._event.metaKey||false;
-m.shift=this._event.shiftKey;
-m.any=m.alt||m.ctrl||m.shift||m.meta;
-this._modifier=m;
-return m;
-},_key:null,key:function(){
-if(this._key!==null){
-return this._key;
-}
-var k={};
-if(this.type()&&this.type().indexOf("key")===0){
-if(this.type()=="keydown"||this.type()=="keyup"){
-k.code=this._event.keyCode;
-k.string=(MochiKit.Signal._specialKeys[k.code]||"KEY_UNKNOWN");
-this._key=k;
-return k;
-}else{
-if(this.type()=="keypress"){
-k.code=0;
-k.string="";
-if(typeof (this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){
-k.code=this._event.charCode;
-k.string=String.fromCharCode(k.code);
-}else{
-if(this._event.keyCode&&typeof (this._event.charCode)=="undefined"){
-k.code=this._event.keyCode;
-k.string=String.fromCharCode(k.code);
-}
-}
-this._key=k;
-return k;
-}
-}
-}
-return undefined;
-},_mouse:null,mouse:function(){
-if(this._mouse!==null){
-return this._mouse;
-}
-var m={};
-var e=this._event;
-if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){
-m.client=new MochiKit.Style.Coordinates(0,0);
-if(e.clientX||e.clientY){
-m.client.x=(!e.clientX||e.clientX<0)?0:e.clientX;
-m.client.y=(!e.clientY||e.clientY<0)?0:e.clientY;
-}
-m.page=new MochiKit.Style.Coordinates(0,0);
-if(e.pageX||e.pageY){
-m.page.x=(!e.pageX||e.pageX<0)?0:e.pageX;
-m.page.y=(!e.pageY||e.pageY<0)?0:e.pageY;
-}else{
-var de=MochiKit.DOM._document.documentElement;
-var b=MochiKit.DOM._document.body;
-m.page.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
-m.page.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0);
-}
-if(this.type()!="mousemove"){
-m.button={};
-m.button.left=false;
-m.button.right=false;
-m.button.middle=false;
-if(e.which){
-m.button.left=(e.which==1);
-m.button.middle=(e.which==2);
-m.button.right=(e.which==3);
-}else{
-m.button.left=!!(e.button&1);
-m.button.right=!!(e.button&2);
-m.button.middle=!!(e.button&4);
-}
-}
-this._mouse=m;
-return m;
-}
-return undefined;
-},stop:function(){
-this.stopPropagation();
-this.preventDefault();
-},stopPropagation:function(){
-if(this._event.stopPropagation){
-this._event.stopPropagation();
-}else{
-this._event.cancelBubble=true;
-}
-},preventDefault:function(){
-if(this._event.preventDefault){
-this._event.preventDefault();
-}else{
-if(this._confirmUnload===null){
-this._event.returnValue=false;
-}
-}
-},_confirmUnload:null,confirmUnload:function(msg){
-if(this.type()=="beforeunload"){
-this._confirmUnload=msg;
-this._event.returnValue=msg;
-}
-}});
-MochiKit.Signal._specialMacKeys={3:"KEY_ENTER",63289:"KEY_NUM_PAD_CLEAR",63276:"KEY_PAGE_UP",63277:"KEY_PAGE_DOWN",63275:"KEY_END",63273:"KEY_HOME",63234:"KEY_ARROW_LEFT",63232:"KEY_ARROW_UP",63235:"KEY_ARROW_RIGHT",63233:"KEY_ARROW_DOWN",63302:"KEY_INSERT",63272:"KEY_DELETE"};
-(function(){
-var _373=MochiKit.Signal._specialMacKeys;
-for(i=63236;i<=63242;i++){
-_373[i]="KEY_F"+(i-63236+1);
-}
-})();
-MochiKit.Signal._specialKeys={8:"KEY_BACKSPACE",9:"KEY_TAB",12:"KEY_NUM_PAD_CLEAR",13:"KEY_ENTER",16:"KEY_SHIFT",17:"KEY_CTRL",18:"KEY_ALT",19:"KEY_PAUSE",20:"KEY_CAPS_LOCK",27:"KEY_ESCAPE",32:"KEY_SPACEBAR",33:"KEY_PAGE_UP",34:"KEY_PAGE_DOWN",35:"KEY_END",36:"KEY_HOME",37:"KEY_ARROW_LEFT",38:"KEY_ARROW_UP",39:"KEY_ARROW_RIGHT",40:"KEY_ARROW_DOWN",44:"KEY_PRINT_SCREEN",45:"KEY_INSERT",46:"KEY_DELETE",59:"KEY_SEMICOLON",91:"KEY_WINDOWS_LEFT",92:"KEY_WINDOWS_RIGHT",93:"KEY_SELECT",106:"KEY_NUM_PAD_ASTERISK",107:"KEY_NUM_PAD_PLUS_SIGN",109:"KEY_NUM_PAD_HYPHEN-MINUS",110:"KEY_NUM_PAD_FULL_STOP",111:"KEY_NUM_PAD_SOLIDUS",144:"KEY_NUM_LOCK",145:"KEY_SCROLL_LOCK",186:"KEY_SEMICOLON",187:"KEY_EQUALS_SIGN",188:"KEY_COMMA",189:"KEY_HYPHEN-MINUS",190:"KEY_FULL_STOP",191:"KEY_SOLIDUS",192:"KEY_GRAVE_ACCENT",219:"KEY_LEFT_SQUARE_BRACKET",220:"KEY_REVERSE_SOLIDUS",221:"KEY_RIGHT_SQUARE_BRACKET",222:"KEY_APOSTROPHE"};
-(function(){
-var _374=MochiKit.Signal._specialKeys;
-for(var i=48;i<=57;i++){
-_374[i]="KEY_"+(i-48);
-}
-for(i=65;i<=90;i++){
-_374[i]="KEY_"+String.fromCharCode(i);
-}
-for(i=96;i<=105;i++){
-_374[i]="KEY_NUM_PAD_"+(i-96);
-}
-for(i=112;i<=123;i++){
-_374[i]="KEY_F"+(i-112+1);
-}
-})();
-MochiKit.Signal.Ident=function(_376){
-this.source=_376.source;
-this.signal=_376.signal;
-this.listener=_376.listener;
-this.isDOM=_376.isDOM;
-this.objOrFunc=_376.objOrFunc;
-this.funcOrStr=_376.funcOrStr;
-this.connected=_376.connected;
-};
-MochiKit.Signal.Ident.prototype={};
-MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){
-return "["+this.NAME+" "+this.VERSION+"]";
-},toString:function(){
-return this.__repr__();
-},_unloadCache:function(){
-var self=MochiKit.Signal;
-var _378=self._observers;
-for(var i=0;i<_378.length;i++){
-if(_378[i].signal!=="onload"&&_378[i].signal!=="onunload"){
-self._disconnect(_378[i]);
-}
-}
-},_listener:function(src,sig,func,obj,_37e){
-var self=MochiKit.Signal;
-var E=self.Event;
-if(!_37e){
-return MochiKit.Base.bind(func,obj);
-}
-obj=obj||src;
-if(typeof (func)=="string"){
-if(sig==="onload"||sig==="onunload"){
-return function(_381){
-obj[func].apply(obj,[new E(src,_381)]);
-var _382=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:obj,funcOrStr:func});
-MochiKit.Signal._disconnect(_382);
-};
-}else{
-return function(_383){
-obj[func].apply(obj,[new E(src,_383)]);
-};
-}
-}else{
-if(sig==="onload"||sig==="onunload"){
-return function(_384){
-func.apply(obj,[new E(src,_384)]);
-MochiKit.Signal.disconnect(src,sig,func);
-var _385=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:func});
-MochiKit.Signal._disconnect(_385);
-};
-}else{
-return function(_386){
-func.apply(obj,[new E(src,_386)]);
-};
-}
-}
-},_browserAlreadyHasMouseEnterAndLeave:function(){
-return /MSIE/.test(navigator.userAgent);
-},_mouseEnterListener:function(src,sig,func,obj){
-var E=MochiKit.Signal.Event;
-return function(_38c){
-var e=new E(src,_38c);
-try{
-e.relatedTarget().nodeName;
-}
-catch(err){
-return;
-}
-e.stop();
-if(MochiKit.DOM.isChildNode(e.relatedTarget(),src)){
-return;
-}
-e.type=function(){
-return sig;
-};
-if(typeof (func)=="string"){
-return obj[func].apply(obj,[e]);
-}else{
-return func.apply(obj,[e]);
-}
-};
-},_getDestPair:function(_38e,_38f){
-var obj=null;
-var func=null;
-if(typeof (_38f)!="undefined"){
-obj=_38e;
-func=_38f;
-if(typeof (_38f)=="string"){
-if(typeof (_38e[_38f])!="function"){
-throw new Error("'funcOrStr' must be a function on 'objOrFunc'");
-}
-}else{
-if(typeof (_38f)!="function"){
-throw new Error("'funcOrStr' must be a function or string");
-}
-}
-}else{
-if(typeof (_38e)!="function"){
-throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given");
-}else{
-func=_38e;
-}
-}
-return [obj,func];
-},connect:function(src,sig,_394,_395){
-src=MochiKit.DOM.getElement(src);
-var self=MochiKit.Signal;
-if(typeof (sig)!="string"){
-throw new Error("'sig' must be a string");
-}
-var _397=self._getDestPair(_394,_395);
-var obj=_397[0];
-var func=_397[1];
-if(typeof (obj)=="undefined"||obj===null){
-obj=src;
-}
-var _39a=!!(src.addEventListener||src.attachEvent);
-if(_39a&&(sig==="onmouseenter"||sig==="onmouseleave")&&!self._browserAlreadyHasMouseEnterAndLeave()){
-var _39b=self._mouseEnterListener(src,sig.substr(2),func,obj);
-if(sig==="onmouseenter"){
-sig="onmouseover";
-}else{
-sig="onmouseout";
-}
-}else{
-var _39b=self._listener(src,sig,func,obj,_39a);
-}
-if(src.addEventListener){
-src.addEventListener(sig.substr(2),_39b,false);
-}else{
-if(src.attachEvent){
-src.attachEvent(sig,_39b);
-}
-}
-var _39c=new MochiKit.Signal.Ident({source:src,signal:sig,listener:_39b,isDOM:_39a,objOrFunc:_394,funcOrStr:_395,connected:true});
-self._observers.push(_39c);
-if(!_39a&&typeof (src.__connect__)=="function"){
-var args=MochiKit.Base.extend([_39c],arguments,1);
-src.__connect__.apply(src,args);
-}
-return _39c;
-},_disconnect:function(_39e){
-if(!_39e.connected){
-return;
-}
-_39e.connected=false;
-if(!_39e.isDOM){
-return;
-}
-var src=_39e.source;
-var sig=_39e.signal;
-var _3a1=_39e.listener;
-if(src.removeEventListener){
-src.removeEventListener(sig.substr(2),_3a1,false);
-}else{
-if(src.detachEvent){
-src.detachEvent(sig,_3a1);
-}else{
-throw new Error("'src' must be a DOM element");
-}
-}
-},disconnect:function(_3a2){
-var self=MochiKit.Signal;
-var _3a4=self._observers;
-var m=MochiKit.Base;
-if(arguments.length>1){
-var src=MochiKit.DOM.getElement(arguments[0]);
-var sig=arguments[1];
-var obj=arguments[2];
-var func=arguments[3];
-for(var i=_3a4.length-1;i>=0;i--){
-var o=_3a4[i];
-if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){
-self._disconnect(o);
-if(!self._lock){
-_3a4.splice(i,1);
-}else{
-self._dirty=true;
-}
-return true;
-}
-}
-}else{
-var idx=m.findIdentical(_3a4,_3a2);
-if(idx>=0){
-self._disconnect(_3a2);
-if(!self._lock){
-_3a4.splice(idx,1);
-}else{
-self._dirty=true;
-}
-return true;
-}
-}
-return false;
-},disconnectAllTo:function(_3ad,_3ae){
-var self=MochiKit.Signal;
-var _3b0=self._observers;
-var _3b1=self._disconnect;
-var _3b2=self._lock;
-var _3b3=self._dirty;
-if(typeof (_3ae)==="undefined"){
-_3ae=null;
-}
-for(var i=_3b0.length-1;i>=0;i--){
-var _3b5=_3b0[i];
-if(_3b5.objOrFunc===_3ad&&(_3ae===null||_3b5.funcOrStr===_3ae)){
-_3b1(_3b5);
-if(_3b2){
-_3b3=true;
-}else{
-_3b0.splice(i,1);
-}
-}
-}
-self._dirty=_3b3;
-},disconnectAll:function(src,sig){
-src=MochiKit.DOM.getElement(src);
-var m=MochiKit.Base;
-var _3b9=m.flattenArguments(m.extend(null,arguments,1));
-var self=MochiKit.Signal;
-var _3bb=self._disconnect;
-var _3bc=self._observers;
-var i,_3be;
-var _3bf=self._lock;
-var _3c0=self._dirty;
-if(_3b9.length===0){
-for(i=_3bc.length-1;i>=0;i--){
-_3be=_3bc[i];
-if(_3be.source===src){
-_3bb(_3be);
-if(!_3bf){
-_3bc.splice(i,1);
-}else{
-_3c0=true;
-}
-}
-}
-}else{
-var sigs={};
-for(i=0;i<_3b9.length;i++){
-sigs[_3b9[i]]=true;
-}
-for(i=_3bc.length-1;i>=0;i--){
-_3be=_3bc[i];
-if(_3be.source===src&&_3be.signal in sigs){
-_3bb(_3be);
-if(!_3bf){
-_3bc.splice(i,1);
-}else{
-_3c0=true;
-}
-}
-}
-}
-self._dirty=_3c0;
-},signal:function(src,sig){
-var self=MochiKit.Signal;
-var _3c5=self._observers;
-src=MochiKit.DOM.getElement(src);
-var args=MochiKit.Base.extend(null,arguments,2);
-var _3c7=[];
-self._lock=true;
-for(var i=0;i<_3c5.length;i++){
-var _3c9=_3c5[i];
-if(_3c9.source===src&&_3c9.signal===sig){
-try{
-_3c9.listener.apply(src,args);
-}
-catch(e){
-_3c7.push(e);
-}
-}
-}
-self._lock=false;
-if(self._dirty){
-self._dirty=false;
-for(var i=_3c5.length-1;i>=0;i--){
-if(!_3c5[i].connected){
-_3c5.splice(i,1);
-}
-}
-}
-if(_3c7.length==1){
-throw _3c7[0];
-}else{
-if(_3c7.length>1){
-var e=new Error("Multiple errors thrown in handling 'sig', see errors property");
-e.errors=_3c7;
-throw e;
-}
-}
-}});
-MochiKit.Signal.EXPORT_OK=[];
-MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"];
-MochiKit.Signal.__new__=function(win){
-var m=MochiKit.Base;
-this._document=document;
-this._window=win;
-this._lock=false;
-this._dirty=false;
-try{
-this.connect(window,"onunload",this._unloadCache);
-}
-catch(e){
-}
-this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
-m.nameFunctions(this);
-};
-MochiKit.Signal.__new__(this);
-if(MochiKit.__export__){
-connect=MochiKit.Signal.connect;
-disconnect=MochiKit.Signal.disconnect;
-disconnectAll=MochiKit.Signal.disconnectAll;
-signal=MochiKit.Signal.signal;
-}
-MochiKit.Base._exportSymbols(this,MochiKit.Signal);
-
-
-/***
-
- PlotKit.PlotKit 0.9.1 : PACKED VERSION
-
- THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please
- diff against the source tree, not this file.
-
- For more information, <http://www.liquidx.net/plotkit/>.
-
- Copyright (c) 2006. Alastair Tse.
-
-***/
-
-try{
-if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"||typeof (MochiKit.Format)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format}";
-}
-MochiKit.Base.update(MochiKit.Color.Color.prototype,{asFillColor:function(){
-return this.lighterColorWithLevel(0.3);
-},asStrokeColor:function(){
-return this.darkerColorWithLevel(0.1);
-},asPointColor:function(){
-return this.lighterColorWithLevel(0.1);
-}});
-if(typeof (PlotKit)=="undefined"){
-PlotKit={};
-}
-PlotKit.NAME="PlotKit";
-PlotKit.VERSION="0.8";
-PlotKit.__repr__=function(){
-return "["+this.NAME+" "+this.VERSION+"]";
-};
-PlotKit.toString=function(){
-return this.__repr__();
-};
-if(typeof (PlotKit.Base)=="undefined"){
-PlotKit.Base={};
-}
-PlotKit.Base.NAME="PlotKit.Base";
-PlotKit.Base.VERSION=PlotKit.VERSION;
-PlotKit.Base.__repr__=function(){
-return "["+this.NAME+" "+this.VERSION+"]";
-};
-PlotKit.Base.toString=function(){
-return this.__repr__();
-};
-PlotKit.Base.usingPrototype=function(){
-try{
-return (typeof (Object.extend)=="function");
-}
-catch(e){
-return false;
-}
-};
-MochiKit.Base.update(PlotKit.Base,{roundInterval:function(_1,_2,_3){
-var _4=MochiKit.Format.roundToFixed;
-var _5=_1/_2;
-return parseFloat(_4(_5,_3));
-},collapse:function(_6){
-var m=MochiKit.Base;
-var _8=new Array();
-for(var i=0;i<_6.length;i++){
-_8=m.concat(_8,_6[i]);
-}
-if(PlotKit.Base.usingPrototype()){
-delete _8.extend;
-delete _8.from;
-delete _8.inspect;
-}
-return _8;
-},uniq:function(_10){
-var m=MochiKit.Base;
-if(!m.isArrayLike(_10)||(_10.length<1)){
-return new Array();
-}
-var _11=new Array();
-var _12=_10[0];
-_11.push(_10[0]);
-for(var i=1;i<_10.length;i++){
-if(m.compare(_10[i],_12)!=0){
-_12=_10[i];
-_11.push(_10[i]);
-}
-}
-return _11;
-},colorScheme:function(){
-var mb=MochiKit.Base;
-var mc=MochiKit.Color;
-var _15=["red","orange","yellow","green","cyan","blue","purple","magenta"];
-var _16=function(_17){
-return mc.Color[_17+"Color"]();
-};
-return mb.map(_16,_15);
-},baseDarkPrimaryColors:function(){
-var _18=MochiKit.Color.Color.fromHexString;
-return [_18("#ad3f40"),_18("#ddac2c"),_18("#dfdd0c"),_18("#5276c4"),_18("#739c5a")];
-},basePrimaryColors:function(){
-var _19=MochiKit.Color.Color.fromHexString;
-return [_19("#d24c4d"),_19("#f2b32f"),_19("#ece90e"),_19("#5d83da"),_19("#78a15d")];
-},baseBlueColors:function(){
-var _20=MochiKit.Color.Color.fromHexString;
-return [_20("#4b6b94"),_20("#5d81b4"),_20("#acbad2")];
-},palette:function(_21,_22,_23,_24){
-var _25=MochiKit.Base.isUndefinedOrNull;
-var _26=new Array();
-if(_25(_24)){
-_24=0.1;
-}
-if(_25(_23)){
-_23=0.4;
-}
-if(_25(_22)){
-_22=-0.2;
-}
-var _27=_22;
-while(_27<=_23){
-_26.push(_27);
-_27+=_24;
-}
-var _28=function(_29,_30){
-return _29.lighterColorWithLevel(_30);
-};
-return MochiKit.Base.map(partial(_28,_21),_26);
-},excanvasSupported:function(){
-if(/MSIE/.test(navigator.userAgent)&&!window.opera){
-return true;
-}
-return false;
-},findPosX:function(obj){
-var _32=0;
-if(obj.offsetParent){
-while(obj.offsetParent){
-_32+=obj.offsetLeft;
-obj=obj.offsetParent;
-}
-}else{
-if(obj.x){
-_32+=obj.x;
-}
-}
-return _32;
-},findPosY:function(obj){
-var _33=0;
-if(obj.offsetParent){
-while(obj.offsetParent){
-_33+=obj.offsetTop;
-obj=obj.offsetParent;
-}
-}else{
-if(obj.y){
-_33+=obj.y;
-}
-}
-return _33;
-},isFuncLike:function(obj){
-return (typeof (obj)=="function");
-}});
-PlotKit.Base.map=function(fn,lst){
-if(PlotKit.Base.usingPrototype()){
-var _36=[];
-for(var x in lst){
-if(typeof (lst[x])=="function"){
-continue;
-}
-_36.push(fn(lst[x]));
-}
-return _36;
-}else{
-return MochiKit.Base.map(fn,lst);
-}
-};
-PlotKit.Base.items=function(lst){
-if(PlotKit.Base.usingPrototype()){
-var _38=[];
-for(var x in lst){
-if(typeof (lst[x])=="function"){
-continue;
-}
-_38.push([x,lst[x]]);
-}
-return _38;
-}else{
-return MochiKit.Base.items(lst);
-}
-};
-PlotKit.Base.keys=function(lst){
-if(PlotKit.Base.usingPrototype()){
-var _39=[];
-for(var x in lst){
-if(typeof (lst[x])=="function"){
-continue;
-}
-_39.push(x);
-}
-return _39;
-}else{
-return MochiKit.Base.keys(lst);
-}
-};
-PlotKit.Base.baseColors=function(){
-var _40=MochiKit.Color.Color.fromHexString;
-return [_40("#476fb2"),_40("#be2c2b"),_40("#85b730"),_40("#734a99"),_40("#26a1c5"),_40("#fb8707"),_40("#000000")];
-};
-PlotKit.Base.officeBaseStyle={"axisLineWidth":2,"axisLabelColor":Color.grayColor(),"axisLineColor":Color.whiteColor(),"padding":{top:5,bottom:10,left:30,right:30}};
-MochiKit.Base.update(PlotKit.Base,{officeBlue:function(){
-var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"backgroundColor":PlotKit.Base.baseColors()[0].lighterColorWithLevel(0.45)};
-MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
-return r;
-},officeRed:function(){
-var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"backgroundColor":PlotKit.Base.baseColors()[1].lighterColorWithLevel(0.5)};
-MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
-return r;
-},officeGreen:function(){
-var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[2]),"backgroundColor":PlotKit.Base.baseColors()[2].lighterColorWithLevel(0.5)};
-MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
-return r;
-},officePurple:function(){
-var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[3]),"backgroundColor":PlotKit.Base.baseColors()[3].lighterColorWithLevel(0.5)};
-MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
-return r;
-},officeCyan:function(){
-var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[4]),"backgroundColor":PlotKit.Base.baseColors()[4].lighterColorWithLevel(0.5)};
-MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
-return r;
-},officeOrange:function(){
-var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[5]),"backgroundColor":PlotKit.Base.baseColors()[5].lighterColorWithLevel(0.4)};
-MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
-return r;
-},officeBlack:function(){
-var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[6],0,0.6),"backgroundColor":PlotKit.Base.baseColors()[6].lighterColorWithLevel(0.9)};
-MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
-return r;
-}});
-PlotKit.Base.EXPORT=["baseColors","collapse","colorScheme","findPosX","findPosY","officeBaseStyle","officeBlue","officeRed","officeGreen","officePurple","officeCyan","officeOrange","officeBlack","roundInterval","uniq","isFuncLike","excanvasSupported"];
-PlotKit.Base.EXPORT_OK=[];
-PlotKit.Base.__new__=function(){
-var m=MochiKit.Base;
-m.nameFunctions(this);
-this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
-};
-PlotKit.Base.__new__();
-MochiKit.Base._exportSymbols(this,PlotKit.Base);
-try{
-if(typeof (PlotKit.Base)=="undefined"){
-throw "";
-}
-}
-catch(e){
-throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Base";
-}
-if(typeof (PlotKit.Layout)=="undefined"){
-PlotKit.Layout={};
-}
-PlotKit.Layout.NAME="PlotKit.Layout";
-PlotKit.Layout.VERSION=PlotKit.VERSION;
-PlotKit.Layout.__repr__=function(){
-return "["+this.NAME+" "+this.VERSION+"]";
-};
-PlotKit.Layout.toString=function(){
-return this.__repr__();
-};
-PlotKit.Layout.valid_styles=["bar","line","pie","point"];
-PlotKit.Layout=function(_42,_43){
-this.options={"barWidthFillFraction":0.75,"barOrientation":"vertical","xOriginIsZero":true,"yOriginIsZero":true,"xAxis":null,"yAxis":null,"xTicks":null,"yTicks":null,"xNumberOfTicks":10,"yNumberOfTicks":5,"xTickPrecision":1,"yTickPrecision":1,"pieRadius":0.4};
-this.style=_42;
-MochiKit.Base.update(this.options,_43?_43:{});
-if(!MochiKit.Base.isUndefinedOrNull(this.options.xAxis)){
-this.minxval=this.options.xAxis[0];
-this.maxxval=this.options.xAxis[1];
-this.xscale=this.maxxval-this.minxval;
-}else{
-this.minxval=0;
-this.maxxval=null;
-this.xscale=null;
-}
-if(!MochiKit.Base.isUndefinedOrNull(this.options.yAxis)){
-this.minyval=this.options.yAxis[0];
-this.maxyval=this.options.yAxis[1];
-this.yscale=this.maxyval-this.minyval;
-}else{
-this.minyval=0;
-this.maxyval=null;
-this.yscale=null;
-}
-this.bars=new Array();
-this.points=new Array();
-this.slices=new Array();
-this.xticks=new Array();
-this.yticks=new Array();
-this.datasets=new Array();
-this.minxdelta=0;
-this.xrange=1;
-this.yrange=1;
-this.hitTestCache={x2maxy:null};
-};
-PlotKit.Layout.prototype.addDataset=function(_44,_45){
-this.datasets[_44]=_45;
-};
-PlotKit.Layout.prototype.removeDataset=function(_46,_47){
-delete this.datasets[_46];
-};
-PlotKit.Layout.prototype.addDatasetFromTable=function(_48,_49,_50,_51,_52){
-var _53=MochiKit.Base.isUndefinedOrNull;
-var _54=MochiKit.DOM.scrapeText;
-var _55=MochiKit.Format.strip;
-if(_53(_50)){
-_50=0;
-}
-if(_53(_51)){
-_51=1;
-}
-if(_53(_52)){
-_52=-1;
-}
-var _56=_49.tBodies[0].rows;
-var _57=new Array();
-var _58=new Array();
-if(!_53(_56)){
-for(var i=0;i<_56.length;i++){
-_57.push([parseFloat(_55(_54(_56[i].cells[_50]))),parseFloat(_55(_54(_56[i].cells[_51])))]);
-if(_52>=0){
-_58.push({v:parseFloat(_55(_54(_56[i].cells[_50]))),label:_55(_54(_56[i].cells[_52]))});
-}
-}
-this.addDataset(_48,_57);
-if(_52>=0){
-this.options.xTicks=_58;
-}
-return true;
-}
-return false;
-};
-PlotKit.Layout.prototype.evaluate=function(){
-this._evaluateLimits();
-this._evaluateScales();
-if(this.style=="bar"){
-if(this.options.barOrientation=="horizontal"){
-this._evaluateHorizBarCharts();
-}else{
-this._evaluateBarCharts();
-}
-this._evaluateBarTicks();
-}else{
-if(this.style=="line"){
-this._evaluateLineCharts();
-this._evaluateLineTicks();
-}else{
-if(this.style=="pie"){
-this._evaluatePieCharts();
-this._evaluatePieTicks();
-}
-}
-}
-};
-PlotKit.Layout.prototype.hitTest=function(x,y){
-var f=MochiKit.Format.twoDigitFloat;
-if((this.style=="bar")&&this.bars&&(this.bars.length>0)){
-for(var i=0;i<this.bars.length;i++){
-var bar=this.bars[i];
-if((x>=bar.x)&&(x<=bar.x+bar.w)&&(y>=bar.y)&&(y-bar.y<=bar.h)){
-return bar;
-}
-}
-}else{
-if(this.style=="line"){
-if(this.hitTestCache.x2maxy==null){
-this._regenerateHitTestCache();
-}
-var _62=x/this.xscale;
-var _63=this.hitTestCache.xvalues;
-var _64=null;
-var _65=null;
-for(var i=1;i<_63.length;i++){
-if(_63[i]>_62){
-_64=_63[i-1];
-_65=_63[i];
-break;
-}
-}
-if((_64!=null)){
-var _66=this.hitTestCache.x2maxy[_64];
-var _67=this.hitTestCache.x2maxy[_65];
-var _68=(1-y)/this.yscale;
-var _69=(_67-_66)/(_65-_64);
-var _70=_66+_69*(_62-_64);
-if(_70>=_68){
-var obj={xval:_62,yval:_68,xafter:_65,yafter:_67,xbefore:_64,ybefore:_66,yprojected:_70};
-return obj;
-}
-}
-}else{
-if(this.style=="pie"){
-var _71=Math.sqrt((y-0.5)*(y-0.5)+(x-0.5)*(x-0.5));
-if(_71>this.options.pieRadius){
-return null;
-}
-var _72=Math.atan2(y-0.5,x-0.5)-Math.PI/2;
-for(var i=0;i<this.slices.length;i++){
-var _73=this.slices[i];
-if(_73.startAngle<_72&&_73.endAngle>=_72){
-return _73;
-}
-}
-}
-}
-}
-return null;
-};
-PlotKit.Layout.prototype.rectForX=function(x){
-return null;
-};
-PlotKit.Layout.prototype.angleRangeForX=function(x){
-return null;
-};
-PlotKit.Layout.prototype._evaluateLimits=function(){
-var map=PlotKit.Base.map;
-var _75=PlotKit.Base.items;
-var _76=MochiKit.Base.itemgetter;
-var _77=PlotKit.Base.collapse;
-var _78=MochiKit.Base.listMin;
-var _79=MochiKit.Base.listMax;
-var _80=MochiKit.Base.isUndefinedOrNull;
-var all=_77(map(_76(1),_75(this.datasets)));
-if(_80(this.options.xAxis)){
-if(this.options.xOriginIsZero){
-this.minxval=0;
-}else{
-this.minxval=_78(map(parseFloat,map(_76(0),all)));
-}
-this.maxxval=_79(map(parseFloat,map(_76(0),all)));
-}else{
-this.minxval=this.options.xAxis[0];
-this.maxxval=this.options.xAxis[1];
-this.xscale=this.maxval-this.minxval;
-}
-if(_80(this.options.yAxis)){
-if(this.options.yOriginIsZero){
-this.minyval=0;
-}else{
-this.minyval=_78(map(parseFloat,map(_76(1),all)));
-}
-this.maxyval=_79(map(parseFloat,map(_76(1),all)));
-}else{
-this.minyval=this.options.yAxis[0];
-this.maxyval=this.options.yAxis[1];
-this.yscale=this.maxyval-this.minyval;
-}
-};
-PlotKit.Layout.prototype._evaluateScales=function(){
-var _82=MochiKit.Base.isUndefinedOrNull;
-this.xrange=this.maxxval-this.minxval;
-if(this.xrange==0){
-this.xscale=1;
-}else{
-this.xscale=1/this.xrange;
-}
-this.yrange=this.maxyval-this.minyval;
-if(this.yrange==0){
-this.yscale=1;
-}else{
-this.yscale=1/this.yrange;
-}
-};
-PlotKit.Layout.prototype._uniqueXValues=function(){
-var _83=PlotKit.Base.collapse;
-var map=PlotKit.Base.map;
-var _84=PlotKit.Base.uniq;
-var _85=MochiKit.Base.itemgetter;
-var _86=PlotKit.Base.items;
-var _87=map(parseFloat,map(_85(0),_83(map(_85(1),_86(this.datasets)))));
-_87.sort(MochiKit.Base.compare);
-return _84(_87);
-};
-PlotKit.Layout.prototype._evaluateBarCharts=function(){
-var _88=PlotKit.Base.items;
-var _89=_88(this.datasets).length;
-var _90=10000000;
-var _91=this._uniqueXValues();
-for(var i=1;i<_91.length;i++){
-_90=Math.min(Math.abs(_91[i]-_91[i-1]),_90);
-}
-var _92=0;
-var _93=0;
-var _94=0;
-if(_91.length==1){
-_90=1;
-this.xscale=1;
-this.minxval=_91[0];
-_92=1*this.options.barWidthFillFraction;
-_93=_92/_89;
-_94=(1-this.options.barWidthFillFraction)/2;
-}else{
-if(this.xrange==1){
-this.xscale=0.5;
-}else{
-if(this.xrange==2){
-this.xscale=1/3;
-}else{
-this.xscale=(1-_90/this.xrange)/this.xrange;
-}
-}
-_92=_90*this.xscale*this.options.barWidthFillFraction;
-_93=_92/_89;
-_94=_90*this.xscale*(1-this.options.barWidthFillFraction)/2;
-}
-this.minxdelta=_90;
-this.bars=new Array();
-var i=0;
-for(var _95 in this.datasets){
-var _96=this.datasets[_95];
-if(PlotKit.Base.isFuncLike(_96)){
-continue;
-}
-for(var j=0;j<_96.length;j++){
-var _98=_96[j];
-var _99={x:((parseFloat(_98[0])-this.minxval)*this.xscale)+(i*_93)+_94,y:1-((parseFloat(_98[1])-this.minyval)*this.yscale),w:_93,h:((parseFloat(_98[1])-this.minyval)*this.yscale),xval:parseFloat(_98[0]),yval:parseFloat(_98[1]),name:_95};
-if((_99.x>=0)&&(_99.x<=1)&&(_99.y>=0)&&(_99.y<=1)){
-this.bars.push(_99);
-}
-}
-i++;
-}
-};
-PlotKit.Layout.prototype._evaluateHorizBarCharts=function(){
-var _100=PlotKit.Base.items;
-var _101=_100(this.datasets).length;
-var _102=10000000;
-var _103=this._uniqueXValues();
-for(var i=1;i<_103.length;i++){
-_102=Math.min(Math.abs(_103[i]-_103[i-1]),_102);
-}
-var _104=0;
-var _105=0;
-var _106=0;
-if(_103.length==1){
-_102=1;
-this.xscale=1;
-this.minxval=_103[0];
-_104=1*this.options.barWidthFillFraction;
-_105=_104/_101;
-_106=(1-this.options.barWidthFillFraction)/2;
-}else{
-this.xscale=(1-_102/this.xrange)/this.xrange;
-_104=_102*this.xscale*this.options.barWidthFillFraction;
-_105=_104/_101;
-_106=_102*this.xscale*(1-this.options.barWidthFillFraction)/2;
-}
-this.minxdelta=_102;
-this.bars=new Array();
-var i=0;
-for(var _107 in this.datasets){
-var _108=this.datasets[_107];
-if(PlotKit.Base.isFuncLike(_108)){
-continue;
-}
-for(var j=0;j<_108.length;j++){
-var item=_108[j];
-var rect={y:((parseFloat(item[0])-this.minxval)*this.xscale)+(i*_105)+_106,x:0,h:_105,w:((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_107};
-if(rect.y<=0){
-rect.y=0;
-}
-if(rect.y>=1){
-rect.y=1;
-}
-if((rect.x>=0)&&(rect.x<=1)){
-this.bars.push(rect);
-}
-}
-i++;
-}
-};
-PlotKit.Layout.prototype._evaluateLineCharts=function(){
-var _111=PlotKit.Base.items;
-var _112=_111(this.datasets).length;
-this.points=new Array();
-var i=0;
-for(var _113 in this.datasets){
-var _114=this.datasets[_113];
-if(PlotKit.Base.isFuncLike(_114)){
-continue;
-}
-_114.sort(function(a,b){
-return compare(parseFloat(a[0]),parseFloat(b[0]));
-});
-for(var j=0;j<_114.length;j++){
-var item=_114[j];
-var _117={x:((parseFloat(item[0])-this.minxval)*this.xscale),y:1-((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_113};
-if(_117.y<=0){
-_117.y=0;
-}
-if(_117.y>=1){
-_117.y=1;
-}
-if((_117.x>=0)&&(_117.x<=1)){
-this.points.push(_117);
-}
-}
-i++;
-}
-};
-PlotKit.Layout.prototype._evaluatePieCharts=function(){
-var _118=PlotKit.Base.items;
-var sum=MochiKit.Iter.sum;
-var _120=MochiKit.Base.itemgetter;
-var _121=_118(this.datasets).length;
-var _122=_118(this.datasets)[0][1];
-var _123=sum(map(_120(1),_122));
-this.slices=new Array();
-var _124=0;
-for(var i=0;i<_122.length;i++){
-var _125=_122[i][1]/_123;
-var _126=_124*Math.PI*2;
-var _127=(_124+_125)*Math.PI*2;
-var _128={fraction:_125,xval:_122[i][0],yval:_122[i][1],startAngle:_126,endAngle:_127};
-if(_122[i][1]!=0){
-this.slices.push(_128);
-}
-_124+=_125;
-}
-};
-PlotKit.Layout.prototype._evaluateLineTicksForXAxis=function(){
-var _129=MochiKit.Base.isUndefinedOrNull;
-if(this.options.xTicks){
-this.xticks=new Array();
-var _130=function(tick){
-var _132=tick.label;
-if(_129(_132)){
-_132=tick.v.toString();
-}
-var pos=this.xscale*(tick.v-this.minxval);
-if((pos>=0)&&(pos<=1)){
-this.xticks.push([pos,_132]);
-}
-};
-MochiKit.Iter.forEach(this.options.xTicks,bind(_130,this));
-}else{
-if(this.options.xNumberOfTicks){
-var _134=this._uniqueXValues();
-var _135=this.xrange/this.options.xNumberOfTicks;
-var _136=0;
-this.xticks=new Array();
-for(var i=0;i<=_134.length;i++){
-if((_134[i]-this.minxval)>=(_136*_135)){
-var pos=this.xscale*(_134[i]-this.minxval);
-if((pos>1)||(pos<0)){
-continue;
-}
-this.xticks.push([pos,_134[i]]);
-_136++;
-}
-if(_136>this.options.xNumberOfTicks){
-break;
-}
-}
-}
-}
-};
-PlotKit.Layout.prototype._evaluateLineTicksForYAxis=function(){
-var _137=MochiKit.Base.isUndefinedOrNull;
-if(this.options.yTicks){
-this.yticks=new Array();
-var _138=function(tick){
-var _139=tick.label;
-if(_137(_139)){
-_139=tick.v.toString();
-}
-var pos=1-(this.yscale*(tick.v-this.minyval));
-if((pos>=0)&&(pos<=1)){
-this.yticks.push([pos,_139]);
-}
-};
-MochiKit.Iter.forEach(this.options.yTicks,bind(_138,this));
-}else{
-if(this.options.yNumberOfTicks){
-this.yticks=new Array();
-var _140=PlotKit.Base.roundInterval;
-var prec=this.options.yTickPrecision;
-var _142=_140(this.yrange,this.options.yNumberOfTicks,prec);
-for(var i=0;i<=this.options.yNumberOfTicks;i++){
-var yval=this.minyval+(i*_142);
-var pos=1-((yval-this.minyval)*this.yscale);
-if((pos>1)||(pos<0)){
-continue;
-}
-this.yticks.push([pos,MochiKit.Format.roundToFixed(yval,prec)]);
-}
-}
-}
-};
-PlotKit.Layout.prototype._evaluateLineTicks=function(){
-this._evaluateLineTicksForXAxis();
-this._evaluateLineTicksForYAxis();
-};
-PlotKit.Layout.prototype._evaluateBarTicks=function(){
-this._evaluateLineTicks();
-var _144=function(tick){
-return [tick[0]+(this.minxdelta*this.xscale)/2,tick[1]];
-};
-this.xticks=MochiKit.Base.map(bind(_144,this),this.xticks);
-if(this.options.barOrientation=="horizontal"){
-var _145=this.xticks;
-this.xticks=this.yticks;
-this.yticks=_145;
-var _146=function(tick){
-return [1-tick[0],tick[1]];
-};
-this.xticks=MochiKit.Base.map(_146,this.xticks);
-}
-};
-PlotKit.Layout.prototype._evaluatePieTicks=function(){
-var _147=MochiKit.Base.isUndefinedOrNull;
-var _148=MochiKit.Format.numberFormatter("#%");
-this.xticks=new Array();
-if(this.options.xTicks){
-var _149=new Array();
-for(var i=0;i<this.slices.length;i++){
-_149[this.slices[i].xval]=this.slices[i];
-}
-for(var i=0;i<this.options.xTicks.length;i++){
-var tick=this.options.xTicks[i];
-var _150=_149[tick.v];
-var _151=tick.label;
-if(_150){
-if(_147(_151)){
-_151=tick.v.toString();
-}
-_151+=" ("+_148(_150.fraction)+")";
-this.xticks.push([tick.v,_151]);
-}
-}
-}else{
-for(var i=0;i<this.slices.length;i++){
-var _150=this.slices[i];
-var _151=_150.xval+" ("+_148(_150.fraction)+")";
-this.xticks.push([_150.xval,_151]);
-}
-}
-};
-PlotKit.Layout.prototype._regenerateHitTestCache=function(){
-this.hitTestCache.xvalues=this._uniqueXValues();
-this.hitTestCache.xlookup=new Array();
-this.hitTestCache.x2maxy=new Array();
-var _152=MochiKit.Base.listMax;
-var _153=MochiKit.Base.itemgetter;
-var map=MochiKit.Base.map;
-var _154=keys(this.datasets);
-for(var i=0;i<_154.length;i++){
-var _155=this.datasets[_154[i]];
-for(var j=0;j<_155.length;j++){
-var xval=_155[j][0];
-var yval=_155[j][1];
-if(this.hitTestCache.xlookup[xval]){
-this.hitTestCache.xlookup[xval].push([yval,_154[i]]);
-}else{
-this.hitTestCache.xlookup[xval]=[[yval,_154[i]]];
-}
-}
-}
-for(var x in this.hitTestCache.xlookup){
-var _157=this.hitTestCache.xlookup[x];
-this.hitTestCache.x2maxy[x]=_152(map(_153(0),_157));
-}
-};
-PlotKit.LayoutModule={};
-PlotKit.LayoutModule.Layout=PlotKit.Layout;
-PlotKit.LayoutModule.EXPORT=["Layout"];
-PlotKit.LayoutModule.EXPORT_OK=[];
-PlotKit.LayoutModule.__new__=function(){
-var m=MochiKit.Base;
-m.nameFunctions(this);
-this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
-};
-PlotKit.LayoutModule.__new__();
-MochiKit.Base._exportSymbols(this,PlotKit.LayoutModule);
-try{
-if((typeof (PlotKit.Base)=="undefined")||(typeof (PlotKit.Layout)=="undefined")){
-throw "";
-}
-}
-catch(e){
-throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Base,Layout}";
-}
-if(typeof (PlotKit.CanvasRenderer)=="undefined"){
-PlotKit.CanvasRenderer={};
-}
-PlotKit.CanvasRenderer.NAME="PlotKit.CanvasRenderer";
-PlotKit.CanvasRenderer.VERSION=PlotKit.VERSION;
-PlotKit.CanvasRenderer.__repr__=function(){
-return "["+this.NAME+" "+this.VERSION+"]";
-};
-PlotKit.CanvasRenderer.toString=function(){
-return this.__repr__();
-};
-PlotKit.CanvasRenderer=function(_158,_159,_160){
-if(arguments.length>0){
-this.__init__(_158,_159,_160);
-}
-};
-PlotKit.CanvasRenderer.prototype.__init__=function(_161,_162,_163){
-var _164=MochiKit.Base.isUndefinedOrNull;
-var _165=MochiKit.Color.Color;
-this.options={"drawBackground":true,"backgroundColor":_165.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_165.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_165.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_165.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true};
-MochiKit.Base.update(this.options,_163?_163:{});
-this.layout=_162;
-this.element=MochiKit.DOM.getElement(_161);
-this.container=this.element.parentNode;
-this.isIE=PlotKit.Base.excanvasSupported();
-if(this.isIE&&!_164(G_vmlCanvasManager)){
-this.IEDelay=0.5;
-this.maxTries=5;
-this.renderDelay=null;
-this.clearDelay=null;
-this.element=G_vmlCanvasManager.initElement(this.element);
-}
-this.height=this.element.height;
-this.width=this.element.width;
-if(_164(this.element)){
-throw "CanvasRenderer() - passed canvas is not found";
-}
-if(!this.isIE&&!(PlotKit.CanvasRenderer.isSupported(this.element))){
-throw "CanvasRenderer() - Canvas is not supported.";
-}
-if(_164(this.container)||(this.container.nodeName.toLowerCase()!="div")){
-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};
-MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}});
-};
-PlotKit.CanvasRenderer.prototype.render=function(){
-if(this.isIE){
-try{
-if(this.renderDelay){
-this.renderDelay.cancel();
-this.renderDelay=null;
-}
-var _166=this.element.getContext("2d");
-}
-catch(e){
-this.isFirstRender=false;
-if(this.maxTries-->0){
-this.renderDelay=MochiKit.Async.wait(this.IEDelay);
-this.renderDelay.addCallback(bind(this.render,this));
-}
-return;
-}
-}
-if(this.options.drawBackground){
-this._renderBackground();
-}
-if(this.layout.style=="bar"){
-this._renderBarChart();
-this._renderBarAxis();
-}else{
-if(this.layout.style=="pie"){
-this._renderPieChart();
-this._renderPieAxis();
-}else{
-if(this.layout.style=="line"){
-this._renderLineChart();
-this._renderLineAxis();
-}
-}
-}
-};
-PlotKit.CanvasRenderer.prototype._renderBarChartWrap=function(data,_168){
-var _169=this.element.getContext("2d");
-var _170=this.options.colorScheme.length;
-var _171=this.options.colorScheme;
-var _172=MochiKit.Base.keys(this.layout.datasets);
-var _173=_172.length;
-for(var i=0;i<_173;i++){
-var _174=_172[i];
-var _175=_171[i%_170];
-_169.save();
-_169.fillStyle=_175.toRGBString();
-if(this.options.strokeColor){
-_169.strokeStyle=this.options.strokeColor.toRGBString();
-}else{
-if(this.options.strokeColorTransform){
-_169.strokeStyle=_175[this.options.strokeColorTransform]().toRGBString();
-}
-}
-_169.lineWidth=this.options.strokeWidth;
-var _176=function(obj){
-if(obj.name==_174){
-_168(_169,obj);
-}
-};
-MochiKit.Iter.forEach(data,bind(_176,this));
-_169.restore();
-}
-};
-PlotKit.CanvasRenderer.prototype._renderBarChart=function(){
-var bind=MochiKit.Base.bind;
-var _178=function(_179,bar){
-var x=this.area.w*bar.x+this.area.x;
-var y=this.area.h*bar.y+this.area.y;
-var w=this.area.w*bar.w;
-var h=this.area.h*bar.h;
-if((w<1)||(h<1)){
-return;
-}
-if(this.options.shouldFill){
-_179.fillRect(x,y,w,h);
-}
-if(this.options.shouldStroke){
-_179.strokeRect(x,y,w,h);
-}
-};
-this._renderBarChartWrap(this.layout.bars,bind(_178,this));
-};
-PlotKit.CanvasRenderer.prototype._renderLineChart=function(){
-var _182=this.element.getContext("2d");
-var _183=this.options.colorScheme.length;
-var _184=this.options.colorScheme;
-var _185=MochiKit.Base.keys(this.layout.datasets);
-var _186=_185.length;
-var bind=MochiKit.Base.bind;
-var _187=MochiKit.Base.partial;
-for(var i=0;i<_186;i++){
-var _188=_185[i];
-var _189=_184[i%_183];
-var _190=this.options.strokeColorTransform;
-_182.save();
-_182.fillStyle=_189.toRGBString();
-if(this.options.strokeColor){
-_182.strokeStyle=this.options.strokeColor.toRGBString();
-}else{
-if(this.options.strokeColorTransform){
-_182.strokeStyle=_189[_190]().toRGBString();
-}
-}
-_182.lineWidth=this.options.strokeWidth;
-var _191=function(ctx){
-ctx.beginPath();
-ctx.moveTo(this.area.x,this.area.y+this.area.h);
-var _193=function(ctx_,_195){
-if(_195.name==_188){
-ctx_.lineTo(this.area.w*_195.x+this.area.x,this.area.h*_195.y+this.area.y);
-}
-};
-MochiKit.Iter.forEach(this.layout.points,_187(_193,ctx),this);
-ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y);
-ctx.lineTo(this.area.x,this.area.y+this.area.h);
-ctx.closePath();
-};
-if(this.options.shouldFill){
-bind(_191,this)(_182);
-_182.fill();
-}
-if(this.options.shouldStroke){
-bind(_191,this)(_182);
-_182.stroke();
-}
-_182.restore();
-}
-};
-PlotKit.CanvasRenderer.prototype._renderPieChart=function(){
-var _196=this.element.getContext("2d");
-var _197=this.options.colorScheme.length;
-var _198=this.layout.slices;
-var _199=this.area.x+this.area.w*0.5;
-var _200=this.area.y+this.area.h*0.5;
-var _201=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
-if(this.isIE){
-_199=parseInt(_199);
-_200=parseInt(_200);
-_201=parseInt(_201);
-}
-for(var i=0;i<_198.length;i++){
-var _202=this.options.colorScheme[i%_197];
-_196.save();
-_196.fillStyle=_202.toRGBString();
-var _203=function(){
-_196.beginPath();
-_196.moveTo(_199,_200);
-_196.arc(_199,_200,_201,_198[i].startAngle-Math.PI/2,_198[i].endAngle-Math.PI/2,false);
-_196.lineTo(_199,_200);
-_196.closePath();
-};
-if(Math.abs(_198[i].startAngle-_198[i].endAngle)>0.001){
-if(this.options.shouldFill){
-_203();
-_196.fill();
-}
-if(this.options.shouldStroke){
-_203();
-_196.lineWidth=this.options.strokeWidth;
-if(this.options.strokeColor){
-_196.strokeStyle=this.options.strokeColor.toRGBString();
-}else{
-if(this.options.strokeColorTransform){
-_196.strokeStyle=_202[this.options.strokeColorTransform]().toRGBString();
-}
-}
-_196.stroke();
-}
-}
-_196.restore();
-}
-};
-PlotKit.CanvasRenderer.prototype._renderBarAxis=function(){
-this._renderAxis();
-};
-PlotKit.CanvasRenderer.prototype._renderLineAxis=function(){
-this._renderAxis();
-};
-PlotKit.CanvasRenderer.prototype._renderAxis=function(){
-if(!this.options.drawXAxis&&!this.options.drawYAxis){
-return;
-}
-var _204=this.element.getContext("2d");
-var _205={"style":{"position":"absolute","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}};
-_204.save();
-_204.strokeStyle=this.options.axisLineColor.toRGBString();
-_204.lineWidth=this.options.axisLineWidth;
-if(this.options.drawYAxis){
-if(this.layout.yticks){
-var _206=function(tick){
-if(typeof (tick)=="function"){
-return;
-}
-var x=this.area.x;
-var y=this.area.y+tick[0]*this.area.h;
-_204.beginPath();
-_204.moveTo(x,y);
-_204.lineTo(x-this.options.axisTickSize,y);
-_204.closePath();
-_204.stroke();
-var _207=DIV(_205,tick[1]);
-_207.style.top=(y-this.options.axisLabelFontSize)+"px";
-_207.style.left=(x-this.options.padding.left-this.options.axisTickSize)+"px";
-_207.style.textAlign="right";
-_207.style.width=(this.options.padding.left-this.options.axisTickSize*2)+"px";
-MochiKit.DOM.appendChildNodes(this.container,_207);
-this.ylabels.push(_207);
-};
-MochiKit.Iter.forEach(this.layout.yticks,bind(_206,this));
-}
-_204.beginPath();
-_204.moveTo(this.area.x,this.area.y);
-_204.lineTo(this.area.x,this.area.y+this.area.h);
-_204.closePath();
-_204.stroke();
-}
-if(this.options.drawXAxis){
-if(this.layout.xticks){
-var _206=function(tick){
-if(typeof (dataset)=="function"){
-return;
-}
-var x=this.area.x+tick[0]*this.area.w;
-var y=this.area.y+this.area.h;
-_204.beginPath();
-_204.moveTo(x,y);
-_204.lineTo(x,y+this.options.axisTickSize);
-_204.closePath();
-_204.stroke();
-var _208=DIV(_205,tick[1]);
-_208.style.top=(y+this.options.axisTickSize)+"px";
-_208.style.left=(x-this.options.axisLabelWidth/2)+"px";
-_208.style.textAlign="center";
-_208.style.width=this.options.axisLabelWidth+"px";
-MochiKit.DOM.appendChildNodes(this.container,_208);
-this.xlabels.push(_208);
-};
-MochiKit.Iter.forEach(this.layout.xticks,bind(_206,this));
-}
-_204.beginPath();
-_204.moveTo(this.area.x,this.area.y+this.area.h);
-_204.lineTo(this.area.x+this.area.w,this.area.y+this.area.h);
-_204.closePath();
-_204.stroke();
-}
-_204.restore();
-};
-PlotKit.CanvasRenderer.prototype._renderPieAxis=function(){
-if(!this.options.drawXAxis){
-return;
-}
-if(this.layout.xticks){
-var _209=new Array();
-for(var i=0;i<this.layout.slices.length;i++){
-_209[this.layout.slices[i].xval]=this.layout.slices[i];
-}
-var _210=this.area.x+this.area.w*0.5;
-var _211=this.area.y+this.area.h*0.5;
-var _212=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
-var _213=this.options.axisLabelWidth;
-for(var i=0;i<this.layout.xticks.length;i++){
-var _214=_209[this.layout.xticks[i][0]];
-if(MochiKit.Base.isUndefinedOrNull(_214)){
-continue;
-}
-var _215=(_214.startAngle+_214.endAngle)/2;
-var _216=_215;
-if(_216>Math.PI*2){
-_216=_216-Math.PI*2;
-}else{
-if(_216<0){
-_216=_216+Math.PI*2;
-}
-}
-var _217=_210+Math.sin(_216)*(_212+10);
-var _218=_211-Math.cos(_216)*(_212+10);
-var _219={"position":"absolute","zIndex":11,"width":_213+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()};
-if(_216<=Math.PI*0.5){
-_219["textAlign"]="left";
-_219["verticalAlign"]="top";
-_219["left"]=_217+"px";
-_219["top"]=(_218-this.options.axisLabelFontSize)+"px";
-}else{
-if((_216>Math.PI*0.5)&&(_216<=Math.PI)){
-_219["textAlign"]="left";
-_219["verticalAlign"]="bottom";
-_219["left"]=_217+"px";
-_219["top"]=_218+"px";
-}else{
-if((_216>Math.PI)&&(_216<=Math.PI*1.5)){
-_219["textAlign"]="right";
-_219["verticalAlign"]="bottom";
-_219["left"]=(_217-_213)+"px";
-_219["top"]=_218+"px";
-}else{
-_219["textAlign"]="right";
-_219["verticalAlign"]="bottom";
-_219["left"]=(_217-_213)+"px";
-_219["top"]=(_218-this.options.axisLabelFontSize)+"px";
-}
-}
-}
-var _220=DIV({"style":_219},this.layout.xticks[i][1]);
-this.xlabels.push(_220);
-MochiKit.DOM.appendChildNodes(this.container,_220);
-}
-}
-};
-PlotKit.CanvasRenderer.prototype._renderBackground=function(){
-var _221=this.element.getContext("2d");
-_221.save();
-_221.fillStyle=this.options.backgroundColor.toRGBString();
-_221.fillRect(0,0,this.width,this.height);
-_221.restore();
-};
-PlotKit.CanvasRenderer.prototype.clear=function(){
-if(this.isIE){
-try{
-if(this.clearDelay){
-this.clearDelay.cancel();
-this.clearDelay=null;
-}
-var _222=this.element.getContext("2d");
-}
-catch(e){
-this.isFirstRender=false;
-this.clearDelay=MochiKit.Async.wait(this.IEDelay);
-this.clearDelay.addCallback(bind(this.clear,this));
-return;
-}
-}
-var _222=this.element.getContext("2d");
-_222.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 _223=MochiKit.Signal.connect;
-var bind=MochiKit.Base.bind;
-_223(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 _225=this.layout.hitTest(x,y);
-if(_225){
-return _225;
-}
-return null;
-};
-PlotKit.CanvasRenderer.prototype._createEventObject=function(_226,e){
-if(_226==null){
-return null;
-}
-e.chart=_226;
-return e;
-};
-PlotKit.CanvasRenderer.prototype.onclick=function(e){
-var _227=this._resolveObject(e);
-var _228=this._createEventObject(_227,e);
-if(_228!=null){
-MochiKit.Signal.signal(this,"onclick",_228);
-}
-};
-PlotKit.CanvasRenderer.prototype.onmouseover=function(e){
-var _229=this._resolveObject(e);
-var _230=this._createEventObject(_229,e);
-if(_230!=null){
-signal(this,"onmouseover",_230);
-}
-};
-PlotKit.CanvasRenderer.prototype.onmouseout=function(e){
-var _231=this._resolveObject(e);
-var _232=this._createEventObject(_231,e);
-if(_232==null){
-signal(this,"onmouseout",e);
-}else{
-signal(this,"onmouseout",_232);
-}
-};
-PlotKit.CanvasRenderer.prototype.onmousemove=function(e){
-var _233=this._resolveObject(e);
-var _234=this._createEventObject(_233,e);
-if((_233==null)&&(this.event_isinside==null)){
-return;
-}
-if((_233!=null)&&(this.event_isinside==null)){
-signal(this,"onmouseover",_234);
-}
-if((_233==null)&&(this.event_isinside!=null)){
-signal(this,"onmouseout",_234);
-}
-if((_233!=null)&&(this.event_isinside!=null)){
-signal(this,"onmousemove",_234);
-}
-this.event_isinside=_233;
-};
-PlotKit.CanvasRenderer.isSupported=function(_235){
-var _236=null;
-try{
-if(MochiKit.Base.isUndefinedOrNull(_235)){
-_236=MochiKit.DOM.CANVAS({});
-}else{
-_236=MochiKit.DOM.getElement(_235);
-}
-var _237=_236.getContext("2d");
-}
-catch(e){
-var ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
-var _239=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
-if((!ie)||(ie[1]<6)||(_239)){
-return false;
-}
-return true;
-}
-return true;
-};
-PlotKit.Canvas={};
-PlotKit.Canvas.CanvasRenderer=PlotKit.CanvasRenderer;
-PlotKit.Canvas.EXPORT=["CanvasRenderer"];
-PlotKit.Canvas.EXPORT_OK=["CanvasRenderer"];
-PlotKit.Canvas.__new__=function(){
-var m=MochiKit.Base;
-m.nameFunctions(this);
-this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
-};
-PlotKit.Canvas.__new__();
-MochiKit.Base._exportSymbols(this,PlotKit.Canvas);
-
-
-// Copyright 2006 Dan Vanderkam (danvdk@gmail.com)
-// All Rights Reserved.
-
-/**
- * @fileoverview Subclasses various parts of PlotKit to meet the additional
- * needs of DateGraph: grid overlays and error bars
- */
-
-// Subclass PlotKit.Layout to add:
-// 1. Sigma/errorBars properties
-// 2. Copy error terms for PlotKit.CanvasRenderer._renderLineChart
-
-/**
- * Creates a new DateGraphLayout object. Options are the same as those allowed
- * by the PlotKit.Layout constructor.
- * @param {Object} options Options for PlotKit.Layout
- * @return {Object} The DateGraphLayout object
- */
-DateGraphLayout = function(options) {
- PlotKit.Layout.call(this, "line", options);
-};
-DateGraphLayout.prototype = new PlotKit.Layout();
-
-/**
- * Behaves the same way as PlotKit.Layout, but also copies the errors
- * @private
- */
-DateGraphLayout.prototype.evaluateWithError = function() {
- this.evaluate();
- if (!this.options.errorBars) return;
-
- // Copy over the error terms
- var i = 0; // index in this.points
- for (var setName in this.datasets) {
- var j = 0;
- var dataset = this.datasets[setName];
- if (PlotKit.Base.isFuncLike(dataset)) continue;
- for (var j = 0; j < dataset.length; j++, i++) {
- var item = dataset[j];
- var xv = parseFloat(item[0]);
- var yv = parseFloat(item[1]);
-
- if (xv == this.points[i].xval &&
- yv == this.points[i].yval) {
- this.points[i].errorMinus = parseFloat(item[2]);
- this.points[i].errorPlus = parseFloat(item[3]);
- }
- }
- }
-};
-
-/**
- * Convenience function to remove all the data sets from a graph
- */
-DateGraphLayout.prototype.removeAllDatasets = function() {
- delete this.datasets;
- this.datasets = new Array();
-};
-
-/**
- * Change the values of various layout options
- * @param {Object} new_options an associative array of new properties
- */
-DateGraphLayout.prototype.updateOptions = function(new_options) {
- MochiKit.Base.update(this.options, new_options ? new_options : {});
-};
-
-// Subclass PlotKit.CanvasRenderer to add:
-// 1. X/Y grid overlay
-// 2. Ability to draw error bars (if required)
-
-/**
- * Sets some PlotKit.CanvasRenderer options
- * @param {Object} element The canvas to attach to
- * @param {Layout} layout The DateGraphLayout object for this graph.
- * @param {Object} options Options to pass on to CanvasRenderer
- */
-DateGraphCanvasRenderer = function(element, layout, options) {
- PlotKit.CanvasRenderer.call(this, element, layout, options);
- this.options.shouldFill = false;
- this.options.shouldStroke = true;
- this.options.drawYGrid = true;
- this.options.drawXGrid = true;
- this.options.gridLineColor = MochiKit.Color.Color.grayColor();
- MochiKit.Base.update(this.options, options);
-
- // TODO(danvk) This shouldn't be necessary: effects should be overlaid
- this.options.drawBackground = false;
-};
-DateGraphCanvasRenderer.prototype = new PlotKit.CanvasRenderer();
-
-/**
- * Draw an X/Y grid on top of the existing plot
- */
-DateGraphCanvasRenderer.prototype.render = function() {
- // Do the ordinary rendering, as before
- // TODO(danvk) Call super.render()
- this._renderLineChart();
- this._renderLineAxis();
-
- // Draw the new X/Y grid
- var ctx = this.element.getContext("2d");
- if (this.options.drawYGrid) {
- var ticks = this.layout.yticks;
- ctx.save();
- ctx.strokeStyle = this.options.gridLineColor.toRGBString();
- ctx.lineWidth = this.options.axisLineWidth;
- for (var i = 0; i < ticks.length; i++) {
- var x = this.area.x;
- var y = this.area.y + ticks[i][0] * this.area.h;
- ctx.beginPath();
- ctx.moveTo(x, y);
- ctx.lineTo(x + this.area.w, y);
- ctx.closePath();
- ctx.stroke();
- }
- }
-
- if (this.options.drawXGrid) {
- var ticks = this.layout.xticks;
- ctx.save();
- ctx.strokeStyle = this.options.gridLineColor.toRGBString();
- ctx.lineWidth = this.options.axisLineWidth;
- for (var i=0; i<ticks.length; i++) {
- var x = this.area.x + ticks[i][0] * this.area.w;
- var y = this.area.y + this.area.h;
- ctx.beginPath();
- ctx.moveTo(x, y);
- ctx.lineTo(x, this.area.y);
- ctx.closePath();
- ctx.stroke();
- }
- }
-};
-
-/**
- * Overrides the CanvasRenderer method to draw error bars
- */
-DateGraphCanvasRenderer.prototype._renderLineChart = function() {
- var context = this.element.getContext("2d");
- var colorCount = this.options.colorScheme.length;
- var colorScheme = this.options.colorScheme;
- var setNames = MochiKit.Base.keys(this.layout.datasets);
- var errorBars = this.layout.options.errorBars;
- var setCount = setNames.length;
- var bind = MochiKit.Base.bind;
- var partial = MochiKit.Base.partial;
-
- //Update Points
- var updatePoint = function(point) {
- point.canvasx = this.area.w * point.x + this.area.x;
- point.canvasy = this.area.h * point.y + this.area.y;
- }
- MochiKit.Iter.forEach(this.layout.points, updatePoint, this);
-
- // create paths
- var makePath = function(ctx) {
- for (var i = 0; i < setCount; i++) {
- var setName = setNames[i];
- var color = colorScheme[i%colorCount];
- var strokeX = this.options.strokeColorTransform;
-
- // setup graphics context
- context.save();
- context.strokeStyle = color.toRGBString();
- context.lineWidth = this.options.strokeWidth;
- ctx.beginPath();
- var point = this.layout.points[0];
- var first_point = true;
- var addPoint = function(ctx_, point) {
- if (point.name == setName) {
- if (first_point)
- ctx_.moveTo(point.canvasx, point.canvasy);
- else
- ctx_.lineTo(point.canvasx, point.canvasy);
- first_point = false;
- }
- };
- MochiKit.Iter.forEach(this.layout.points, partial(addPoint, ctx), this);
- ctx.stroke();
- }
- };
-
- var makeErrorBars = function(ctx) {
- for (var i = 0; i < setCount; i++) {
- var setName = setNames[i];
- var color = colorScheme[i % colorCount];
- var strokeX = this.options.strokeColorTransform;
-
- // setup graphics context
- context.save();
- context.strokeStyle = color.toRGBString();
- context.lineWidth = this.options.strokeWidth;
- var prevX = -1;
- var prevYs = [-1, -1];
- var count = 0;
- var yscale = this.layout.yscale;
- var errorTrapezoid = function(ctx_,point) {
- count++;
- if (point.name == setName) {
- var newYs = [ point.y - point.errorPlus * yscale,
- point.y + point.errorMinus * yscale ];
- newYs[0] = this.area.h * newYs[0] + this.area.y;
- newYs[1] = this.area.h * newYs[1] + this.area.y;
- if (prevX >= 0) {
- ctx_.moveTo(prevX, prevYs[0]);
- ctx_.lineTo(point.canvasx, newYs[0]);
- ctx_.lineTo(point.canvasx, newYs[1]);
- ctx_.lineTo(prevX, prevYs[1]);
- ctx_.closePath();
- }
- prevYs[0] = newYs[0];
- prevYs[1] = newYs[1];
- prevX = point.canvasx;
- }
- };
- // should be same color as the lines
- var err_color = color.colorWithAlpha(0.15);
- ctx.fillStyle = err_color.toRGBString();
- ctx.beginPath();
- MochiKit.Iter.forEach(this.layout.points, partial(errorTrapezoid, ctx), this);
- ctx.fill();
- }
- };
-
- if (errorBars)
- bind(makeErrorBars, this)(context);
- bind(makePath, this)(context);
- context.restore();
-};
-// Copyright 2006 Dan Vanderkam (danvdk@gmail.com)
-// All Rights Reserved.
-
-/**
- * @fileoverview Creates an interactive, zoomable graph based on a CSV file or
- * string. DateGraph can handle multiple series with or without error bars. The
- * date/value ranges will be automatically set. DateGraph uses the
- * <canvas> tag, so it only works in FF1.5+.
- * @author danvdk@gmail.com (Dan Vanderkam)
-
- Usage:
- <div id="graphdiv" style="width:800px; height:500px;"></div>
- <script type="text/javascript">
- new DateGraph(document.getElementById("graphdiv"),
- "datafile.csv",
- ["Series 1", "Series 2"],
- { }); // options
- </script>
-
- The CSV file is of the form
-
- YYYYMMDD,A1,B1,C1
- YYYYMMDD,A2,B2,C2
-
- If null is passed as the third parameter (series names), then the first line
- of the CSV file is assumed to contain names for each series.
-
- If the 'errorBars' option is set in the constructor, the input should be of
- the form
-
- YYYYMMDD,A1,sigmaA1,B1,sigmaB1,...
- YYYYMMDD,A2,sigmaA2,B2,sigmaB2,...
-
- If the 'fractions' option is set, the input should be of the form:
-
- YYYYMMDD,A1/B1,A2/B2,...
- YYYYMMDD,A1/B1,A2/B2,...
-
- And error bars will be calculated automatically using a binomial distribution.
-
- For further documentation and examples, see http://www/~danvk/dg/
-
- */
-
-/**
- * An interactive, zoomable graph
- * @param {String | Function} file A file containing CSV data or a function that
- * returns this data. The expected format for each line is
- * YYYYMMDD,val1,val2,... or, if attrs.errorBars is set,
- * YYYYMMDD,val1,stddev1,val2,stddev2,...
- * @param {Array.<String>} labels Labels for the data series
- * @param {Object} attrs Various other attributes, e.g. errorBars determines
- * whether the input data contains error ranges.
- */
-DateGraph = function(div, file, labels, attrs) {
- if (arguments.length > 0)
- this.__init__(div, file, labels, attrs);
-};
-
-DateGraph.NAME = "DateGraph";
-DateGraph.VERSION = "1.1";
-DateGraph.__repr__ = function() {
- return "[" + this.NAME + " " + this.VERSION + "]";
-};
-DateGraph.toString = function() {
- return this.__repr__();
-};
-
-// Various default values
-DateGraph.DEFAULT_ROLL_PERIOD = 1;
-DateGraph.DEFAULT_WIDTH = 480;
-DateGraph.DEFAULT_HEIGHT = 320;
-DateGraph.DEFAULT_STROKE_WIDTH = 1.0;
-DateGraph.AXIS_LINE_WIDTH = 0.3;
-
-/**
- * Initializes the DateGraph. This creates a new DIV and constructs the PlotKit
- * and interaction <canvas> inside of it. See the constructor for details
- * on the parameters.
- * @param {String | Function} file Source data
- * @param {Array.<String>} labels Names of the data series
- * @param {Object} attrs Miscellaneous other options
- * @private
- */
-DateGraph.prototype.__init__ = function(div, file, labels, attrs) {
- // Copy the important bits into the object
- this.maindiv_ = div;
- this.labels_ = labels;
- this.file_ = file;
- this.rollPeriod_ = attrs.rollPeriod || DateGraph.DEFAULT_ROLL_PERIOD;
- this.previousVerticalX_ = -1;
- this.width_ = parseInt(div.style.width, 10);
- this.height_ = parseInt(div.style.height, 10);
- this.errorBars_ = attrs.errorBars || false;
- this.fractions_ = attrs.fractions || false;
- this.strokeWidth_ = attrs.strokeWidth || DateGraph.DEFAULT_STROKE_WIDTH;
- this.dateWindow_ = attrs.dateWindow || null;
- this.valueRange_ = attrs.valueRange || null;
- this.labelsSeparateLines = attrs.labelsSeparateLines || false;
- this.labelsDiv_ = attrs.labelsDiv || null;
- this.labelsKMB_ = attrs.labelsKMB || false;
- this.minTickSize_ = attrs.minTickSize || 0;
- this.xValueParser_ = attrs.xValueParser || DateGraph.prototype.dateParser;
- this.xValueFormatter_ = attrs.xValueFormatter ||
- DateGraph.prototype.dateString_;
- this.xTicker_ = attrs.xTicker || DateGraph.prototype.dateTicker;
- this.sigma_ = attrs.sigma || 2.0;
- this.wilsonInterval_ = attrs.wilsonInterval || true;
- this.customBars_ = attrs.customBars || false;
- this.attrs_ = attrs;
-
- // Make a note of whether labels will be pulled from the CSV file.
- this.labelsFromCSV_ = (this.labels_ == null);
- if (this.labels_ == null)
- this.labels_ = [];
-
- // Prototype of the callback is "void clickCallback(event, date)"
- this.clickCallback_ = attrs.clickCallback || null;
-
- // Prototype of zoom callback is "void dragCallback(minDate, maxDate)"
- this.zoomCallback_ = attrs.zoomCallback || null;
-
- // Create the containing DIV and other interactive elements
- this.createInterface_();
-
- // Create the PlotKit grapher
- this.layoutOptions_ = { 'errorBars': (this.errorBars_ || this.customBars_),
- 'xOriginIsZero': false };
- MochiKit.Base.update(this.layoutOptions_, attrs);
- this.setColors_(attrs);
-
- 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_, attrs);
- this.plotter_ = new DateGraphCanvasRenderer(this.hidden_, this.layout_,
- this.renderOptions_);
-
- this.createStatusMessage_();
- this.createRollInterface_();
- this.createDragInterface_();
-
- connect(window, 'onload', this, function(e) { this.start_(); });
-};
-
-/**
- * Returns the current rolling period, as set by the user or an option.
- * @return {Number} The number of days in the rolling window
- */
-DateGraph.prototype.rollPeriod = function() {
- return this.rollPeriod_;
-}
-
-/**
- * Generates interface elements for the DateGraph: a containing div, a div to
- * display the current point, and a textbox to adjust the rolling average
- * period.
- * @private
- */
-DateGraph.prototype.createInterface_ = function() {
- // Create the all-enclosing graph div
- var enclosing = this.maindiv_;
-
- this.graphDiv = MochiKit.DOM.DIV( { style: { 'width': this.width_ + "px",
- 'height': this.height_ + "px"
- }});
- appendChildNodes(enclosing, this.graphDiv);
-
- // Create the canvas to store
- var canvas = MochiKit.DOM.CANVAS;
- this.canvas_ = canvas( { 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) { this.mouseMove_(e) });
- connect(this.hidden_, 'onmouseout', this, function(e) { this.mouseOut_(e) });
-}
-
-/**
- * Creates the canvas containing the PlotKit graph. Only plotkit ever draws on
- * this particular canvas. All DateGraph work is done on this.canvas_.
- * @param {Object} canvas The DateGraph canvas to over which to overlay the plot
- * @return {Object} The newly-created canvas
- * @private
- */
-DateGraph.prototype.createPlotKitCanvas_ = function(canvas) {
- var h = document.createElement("canvas");
- h.style.position = "absolute";
- h.style.top = canvas.style.top;
- h.style.left = canvas.style.left;
- h.width = this.width_;
- h.height = this.height_;
- MochiKit.DOM.appendChildNodes(this.graphDiv, h);
- return h;
-};
-
-/**
- * Generate a set of distinct colors for the data series. This is done with a
- * color wheel. Saturation/Value are customizable, and the hue is
- * equally-spaced around the color wheel. If a custom set of colors is
- * specified, that is used instead.
- * @param {Object} attrs Various attributes, e.g. saturation and value
- * @private
- */
-DateGraph.prototype.setColors_ = function(attrs) {
- var num = this.labels_.length;
- this.colors_ = [];
- if (!attrs.colors) {
- var sat = attrs.colorSaturation || 1.0;
- var val = attrs.colorValue || 0.5;
- for (var i = 1; i <= num; i++) {
- var hue = (1.0*i/(1+num));
- this.colors_.push( MochiKit.Color.Color.fromHSV(hue, sat, val) );
- }
- } else {
- for (var i = 0; i < num; i++) {
- var colorStr = attrs.colors[i % attrs.colors.length];
- this.colors_.push( MochiKit.Color.Color.fromString(colorStr) );
- }
- }
-}
-
-/**
- * Create the div that contains information on the selected point(s)
- * This goes in the top right of the canvas, unless an external div has already
- * been specified.
- * @private
- */
-DateGraph.prototype.createStatusMessage_ = function(){
- if (!this.labelsDiv_) {
- var divWidth = 250;
- var messagestyle = { "style": {
- "position": "absolute",
- "fontSize": "14px",
- "zIndex": 10,
- "width": divWidth + "px",
- "top": "0px",
- "left": this.width_ - divWidth + "px",
- "background": "white",
- "textAlign": "left",
- "overflow": "hidden"}};
- this.labelsDiv_ = MochiKit.DOM.DIV(messagestyle);
- MochiKit.DOM.appendChildNodes(this.graphDiv, this.labelsDiv_);
- }
-};
-
-/**
- * Create the text box to adjust the averaging period
- * @return {Object} The newly-created text box
- * @private
- */
-DateGraph.prototype.createRollInterface_ = function() {
- var padding = this.plotter_.options.padding;
- var textAttr = { "type": "text",
- "size": "2",
- "value": this.rollPeriod_,
- "style": { "position": "absolute",
- "zIndex": 10,
- "top": (this.height_ - 25 - padding.bottom) + "px",
- "left": (padding.left+1) + "px" }
- };
- var roller = MochiKit.DOM.INPUT(textAttr);
- var pa = this.graphDiv;
- MochiKit.DOM.appendChildNodes(pa, roller);
- connect(roller, 'onchange', this,
- function() { this.adjustRoll(roller.value); });
- return roller;
-}
-
-/**
- * Set up all the mouse handlers needed to capture dragging behavior for zoom
- * events. Uses MochiKit.Signal to attach all the event handlers.
- * @private
- */
-DateGraph.prototype.createDragInterface_ = function() {
- var self = this;
-
- // Tracks whether the mouse is down right now
- var mouseDown = false;
- var dragStartX = null;
- var dragStartY = null;
- var dragEndX = null;
- var dragEndY = null;
- var prevEndX = null;
-
- // Utility function to convert page-wide coordinates to canvas coords
- var px = PlotKit.Base.findPosX(this.canvas_);
- var py = PlotKit.Base.findPosY(this.canvas_);
- var getX = function(e) { return e.mouse().page.x - px };
- var getY = function(e) { return e.mouse().page.y - py };
-
- // Draw zoom rectangles when the mouse is down and the user moves around
- connect(this.hidden_, 'onmousemove', function(event) {
- if (mouseDown) {
- dragEndX = getX(event);
- dragEndY = getY(event);
-
- self.drawZoomRect_(dragStartX, dragEndX, prevEndX);
- prevEndX = dragEndX;
- }
- });
-
- // Track the beginning of drag events
- connect(this.hidden_, 'onmousedown', function(event) {
- mouseDown = true;
- dragStartX = getX(event);
- dragStartY = getY(event);
- });
-
- // If the user releases the mouse button during a drag, but not over the
- // canvas, then it doesn't count as a zooming action.
- connect(document, 'onmouseup', this, function(event) {
- if (mouseDown) {
- mouseDown = false;
- dragStartX = null;
- dragStartY = null;
- }
- });
-
- // Temporarily cancel the dragging event when the mouse leaves the graph
- connect(this.hidden_, 'onmouseout', this, function(event) {
- if (mouseDown) {
- dragEndX = null;
- dragEndY = null;
- }
- });
-
- // If the mouse is released on the canvas during a drag event, then it's a
- // zoom. Only do the zoom if it's over a large enough area (>= 10 pixels)
- connect(this.hidden_, 'onmouseup', this, function(event) {
- if (mouseDown) {
- mouseDown = false;
- dragEndX = getX(event);
- dragEndY = getY(event);
- var regionWidth = Math.abs(dragEndX - dragStartX);
- var regionHeight = Math.abs(dragEndY - dragStartY);
-
- if (regionWidth < 2 && regionHeight < 2 &&
- self.clickCallback_ != null &&
- self.lastx_ != undefined) {
- self.clickCallback_(event, new Date(self.lastx_));
- }
-
- if (regionWidth >= 10) {
- self.doZoom_(Math.min(dragStartX, dragEndX),
- Math.max(dragStartX, dragEndX));
- } else {
- self.canvas_.getContext("2d").clearRect(0, 0,
- self.canvas_.width,
- self.canvas_.height);
- }
-
- dragStartX = null;
- dragStartY = null;
- }
- });
-
- // Double-clicking zooms back out
- connect(this.hidden_, 'ondblclick', this, function(event) {
- self.dateWindow_ = null;
- self.drawGraph_(self.rawData_);
- var minDate = self.rawData_[0][0];
- var maxDate = self.rawData_[self.rawData_.length - 1][0];
- self.zoomCallback_(minDate, maxDate);
- });
-};
-
-/**
- * Draw a gray zoom rectangle over the desired area of the canvas. Also clears
- * up any previous zoom rectangles that were drawn. This could be optimized to
- * avoid extra redrawing, but it's tricky to avoid interactions with the status
- * dots.
- * @param {Number} startX The X position where the drag started, in canvas
- * coordinates.
- * @param {Number} endX The current X position of the drag, in canvas coords.
- * @param {Number} prevEndX The value of endX on the previous call to this
- * function. Used to avoid excess redrawing
- * @private
- */
-DateGraph.prototype.drawZoomRect_ = function(startX, endX, prevEndX) {
- var ctx = this.canvas_.getContext("2d");
-
- // Clean up from the previous rect if necessary
- if (prevEndX) {
- ctx.clearRect(Math.min(startX, prevEndX), 0,
- Math.abs(startX - prevEndX), this.height_);
- }
-
- // Draw a light-grey rectangle to show the new viewing area
- if (endX && startX) {
- ctx.fillStyle = "rgba(128,128,128,0.33)";
- ctx.fillRect(Math.min(startX, endX), 0,
- Math.abs(endX - startX), this.height_);
- }
-};
-
-/**
- * Zoom to something containing [lowX, highX]. These are pixel coordinates
- * in the canvas. The exact zoom window may be slightly larger if there are no
- * data points near lowX or highX. This function redraws the graph.
- * @param {Number} lowX The leftmost pixel value that should be visible.
- * @param {Number} highX The rightmost pixel value that should be visible.
- * @private
- */
-DateGraph.prototype.doZoom_ = function(lowX, highX) {
- // Find the earliest and latest dates contained in this canvasx range.
- var points = this.layout_.points;
- var minDate = null;
- var maxDate = null;
- // Find the nearest [minDate, maxDate] that contains [lowX, highX]
- for (var i = 0; i < points.length; i++) {
- var cx = points[i].canvasx;
- var x = points[i].xval;
- if (cx < lowX && (minDate == null || x > minDate)) minDate = x;
- if (cx > highX && (maxDate == null || x < maxDate)) maxDate = x;
- }
- // Use the extremes if either is missing
- if (minDate == null) minDate = points[0].xval;
- if (maxDate == null) maxDate = points[points.length-1].xval;
-
- this.dateWindow_ = [minDate, maxDate];
- this.drawGraph_(this.rawData_);
- this.zoomCallback_(minDate, maxDate);
-};
-
-/**
- * When the mouse moves in the canvas, display information about a nearby data
- * point and draw dots over those points in the data series. This function
- * takes care of cleanup of previously-drawn dots.
- * @param {Object} event The mousemove event from the browser.
- * @private
- */
-DateGraph.prototype.mouseMove_ = function(event) {
- var canvasx = event.mouse().page.x - PlotKit.Base.findPosX(this.hidden_);
- var points = this.layout_.points;
-
- var lastx = -1;
- var lasty = -1;
-
- // Loop through all the points and find the date nearest to our current
- // location.
- var minDist = 1e+100;
- var idx = -1;
- for (var i = 0; i < points.length; i++) {
- var dist = Math.abs(points[i].canvasx - canvasx);
- if (dist > minDist) break;
- minDist = dist;
- idx = i;
- }
- if (idx >= 0) lastx = points[idx].xval;
- // Check that you can really highlight the last day's data
- if (canvasx > points[points.length-1].canvasx)
- lastx = points[points.length-1].xval;
-
- // Extract the points we've selected
- var selPoints = [];
- for (var i = 0; i < points.length; i++) {
- if (points[i].xval == lastx) {
- selPoints.push(points[i]);
- }
- }
-
- // Clear the previously drawn vertical, if there is one
- var circleSize = 3;
- var ctx = this.canvas_.getContext("2d");
- if (this.previousVerticalX_ >= 0) {
- var px = this.previousVerticalX_;
- ctx.clearRect(px - circleSize - 1, 0, 2 * circleSize + 2, this.height_);
- }
-
- if (selPoints.length > 0) {
- var canvasx = selPoints[0].canvasx;
-
- // Set the status message to indicate the selected point(s)
- var replace = this.xValueFormatter_(lastx) + ":";
- var clen = this.colors_.length;
- for (var i = 0; i < selPoints.length; i++) {
- if (this.labelsSeparateLines) {
- replace += "<br/>";
- }
- var point = selPoints[i];
- replace += " <b><font color='" + this.colors_[i%clen].toHexString() + "'>"
- + point.name + "</font></b>:"
- + this.round_(point.yval, 2);
- }
- this.labelsDiv_.innerHTML = replace;
-
- // Save last x position for callbacks.
- this.lastx_ = lastx;
-
- // Draw colored circles over the center of each selected point
- ctx.save()
- for (var i = 0; i < selPoints.length; i++) {
- ctx.beginPath();
- ctx.fillStyle = this.colors_[i%clen].toRGBString();
- ctx.arc(canvasx, selPoints[i%clen].canvasy, circleSize, 0, 360, false);
- ctx.fill();
- }
- ctx.restore();
-
- this.previousVerticalX_ = canvasx;
- }
-};
-
-/**
- * The mouse has left the canvas. Clear out whatever artifacts remain
- * @param {Object} event the mouseout event from the browser.
- * @private
- */
-DateGraph.prototype.mouseOut_ = function(event) {
- // Get rid of the overlay data
- var ctx = this.canvas_.getContext("2d");
- ctx.clearRect(0, 0, this.width_, this.height_);
- this.labelsDiv_.innerHTML = "";
-};
-
-/**
- * Convert a JS date (millis since epoch) to YYYY/MM/DD
- * @param {Number} date The JavaScript date (ms since epoch)
- * @return {String} A date of the form "YYYY/MM/DD"
- * @private
- */
-DateGraph.prototype.dateString_ = function(date) {
- var d = new Date(date);
-
- // Get the year:
- var year = "" + d.getFullYear();
- // Get a 0 padded month string
- var month = "" + (d.getMonth() + 1); //months are 0-offset, sigh
- if (month.length < 2) month = "0" + month;
- // Get a 0 padded day string
- var day = "" + d.getDate();
- if (day.length < 2) day = "0" + day;
-
- return year + "/" + month + "/" + day;
-};
-
-/**
- * Round a number to the specified number of digits past the decimal point.
- * @param {Number} num The number to round
- * @param {Number} places The number of decimals to which to round
- * @return {Number} The rounded number
- * @private
- */
-DateGraph.prototype.round_ = function(num, places) {
- var shift = Math.pow(10, places);
- return Math.round(num * shift)/shift;
-};
-
-/**
- * Fires when there's data available to be graphed.
- * @param {String} data Raw CSV data to be plotted
- * @private
- */
-DateGraph.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"];
-
-/**
- * Add ticks on the x-axis representing years, months, quarters, weeks, or days
- * @private
- */
-DateGraph.prototype.addXTicks_ = function() {
- // Determine the correct ticks scale on the x-axis: quarterly, monthly, ...
- var startDate, endDate;
- if (this.dateWindow_) {
- startDate = this.dateWindow_[0];
- endDate = this.dateWindow_[1];
- } else {
- startDate = this.rawData_[0][0];
- endDate = this.rawData_[this.rawData_.length - 1][0];
- }
-
- var xTicks = this.xTicker_(startDate, endDate);
- this.layout_.updateOptions({xTicks: xTicks});