beanstalkd_view 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ beanstalkd_view
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -54,3 +54,21 @@ bundle exec beanstalkd_view
54
54
 
55
55
  ![Screenshot](http://s9.postimage.org/tpfksm5kv/beanstalkd_view.png)
56
56
 
57
+ License
58
+ ------------------------
59
+
60
+ beanstalkd_view is released under the MIT license:
61
+
62
+ * http://www.opensource.org/licenses/MIT
63
+
64
+ It makes use of the following components also using the MIT license:
65
+
66
+ * Sinatra - http://www.sinatrarb.com/
67
+
68
+ * jQuery - http://jquery.org/
69
+
70
+ * Bluff JS Graphs - http://bluff.jcoglan.com/
71
+
72
+ And under the Apache license:
73
+
74
+ * Twitter Bootstrap - http://twitter.github.com/bootstrap/
@@ -50,4 +50,4 @@ td.data_cell {
50
50
 
51
51
  .btn {
52
52
  margin-right: 14px;
53
- }
53
+ }
@@ -0,0 +1 @@
1
+ Bluff={VERSION:'0.3.6',array:function(c){if(c.length===undefined)return[c];var d=[],f=c.length;while(f--)d[f]=c[f];return d},array_new:function(c,d){var f=[];while(c--)f.push(d);return f},each:function(c,d,f){for(var g=0,h=c.length;g<h;g++){d.call(f||null,c[g],g)}},index:function(c,d){for(var f=0,g=c.length;f<g;f++){if(c[f]===d)return f}return-1},keys:function(c){var d=[],f;for(f in c)d.push(f);return d},map:function(d,f,g){var h=[];this.each(d,function(c){h.push(f.call(g||null,c))});return h},reverse_each:function(c,d,f){var g=c.length;while(g--)d.call(f||null,c[g],g)},sum:function(c){var d=0,f=c.length;while(f--)d+=c[f];return d},Mini:{}};Bluff.Base=new JS.Class({extend:{DEBUG:false,DATA_LABEL_INDEX:0,DATA_VALUES_INDEX:1,DATA_COLOR_INDEX:2,LEGEND_MARGIN:20,TITLE_MARGIN:20,LABEL_MARGIN:10,DEFAULT_MARGIN:20,DEFAULT_TARGET_WIDTH:800,THOUSAND_SEPARATOR:','},top_margin:null,bottom_margin:null,right_margin:null,left_margin:null,title_margin:null,legend_margin:null,labels:null,center_labels_over_point:null,has_left_labels:null,x_axis_label:null,y_axis_label:null,y_axis_increment:null,colors:null,title:null,font:null,font_color:null,hide_line_markers:null,hide_legend:null,hide_title:null,hide_line_numbers:null,no_data_message:null,title_font_size:null,legend_font_size:null,marker_font_size:null,marker_color:null,marker_count:null,minimum_value:null,maximum_value:null,sort:null,additional_line_values:null,stacked:null,legend_box_size:null,tooltips:false,initialize:function(c,d){this._0=new Bluff.Renderer(c);d=d||this.klass.DEFAULT_TARGET_WIDTH;var f;if(typeof d!=='number'){f=d.split('x');this._j=parseFloat(f[0]);this._t=parseFloat(f[1])}else{this._j=parseFloat(d);this._t=this._j*0.75}this.initialize_ivars();this._1j();this.theme_keynote();this._10={}},initialize_ivars:function(){this._b=800;this._L=800*(this._t/this._j);this._5=0;this.marker_count=null;this.maximum_value=this.minimum_value=null;this._c=false;this._1=[];this.labels={};this._u={};this.sort=true;this.title=null;this._a=this._j/this._b;this.marker_font_size=21.0;this.legend_font_size=20.0;this.title_font_size=36.0;this.top_margin=this.bottom_margin=this.left_margin=this.right_margin=this.klass.DEFAULT_MARGIN;this.legend_margin=this.klass.LEGEND_MARGIN;this.title_margin=this.klass.TITLE_MARGIN;this.legend_box_size=20.0;this.no_data_message="No Data";this.hide_line_markers=this.hide_legend=this.hide_title=this.hide_line_numbers=false;this.center_labels_over_point=true;this.has_left_labels=false;this.additional_line_values=[];this._1C=[];this._k={};this.x_axis_label=this.y_axis_label=null;this.y_axis_increment=null;this.stacked=null;this._9=null},set_margins:function(c){this.top_margin=this.left_margin=this.right_margin=this.bottom_margin=c},set_font:function(c){this.font=c;this._0.font=this.font},add_color:function(c){this.colors.push(c)},replace_colors:function(c){this.colors=c||[];this._w=0},set_theme:function(c){this._1j();this._k={colors:['black','white'],additional_line_colors:[],marker_color:'white',font_color:'black',background_colors:null,background_image:null};for(var d in c)this._k[d]=c[d];this.colors=this._k.colors;this.marker_color=this._k.marker_color;this.font_color=this._k.font_color||this.marker_color;this._1C=this._k.additional_line_colors;this._M()},set_background:function(c){if(c.colors)this._k.background_colors=c.colors;if(c.image)this._k.background_image=c.image;this._M()},theme_keynote:function(){this._11='#6886B4';this._12='#FDD84E';this._v='#72AE6E';this._D='#D1695E';this._13='#8A6EAF';this._E='#EFAA43';this._F='white';this.colors=[this._12,this._11,this._v,this._D,this._13,this._E,this._F];this.set_theme({colors:this.colors,marker_color:'white',font_color:'white',background_colors:['black','#4a465a']})},theme_37signals:function(){this._v='#339933';this._13='#cc99cc';this._11='#336699';this._12='#FFF804';this._D='#ff0000';this._E='#cf5910';this._G='black';this.colors=[this._12,this._11,this._v,this._D,this._13,this._E,this._G];this.set_theme({colors:this.colors,marker_color:'black',font_color:'black',background_colors:['#d1edf5','white']})},theme_rails_keynote:function(){this._v='#00ff00';this._14='#333333';this._E='#ff5d00';this._D='#f61100';this._F='white';this._15='#999999';this._G='black';this.colors=[this._v,this._14,this._E,this._D,this._F,this._15,this._G];this.set_theme({colors:this.colors,marker_color:'white',font_color:'white',background_colors:['#0083a3','#0083a3']})},theme_odeo:function(){this._14='#202020';this._F='white';this._1D='#a21764';this._v='#8ab438';this._15='#999999';this._1E='#3a5b87';this._G='black';this.colors=[this._14,this._F,this._1E,this._1D,this._v,this._15,this._G];this.set_theme({colors:this.colors,marker_color:'white',font_color:'white',background_colors:['#ff47a4','#ff1f81']})},theme_pastel:function(){this.colors=['#a9dada','#aedaa9','#daaea9','#dadaa9','#a9a9da','#daaeda','#dadada'];this.set_theme({colors:this.colors,marker_color:'#aea9a9',font_color:'black',background_colors:'white'})},theme_greyscale:function(){this.colors=['#282828','#383838','#686868','#989898','#c8c8c8','#e8e8e8'];this.set_theme({colors:this.colors,marker_color:'#aea9a9',font_color:'black',background_colors:'white'})},data:function(f,g,h){g=(g===undefined)?[]:g;h=h||null;g=Bluff.array(g);this._1.push([f,g,(h||this._1F())]);this._5=(g.length>this._5)?g.length:this._5;Bluff.each(g,function(c,d){if(c===undefined)return;if(this.maximum_value===null&&this.minimum_value===null)this.maximum_value=this.minimum_value=c;this.maximum_value=this._1k(c)?c:this.maximum_value;if(this.maximum_value>=0)this._c=true;this.minimum_value=this._1G(c)?c:this.minimum_value;if(this.minimum_value<0)this._c=true},this)},draw:function(){if(this.stacked)this._1H();this._1I();this._x(function(){this._0.rectangle(this.left_margin,this.top_margin,this._b-this.right_margin,this._L-this.bottom_margin);this._0.rectangle(this._2,this._7,this._l,this._g)})},clear:function(){this._M()},on:function(c,d,f){var g=this._10[c]=this._10[c]||[];g.push([d,f])},trigger:function(d,f){var g=this._10[d];if(!g)return;Bluff.each(g,function(c){c[0].call(c[1],f)})},_1I:function(){if(!this._c)return this._1J();this._16();this._1K();if(this.sort)this._1L();this._1M();this._N();this._1N();this._1O()},_16:function(g){if(this._9===null||g===true){this._9=[];if(!this._c)return;this._1l();Bluff.each(this._1,function(d){var f=[];Bluff.each(d[this.klass.DATA_VALUES_INDEX],function(c){if(c===null||c===undefined)f.push(null);else f.push((c-this.minimum_value)/this._i)},this);this._9.push([d[this.klass.DATA_LABEL_INDEX],f,d[this.klass.DATA_COLOR_INDEX]])},this)}},_1l:function(){this._i=this.maximum_value-this.minimum_value;this._i=this._i>0?this._i:1;var c=Math.round(Math.LOG10E*Math.log(this._i));this._1m=Math.pow(10,3-c)},_1K:function(){this._O=this.hide_line_markers?0:this._P(this.marker_font_size);this._1n=this.hide_title?0:this._P(this.title_font_size);this._1o=this.hide_legend?0:this._P(this.legend_font_size);var c,d,f,g,h,i,j;if(this.hide_line_markers){this._2=this.left_margin;this._17=this.right_margin;this._1p=this.bottom_margin}else{d=0;if(this.has_left_labels){c='';for(j in this.labels){c=c.length>this.labels[j].length?c:this.labels[j]}d=this._H(this.marker_font_size,c)*1.25}else{d=this._H(this.marker_font_size,this._Q(this.maximum_value))}f=this.hide_line_numbers&&!this.has_left_labels?0.0:d+this.klass.LABEL_MARGIN*2;this._2=this.left_margin+f+(this.y_axis_label===null?0.0:this._O+this.klass.LABEL_MARGIN*2);g=-Infinity;for(j in this.labels)g=g>Number(j)?g:Number(j);g=Math.round(g);h=(g>=(this._5-1)&&this.center_labels_over_point)?this._H(this.marker_font_size,this.labels[g])/2:0;this._17=this.right_margin+h;this._1p=this.bottom_margin+this._O+this.klass.LABEL_MARGIN}this._l=this._b-this._17;this._6=this._b-this._2-this._17;this._7=this.top_margin+(this.hide_title?this.title_margin:this._1n+this.title_margin)+(this.hide_legend?this.legend_margin:this._1o+this.legend_margin);i=(this.x_axis_label===null)?0.0:this._O+this.klass.LABEL_MARGIN;this._g=this._L-this._1p-i;this._3=this._g-this._7},_1N:function(){if(this.x_axis_label){var c=this._g+this.klass.LABEL_MARGIN*2+this._O;this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.stroke='transparent';this._0.pointsize=this._d(this.marker_font_size);this._0.gravity='north';this._0.annotate_scaled(this._b,1.0,0.0,c,this.x_axis_label,this._a);this._x(function(){this._0.line(0.0,c,this._b,c)})}},_N:function(){if(this.hide_line_markers)return;if(this.y_axis_increment===null){if(this.marker_count===null){Bluff.each([3,4,5,6,7],function(c){if(!this.marker_count&&this._i%c===0)this.marker_count=c},this);this.marker_count=this.marker_count||4}this._18=(this._i>0)?this._19(this._i/this.marker_count):1}else{this.maximum_value=Math.max(Math.ceil(this.maximum_value),this.y_axis_increment);this.minimum_value=Math.floor(this.minimum_value);this._1l();this._16(true);this.marker_count=Math.round(this._i/this.y_axis_increment);this._18=this.y_axis_increment}this._1P=this._3/(this._i/this._18);var d,f,g,h;for(d=0,f=this.marker_count;d<=f;d++){g=this._7+this._3-d*this._1P;this._0.stroke=this.marker_color;this._0.stroke_width=1;this._0.line(this._2,g,this._l,g);h=d*this._18+this.minimum_value;if(!this.hide_line_numbers){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.font_weight='normal';this._0.stroke='transparent';this._0.pointsize=this._d(this.marker_font_size);this._0.gravity='east';this._0.annotate_scaled(this._2-this.klass.LABEL_MARGIN,1.0,0.0,g,this._Q(h),this._a)}}},_1q:function(c){return(this._b-c)/2},_1M:function(){if(this.hide_legend)return;this._I=Bluff.map(this._1,function(c){return c[this.klass.DATA_LABEL_INDEX]},this);var i=this.legend_box_size;if(this.font)this._0.font=this.font;this._0.pointsize=this.legend_font_size;var j=[[]];Bluff.each(this._I,function(c){var d=j.length-1;var f=this._0.get_type_metrics(c);var g=f.width+i*2.7;j[d].push(g);if(Bluff.sum(j[d])>(this._b*0.9))j.push([j[d].pop()])},this);var k=this._1q(Bluff.sum(j[0]));var m=this.hide_title?this.top_margin+this.title_margin:this.top_margin+this.title_margin+this._1n;this._x(function(){this._0.stroke_width=1;this._0.line(0,m,this._b,m)});Bluff.each(this._I,function(c,d){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.pointsize=this._d(this.legend_font_size);this._0.stroke='transparent';this._0.font_weight='normal';this._0.gravity='west';this._0.annotate_scaled(this._b,1.0,k+(i*1.7),m,c,this._a);this._0.stroke='transparent';this._0.fill=this._1[d][this.klass.DATA_COLOR_INDEX];this._0.rectangle(k,m-i/2.0,k+i,m+i/2.0);this._0.pointsize=this.legend_font_size;var f=this._0.get_type_metrics(c);var g=f.width+(i*2.7),h;j[0].shift();if(j[0].length==0){this._x(function(){this._0.line(0.0,m,this._b,m)});j.shift();if(j.length>0)k=this._1q(Bluff.sum(j[0]));h=Math.max(this._1o,i)+this.legend_margin;if(j.length>0){m+=h;this._7+=h;this._3=this._g-this._7}}else{k+=g}},this);this._w=0},_1O:function(){if(this.hide_title||!this.title)return;this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.pointsize=this._d(this.title_font_size);this._0.font_weight='bold';this._0.gravity='north';this._0.annotate_scaled(this._b,1.0,0,this.top_margin,this.title,this._a)},_e:function(c,d){if(this.hide_line_markers)return;var f;if(this.labels[d]&&!this._u[d]){f=this._g+this.klass.LABEL_MARGIN;this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.stroke='transparent';this._0.font_weight='normal';this._0.pointsize=this._d(this.marker_font_size);this._0.gravity='north';this._0.annotate_scaled(1.0,1.0,c,f,this.labels[d],this._a);this._u[d]=true;this._x(function(){this._0.stroke_width=1;this._0.line(0.0,f,this._b,f)})}},_y:function(d,f,g,h,i,j,k,m){if(!this.tooltips)return;var n=this._0.tooltip(d,f,g,h,i,j,k);Bluff.Event.observe(n,'click',function(){var c={series:i,label:this.labels[m],value:k,color:j};this.trigger('click:datapoint',c)},this)},_1J:function(){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.stroke='transparent';this._0.font_weight='normal';this._0.pointsize=this._d(80);this._0.gravity='center';this._0.annotate_scaled(this._b,this._L/2,0,10,this.no_data_message,this._a)},_M:function(){var c=this._k.background_colors;switch(true){case c instanceof Array:this._1Q.apply(this,c);break;case typeof c==='string':this._1R(c);break;default:this._1S(this._k.background_image);break}},_1R:function(c){this._0.render_solid_background(this._j,this._t,c)},_1Q:function(c,d){this._0.render_gradiated_background(this._j,this._t,c,d)},_1S:function(c){},_1j:function(){this._w=0;this._u={};this._k={};this._0.scale(this._a,this._a)},_2k:function(c){return this._a*c},_d:function(c){var d=c*this._a;return d},_R:function(c,d){return(c>d)?d:c},_1k:function(c,d){return c>this.maximum_value},_1G:function(c,d){return c<this.minimum_value},_1r:function(c,d){return c},_2l:function(c,d){return c},_19:function(c){if(c==0)return 1.0;var d=1.0;while(c<10){c*=10;d/=10}while(c>100){c/=10;d*=10}return Math.floor(c)*d},_1L:function(){var f=this._1T,g=this.klass.DATA_VALUES_INDEX;this._9.sort(function(c,d){return f(d[g])-f(c[g])});this._1.sort(function(c,d){return f(d[g])-f(c[g])})},_1T:function(d){var f=0;Bluff.each(d,function(c){f+=(c||0)});return f},_1H:function(){var g=[],h=this._5;while(h--)g[h]=0;Bluff.each(this._1,function(f){Bluff.each(f[this.klass.DATA_VALUES_INDEX],function(c,d){g[d]+=c},this);f[this.klass.DATA_VALUES_INDEX]=Bluff.array(g)},this)},_x:function(c){if(this.klass.DEBUG){this._0.fill='transparent';this._0.stroke='turquoise';c.call(this)}},_1F:function(){var c=this._w;this._w=(this._w+1)%this.colors.length;return this.colors[c]},_Q:function(c){var d=this.klass.THOUSAND_SEPARATOR,f=(this._i%this.marker_count==0||this.y_axis_increment!==null)?String(Math.round(c)):String(Math.floor(c*this._1m)/this._1m);var g=f.split('.');g[0]=g[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,'$1'+d);return g.join('.')},_P:function(c){return this._0.caps_height(c)},_H:function(c,d){return this._0.text_width(c,d)}});Bluff.Area=new JS.Class(Bluff.Base,{draw:function(){this.callSuper();if(!this._c)return;this._S=this._6/(this._5-1);this._0.stroke='transparent';Bluff.each(this._9,function(h){var i=[],j=0.0,k=0.0;Bluff.each(h[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(this._S*d);var g=this._7+(this._3-c*this._3);if(j>0&&k>0){i.push(f);i.push(g)}else{i.push(this._2);i.push(this._g-1);i.push(f);i.push(g)}this._e(f,d);j=f;k=g},this);i.push(this._l);i.push(this._g-1);i.push(this._2);i.push(this._g-1);this._0.fill=h[this.klass.DATA_COLOR_INDEX];this._0.polyline(i)},this)}});Bluff.BarConversion=new JS.Class({mode:null,zero:null,graph_top:null,graph_height:null,minimum_value:null,spread:null,getLeftYRightYscaled:function(c,d){var f;switch(this.mode){case 1:d[0]=this.graph_top+this.graph_height*(1-c)+1;d[1]=this.graph_top+this.graph_height-1;break;case 2:d[0]=this.graph_top+1;d[1]=this.graph_top+this.graph_height*(1-c)-1;break;case 3:f=c-this.minimum_value/this.spread;if(c>=this.zero){d[0]=this.graph_top+this.graph_height*(1-(f-this.zero))+1;d[1]=this.graph_top+this.graph_height*(1-this.zero)-1}else{d[0]=this.graph_top+this.graph_height*(1-(f-this.zero))+1;d[1]=this.graph_top+this.graph_height*(1-this.zero)-1}break;default:d[0]=0.0;d[1]=0.0}}});Bluff.Bar=new JS.Class(Bluff.Base,{bar_spacing:0.9,draw:function(){this.center_labels_over_point=(Bluff.keys(this.labels).length>this._5);this.callSuper();if(!this._c)return;this._T()},_T:function(){this._8=this._6/(this._5*this._1.length);var n=(this._8*(1-this.bar_spacing))/2;this._0.stroke_opacity=0.0;var l=new Bluff.BarConversion();l.graph_height=this._3;l.graph_top=this._7;if(this.minimum_value>=0){l.mode=1}else{if(this.maximum_value<=0){l.mode=2}else{l.mode=3;l.spread=this._i;l.minimum_value=this.minimum_value;l.zero=-this.minimum_value/this._i}}Bluff.each(this._9,function(j,k){var m=this._1[k][this.klass.DATA_VALUES_INDEX];Bluff.each(j[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(this._8*(k+d+((this._1.length-1)*d)))+n;var g=f+this._8*this.bar_spacing;var h=[];l.getLeftYRightYscaled(c,h);this._0.fill=j[this.klass.DATA_COLOR_INDEX];this._0.rectangle(f,h[0],g,h[1]);this._y(f,h[0],g-f,h[1]-h[0],j[this.klass.DATA_LABEL_INDEX],j[this.klass.DATA_COLOR_INDEX],m[d],d);var i=this._2+(this._1.length*this._8*d)+(this._1.length*this._8/2.0);this._e(i-(this.center_labels_over_point?this._8/2.0:0.0),d)},this)},this);if(this.center_labels_over_point)this._e(this._l,this._5)}});Bluff.Line=new JS.Class(Bluff.Base,{baseline_value:null,baseline_color:null,line_width:null,dot_radius:null,hide_dots:null,hide_lines:null,initialize:function(c){if(arguments.length>3)throw'Wrong number of arguments';if(arguments.length===1||(typeof arguments[1]!=='number'&&typeof arguments[1]!=='string'))this.callSuper(c,null);else this.callSuper();this.hide_dots=this.hide_lines=false;this.baseline_color='red';this.baseline_value=null},draw:function(){this.callSuper();if(!this._c)return;this.x_increment=(this._5>1)?(this._6/(this._5-1)):this._6;var l;if(this._U!==undefined){l=this._7+(this._3-this._U*this._3);this._0.push();this._0.stroke=this.baseline_color;this._0.fill_opacity=0.0;this._0.stroke_width=3.0;this._0.line(this._2,l,this._2+this._6,l);this._0.pop()}Bluff.each(this._9,function(i,j){var k=null,m=null;var n=this._1[j][this.klass.DATA_VALUES_INDEX];this._1U=this._1V(i);Bluff.each(i[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(this.x_increment*d);if(typeof c!=='number')return;this._e(f,d);var g=this._7+(this._3-c*this._3);this._0.stroke=i[this.klass.DATA_COLOR_INDEX];this._0.fill=i[this.klass.DATA_COLOR_INDEX];this._0.stroke_opacity=1.0;this._0.stroke_width=this.line_width||this._R(this._j/(this._9[0][this.klass.DATA_VALUES_INDEX].length*6),3.0);var h=this.dot_radius||this._R(this._j/(this._9[0][this.klass.DATA_VALUES_INDEX].length*2),7.0);if(!this.hide_lines&&k!==null&&m!==null){this._0.line(k,m,f,g)}else if(this._1U){this._0.circle(f,g,f-h,g)}if(!this.hide_dots)this._0.circle(f,g,f-h,g);this._y(f-h,g-h,2*h,2*h,i[this.klass.DATA_LABEL_INDEX],i[this.klass.DATA_COLOR_INDEX],n[d],d);k=f;m=g},this)},this)},_16:function(){this.maximum_value=Math.max(this.maximum_value,this.baseline_value);this.callSuper();if(this.baseline_value!==null)this._U=this.baseline_value/this.maximum_value},_1V:function(d){var f=0;Bluff.each(d[this.klass.DATA_VALUES_INDEX],function(c){if(c!==undefined)f+=1});return f===1}});Bluff.Dot=new JS.Class(Bluff.Base,{draw:function(){this.has_left_labels=true;this.callSuper();if(!this._c)return;var k=1.0;this._J=this._3/this._5;this._1a=this._J*k/this._9.length;this._0.stroke_opacity=0.0;var m=Bluff.array_new(this._5,0),n=Bluff.array_new(this._5,this._2),l=(this._J*(1-k))/2;Bluff.each(this._9,function(i,j){Bluff.each(i[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(c*this._6)-Math.round(this._1a/6.0);var g=this._7+(this._J*d)+l+Math.round(this._1a/2.0);if(j===0){this._0.stroke=this.marker_color;this._0.stroke_width=1.0;this._0.opacity=0.1;this._0.line(this._2,g,this._2+this._6,g)}this._0.fill=i[this.klass.DATA_COLOR_INDEX];this._0.stroke='transparent';this._0.circle(f,g,f+Math.round(this._1a/3.0),g);var h=this._7+(this._J*d+this._J/2)+l;this._e(h,d)},this)},this)},_N:function(){if(this.hide_line_markers)return;this._0.stroke_antialias=false;this._0.stroke_width=1;var c=5;var d=this._19(this.maximum_value/c);for(var f=0;f<=c;f++){var g=(this._l-this._2)/c,h=this._l-(g*f)-1,i=f-c,j=Math.abs(i)*d;this._0.stroke=this.marker_color;this._0.line(h,this._g,h,this._g+0.5*this.klass.LABEL_MARGIN);if(!this.hide_line_numbers){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.stroke='transparent';this._0.pointsize=this._d(this.marker_font_size);this._0.gravity='center';this._0.annotate_scaled(0,0,h,this._g+(this.klass.LABEL_MARGIN*2.0),j,this._a)}this._0.stroke_antialias=true}},_e:function(c,d){if(this.labels[d]&&!this._u[d]){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.stroke='transparent';this._0.font_weight='normal';this._0.pointsize=this._d(this.marker_font_size);this._0.gravity='east';this._0.annotate_scaled(1,1,this._2-this.klass.LABEL_MARGIN*2.0,c,this.labels[d],this._a);this._u[d]=true}}});Bluff.Net=new JS.Class(Bluff.Base,{hide_dots:null,line_width:null,dot_radius:null,initialize:function(){this.callSuper();this.hide_dots=false;this.hide_line_numbers=true},draw:function(){this.callSuper();if(!this._c)return;this._z=this._3/2.0;this._A=this._2+(this._6/2.0);this._B=this._7+(this._3/2.0)-10;this._S=this._6/(this._5-1);var s=this.dot_radius||this._R(this._j/(this._9[0][this.klass.DATA_VALUES_INDEX].length*2.5),7.0);this._0.stroke_opacity=1.0;this._0.stroke_width=this.line_width||this._R(this._j/(this._9[0][this.klass.DATA_VALUES_INDEX].length*4),3.0);var r;if(this._U!==undefined){r=this._7+(this._3-this._U*this._3);this._0.push();this._0.stroke_color=this.baseline_color;this._0.fill_opacity=0.0;this._0.stroke_width=5;this._0.line(this._2,r,this._2+this._6,r);this._0.pop()}Bluff.each(this._9,function(o){var p=null,q=null;Bluff.each(o[this.klass.DATA_VALUES_INDEX],function(c,d){if(c===undefined)return;var f=d*Math.PI*2/this._5,g=c*this._z,h=this._A+Math.sin(f)*g,i=this._B-Math.cos(f)*g,j=(d+1<o[this.klass.DATA_VALUES_INDEX].length)?d+1:0,k=j*Math.PI*2/this._5,m=o[this.klass.DATA_VALUES_INDEX][j]*this._z,n=this._A+Math.sin(k)*m,l=this._B-Math.cos(k)*m;this._0.stroke=o[this.klass.DATA_COLOR_INDEX];this._0.fill=o[this.klass.DATA_COLOR_INDEX];this._0.line(h,i,n,l);if(!this.hide_dots)this._0.circle(h,i,h-s,i)},this)},this)},_N:function(){if(this.hide_line_markers)return;this._z=this._3/2.0;this._A=this._2+(this._6/2.0);this._B=this._7+(this._3/2.0)-10;var c,d;for(var f=0,g=this._5;f<g;f++){c=f*Math.PI*2/this._5;this._0.stroke=this.marker_color;this._0.stroke_width=1;this._0.line(this._A,this._B,this._A+Math.sin(c)*this._z,this._B-Math.cos(c)*this._z);d=this.labels[f]?this.labels[f]:'000';this._e(this._A,this._B,c*360/(2*Math.PI),this._z,d)}},_e:function(c,d,f,g,h){var i=1.1,j=c,k=d,m=f*Math.PI/180,n=j+(g*i*Math.sin(m)),l=k-(g*i*Math.cos(m));this._0.fill=this.marker_color;if(this.font)this._0.font=this.font;this._0.pointsize=this._d(20);this._0.stroke='transparent';this._0.font_weight='bold';this._0.gravity='center';this._0.annotate_scaled(0,0,n,l,h,this._a)}});Bluff.Pie=new JS.Class(Bluff.Base,{extend:{TEXT_OFFSET_PERCENTAGE:0.08},zero_degreee:null,hide_labels_less_than:null,initialize_ivars:function(){this.callSuper();this.zero_degree=0.0;this.hide_labels_less_than=0.0},draw:function(){this.hide_line_markers=true;this.callSuper();if(!this._c)return;var j=this._3,k=(Math.min(this._6,this._3)/2.0)*0.8,m=this._2+(this._6-j)/2.0,n=this._2+(this._6/2.0),l=this._7+(this._3/2.0)-10,o=this._1W(),p=this.zero_degree,q=this.klass.DATA_VALUES_INDEX;if(this.sort)this._1.sort(function(a,b){return a[q][0]-b[q][0]});Bluff.each(this._1,function(c,d){if(c[this.klass.DATA_VALUES_INDEX][0]>0){this._0.fill=c[this.klass.DATA_COLOR_INDEX];var f=(c[this.klass.DATA_VALUES_INDEX][0]/o)*360;this._0.circle(n,l,n+k,l,p,p+f+0.5);var g=p+((p+f)-p)/2,h=Math.round((c[this.klass.DATA_VALUES_INDEX][0]/o)*100.0),i;if(h>=this.hide_labels_less_than){i=this._Q(c[this.klass.DATA_VALUES_INDEX][0]);this._e(n,l,g,k+(k*this.klass.TEXT_OFFSET_PERCENTAGE),i,c,d)}p+=f}},this)},_e:function(c,d,f,g,h,i,j){var k=20.0,m=c,n=d,l=g+k,o=l*0.15,p=m+((l+o)*Math.cos(f*Math.PI/180)),q=n+(l*Math.sin(f*Math.PI/180));this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.pointsize=this._d(this.marker_font_size);this._0.font_weight='bold';this._0.gravity='center';this._0.annotate_scaled(0,0,p,q,h,this._a);this._y(p-20,q-20,40,40,i[this.klass.DATA_LABEL_INDEX],i[this.klass.DATA_COLOR_INDEX],h,j)},_1W:function(){var d=0;Bluff.each(this._1,function(c){d+=c[this.klass.DATA_VALUES_INDEX][0]},this);return d}});Bluff.SideBar=new JS.Class(Bluff.Base,{bar_spacing:0.9,draw:function(){this.has_left_labels=true;this.callSuper();if(!this._c)return;this._T()},_T:function(){this._V=this._3/this._5;this._8=this._V/this._9.length;this._0.stroke_opacity=0.0;var q=Bluff.array_new(this._5,0),s=Bluff.array_new(this._5,this._2),r=(this._8*(1-this.bar_spacing))/2;Bluff.each(this._9,function(l,o){var p=this._1[o][this.klass.DATA_VALUES_INDEX];Bluff.each(l[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(this._6-c*this._6-q[d]),g=this._2+this._6-q[d],h=g-f,i=s[d]-1,j=this._7+(this._V*d)+(this._8*o)+r,k=i+h,m=j+this._8*this.bar_spacing;q[d]+=(c*this._6);this._0.stroke='transparent';this._0.fill=l[this.klass.DATA_COLOR_INDEX];this._0.rectangle(i,j,k,m);this._y(i,j,k-i,m-j,l[this.klass.DATA_LABEL_INDEX],l[this.klass.DATA_COLOR_INDEX],p[d],d);var n=this._7+(this._V*d+this._V/2);this._e(n,d)},this)},this)},_N:function(){if(this.hide_line_markers)return;this._0.stroke_antialias=false;this._0.stroke_width=1;var c=5;var d=this._19(this._i/c),f,g,h,i;for(var j=0;j<=c;j++){f=(this._l-this._2)/c;g=this._l-(f*j)-1;h=j-c;i=Math.abs(h)*d+this.minimum_value;this._0.stroke=this.marker_color;this._0.line(g,this._g,g,this._7);if(!this.hide_line_numbers){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.stroke='transparent';this._0.pointsize=this._d(this.marker_font_size);this._0.gravity='center';this._0.annotate_scaled(0,0,g,this._g+(this.klass.LABEL_MARGIN*2.0),this._Q(i),this._a)}}},_e:function(c,d){if(this.labels[d]&&!this._u[d]){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.stroke='transparent';this._0.font_weight='normal';this._0.pointsize=this._d(this.marker_font_size);this._0.gravity='east';this._0.annotate_scaled(1,1,this._2-this.klass.LABEL_MARGIN*2.0,c,this.labels[d],this._a);this._u[d]=true}}});Bluff.Spider=new JS.Class(Bluff.Base,{hide_text:null,hide_axes:null,transparent_background:null,initialize:function(c,d,f){this.callSuper(c,f);this._1X=d;this.hide_legend=true},draw:function(){this.hide_line_markers=true;this.callSuper();if(!this._c)return;var c=this._3,d=this._3/2.0,f=this._2+(this._6-c)/2.0,g=this._2+(this._6/2.0),h=this._7+(this._3/2.0)-25;this._1Y=d/this._1X;var i=this._1Z(),j=0.0,k=(2*Math.PI)/this._1.length,m=0.0;if(!this.hide_axes)this._20(g,h,d,k);this._21(g,h,k)},_1s:function(c){return c*this._1Y},_e:function(c,d,f,g,h){var i=50,j=c,k=d+0,m=j+((g+i)*Math.cos(f)),n=k+((g+i)*Math.sin(f));this._0.fill=this.marker_color;if(this.font)this._0.font=this.font;this._0.pointsize=this._d(this.legend_font_size);this._0.stroke='transparent';this._0.font_weight='bold';this._0.gravity='center';this._0.annotate_scaled(0,0,m,n,h,this._a)},_20:function(g,h,i,j,k){if(this.hide_axes)return;var m=0.0;Bluff.each(this._1,function(c){this._0.stroke=k||c[this.klass.DATA_COLOR_INDEX];this._0.stroke_width=5.0;var d=i*Math.cos(m);var f=i*Math.sin(m);this._0.line(g,h,g+d,h+f);if(!this.hide_text)this._e(g,h,m,i,c[this.klass.DATA_LABEL_INDEX]);m+=j},this)},_21:function(d,f,g,h){var i=[],j=0.0;Bluff.each(this._1,function(c){i.push(d+this._1s(c[this.klass.DATA_VALUES_INDEX][0])*Math.cos(j));i.push(f+this._1s(c[this.klass.DATA_VALUES_INDEX][0])*Math.sin(j));j+=g},this);this._0.stroke_width=1.0;this._0.stroke=h||this.marker_color;this._0.fill=h||this.marker_color;this._0.fill_opacity=0.4;this._0.polyline(i)},_1Z:function(){var d=0.0;Bluff.each(this._1,function(c){d+=c[this.klass.DATA_VALUES_INDEX][0]},this);return d}});Bluff.Base.StackedMixin=new JS.Module({_1b:function(){var g={};Bluff.each(this._1,function(f){Bluff.each(f[this.klass.DATA_VALUES_INDEX],function(c,d){if(!g[d])g[d]=0.0;g[d]+=c},this)},this);for(var h in g){if(g[h]>this.maximum_value)this.maximum_value=g[h]}this.minimum_value=0}});Bluff.StackedArea=new JS.Class(Bluff.Base,{include:Bluff.Base.StackedMixin,last_series_goes_on_bottom:null,draw:function(){this._1b();this.callSuper();if(!this._c)return;this._S=this._6/(this._5-1);this._0.stroke='transparent';var n=Bluff.array_new(this._5,0);var l=null;var o=this.last_series_goes_on_bottom?'reverse_each':'each';Bluff[o](this._9,function(h){var i=l;l=[];Bluff.each(h[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(this._S*d);var g=this._7+(this._3-c*this._3-n[d]);n[d]+=(c*this._3);l.push(f);l.push(g);this._e(f,d)},this);var j,k,m;if(i){j=Bluff.array(l);for(k=i.length/2-1;k>=0;k--){j.push(i[2*k]);j.push(i[2*k+1])}j.push(l[0]);j.push(l[1])}else{j=Bluff.array(l);j.push(this._l);j.push(this._g-1);j.push(this._2);j.push(this._g-1);j.push(l[0]);j.push(l[1])}this._0.fill=h[this.klass.DATA_COLOR_INDEX];this._0.polyline(j)},this)}});Bluff.StackedBar=new JS.Class(Bluff.Base,{include:Bluff.Base.StackedMixin,bar_spacing:0.9,draw:function(){this._1b();this.callSuper();if(!this._c)return;this._8=this._6/this._5;var l=(this._8*(1-this.bar_spacing))/2;this._0.stroke_opacity=0.0;var o=Bluff.array_new(this._5,0);Bluff.each(this._9,function(k,m){var n=this._1[m][this.klass.DATA_VALUES_INDEX];Bluff.each(k[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(this._8*d)+(this._8*this.bar_spacing/2.0);this._e(f,d);if(c==0)return;var g=this._2+(this._8*d)+l;var h=this._7+(this._3-c*this._3-o[d])+1;var i=g+this._8*this.bar_spacing;var j=this._7+this._3-o[d]-1;o[d]+=(c*this._3);this._0.fill=k[this.klass.DATA_COLOR_INDEX];this._0.rectangle(g,h,i,j);this._y(g,h,i-g,j-h,k[this.klass.DATA_LABEL_INDEX],k[this.klass.DATA_COLOR_INDEX],n[d],d)},this)},this)}});Bluff.AccumulatorBar=new JS.Class(Bluff.StackedBar,{draw:function(){if(this._1.length!==1)throw'Incorrect number of datasets';var g=[],h=0,i=[];Bluff.each(this._1[0][this.klass.DATA_VALUES_INDEX],function(d){var f=-Infinity;Bluff.each(i,function(c){f=Math.max(f,c)});i.push((h>0)?(d+f):d);g.push(i[h]-d);h+=1},this);this.data("Accumulator",g);this.callSuper()}});Bluff.SideStackedBar=new JS.Class(Bluff.SideBar,{include:Bluff.Base.StackedMixin,bar_spacing:0.9,draw:function(){this.has_left_labels=true;this._1b();this.callSuper()},_T:function(){this._8=this._3/this._5;var q=Bluff.array_new(this._5,0),s=Bluff.array_new(this._5,this._2),r=(this._8*(1-this.bar_spacing))/2;Bluff.each(this._9,function(l,o){var p=this._1[o][this.klass.DATA_VALUES_INDEX];Bluff.each(l[this.klass.DATA_VALUES_INDEX],function(c,d){var f=this._2+(this._6-c*this._6-q[d])+1;var g=this._2+this._6-q[d]-1;var h=g-f;this._0.fill=l[this.klass.DATA_COLOR_INDEX];var i=s[d],j=this._7+(this._8*d)+r,k=i+h,m=j+this._8*this.bar_spacing;s[d]+=h;q[d]+=(c*this._6-2);this._0.rectangle(i,j,k,m);this._y(i,j,k-i,m-j,l[this.klass.DATA_LABEL_INDEX],l[this.klass.DATA_COLOR_INDEX],p[d],d);var n=this._7+(this._8*d)+(this._8*this.bar_spacing/2.0);this._e(n,d)},this)},this)},_1k:function(c,d){d=d||0;return this._1r(c,d)>this.maximum_value},_1r:function(d,f){var g=0;Bluff.each(this._1,function(c){g+=c[this.klass.DATA_VALUES_INDEX][f]},this);return g}});Bluff.Mini.Legend=new JS.Module({hide_mini_legend:false,_1c:function(){if(this.hide_mini_legend)return;this._I=Bluff.map(this._1,function(c){return c[this.klass.DATA_LABEL_INDEX]},this);var d=this._d(this._1.length*this._1t()+this.top_margin+this.bottom_margin);this._22=this._L;this._23=this._b;switch(this.legend_position){case'right':this._t=Math.max(this._t,d);this._j+=this._24()+this.left_margin;break;default:this._t+=d;break}this._M()},_1t:function(){return this._P(this.legend_font_size)*1.7},_24:function(){var d=0;Bluff.each(this._I,function(c){d=Math.max(this._H(this.legend_font_size,c),d)},this);return this._d(d+40*1.7)},_1d:function(){if(this.hide_mini_legend)return;var f=40.0,g=10.0,h=100.0,i=40.0;if(this.font)this._0.font=this.font;this._0.pointsize=this.legend_font_size;var j,k;switch(this.legend_position){case'right':j=this._23+this.left_margin;k=this.top_margin+i;break;default:j=h,k=this._22+i;break}this._x(function(){this._0.line(0.0,k,this._b,k)});Bluff.each(this._I,function(c,d){this._0.fill=this.font_color;if(this.font)this._0.font=this.font;this._0.pointsize=this._d(this.legend_font_size);this._0.stroke='transparent';this._0.font_weight='normal';this._0.gravity='west';this._0.annotate_scaled(this._b,1.0,j+(f*1.7),k,this._25(c),this._a);this._0.stroke='transparent';this._0.fill=this._1[d][this.klass.DATA_COLOR_INDEX];this._0.rectangle(j,k-f/2.0,j+f,k+f/2.0);k+=this._1t()},this);this._w=0},_25:function(c){var d=String(c);while(this._H(this._d(this.legend_font_size),d)>(this._j-this.legend_left_margin-this.right_margin)&&(d.length>1))d=d.substr(0,d.length-1);return d+(d.length<String(c).length?"...":'')}});Bluff.Mini.Bar=new JS.Class(Bluff.Bar,{include:Bluff.Mini.Legend,initialize_ivars:function(){this.callSuper();this.hide_legend=true;this.hide_title=true;this.hide_line_numbers=true;this.marker_font_size=50.0;this.minimum_value=0.0;this.maximum_value=0.0;this.legend_font_size=60.0},draw:function(){this._1c();this.callSuper();this._1d()}});Bluff.Mini.Pie=new JS.Class(Bluff.Pie,{include:Bluff.Mini.Legend,initialize_ivars:function(){this.callSuper();this.hide_legend=true;this.hide_title=true;this.hide_line_numbers=true;this.marker_font_size=60.0;this.legend_font_size=60.0},draw:function(){this._1c();this.callSuper();this._1d()}});Bluff.Mini.SideBar=new JS.Class(Bluff.SideBar,{include:Bluff.Mini.Legend,initialize_ivars:function(){this.callSuper();this.hide_legend=true;this.hide_title=true;this.hide_line_numbers=true;this.marker_font_size=50.0;this.legend_font_size=50.0},draw:function(){this._1c();this.callSuper();this._1d()}});Bluff.Renderer=new JS.Class({extend:{WRAPPER_CLASS:'bluff-wrapper',TEXT_CLASS:'bluff-text',TARGET_CLASS:'bluff-tooltip-target'},font:'Arial, Helvetica, Verdana, sans-serif',gravity:'north',initialize:function(c){this._n=document.getElementById(c);this._4=this._n.getContext('2d')},scale:function(c,d){this._f=c;this._h=d||c},caps_height:function(c){var d=this._W(c,'X'),f=this._K(d).height;this._X(d);return f},text_width:function(c,d){var f=this._W(c,d);var g=this._K(f).width;this._X(f);return g},get_type_metrics:function(c){var d=this._W(this.pointsize,c);document.body.appendChild(d);var f=this._K(d);this._X(d);return f},clear:function(c,d){this._n.width=c;this._n.height=d;this._4.clearRect(0,0,c,d);var f=this._1u(),g=f.childNodes,h=g.length;f.style.width=c+'px';f.style.height=d+'px';while(h--){if(g[h].tagName.toLowerCase()!=='canvas'){Bluff.Event.stopObserving(g[h]);this._X(g[h])}}},push:function(){this._4.save()},pop:function(){this._4.restore()},render_gradiated_background:function(c,d,f,g){this.clear(c,d);var h=this._4.createLinearGradient(0,0,0,d);h.addColorStop(0,f);h.addColorStop(1,g);this._4.fillStyle=h;this._4.fillRect(0,0,c,d)},render_solid_background:function(c,d,f){this.clear(c,d);this._4.fillStyle=f;this._4.fillRect(0,0,c,d)},annotate_scaled:function(c,d,f,g,h,i){var j=(c*i)>=1?(c*i):1;var k=(d*i)>=1?(d*i):1;var h=this._W(this.pointsize,h);h.style.color=this.fill;h.style.cursor='default';h.style.fontWeight=this.font_weight;h.style.textAlign='center';h.style.left=(this._f*f+this._26(h,j))+'px';h.style.top=(this._h*g+this._27(h,k))+'px'},tooltip:function(d,f,g,h,i,j,k){if(g<0)d+=g;if(h<0)f+=h;var m=this._n.parentNode,n=document.createElement('div');n.className=this.klass.TARGET_CLASS;n.style.cursor='default';n.style.position='absolute';n.style.left=(this._f*d-3)+'px';n.style.top=(this._h*f-3)+'px';n.style.width=(this._f*Math.abs(g)+5)+'px';n.style.height=(this._h*Math.abs(h)+5)+'px';n.style.fontSize=0;n.style.overflow='hidden';Bluff.Event.observe(n,'mouseover',function(c){Bluff.Tooltip.show(i,j,k)});Bluff.Event.observe(n,'mouseout',function(c){Bluff.Tooltip.hide()});m.appendChild(n);return n},circle:function(c,d,f,g,h,i){var j=Math.sqrt(Math.pow(f-c,2)+Math.pow(g-d,2));var k=0,m=2*Math.PI;this._4.fillStyle=this.fill;this._4.beginPath();if(h!==undefined&&i!==undefined&&Math.abs(Math.floor(i-h))!==360){k=h*Math.PI/180;m=i*Math.PI/180;this._4.moveTo(this._f*(c+j*Math.cos(m)),this._h*(d+j*Math.sin(m)));this._4.lineTo(this._f*c,this._h*d);this._4.lineTo(this._f*(c+j*Math.cos(k)),this._h*(d+j*Math.sin(k)))}this._4.arc(this._f*c,this._h*d,this._f*j,k,m,false);this._4.fill()},line:function(c,d,f,g){this._4.strokeStyle=this.stroke;this._4.lineWidth=this.stroke_width;this._4.beginPath();this._4.moveTo(this._f*c,this._h*d);this._4.lineTo(this._f*f,this._h*g);this._4.stroke()},polyline:function(c){this._4.fillStyle=this.fill;this._4.globalAlpha=this.fill_opacity||1;try{this._4.strokeStyle=this.stroke}catch(e){}var d=c.shift(),f=c.shift();this._4.beginPath();this._4.moveTo(this._f*d,this._h*f);while(c.length>0){d=c.shift();f=c.shift();this._4.lineTo(this._f*d,this._h*f)}this._4.fill()},rectangle:function(c,d,f,g){var h;if(c>f){h=c;c=f;f=h}if(d>g){h=d;d=g;g=h}try{this._4.fillStyle=this.fill;this._4.fillRect(this._f*c,this._h*d,this._f*(f-c),this._h*(g-d))}catch(e){}try{this._4.strokeStyle=this.stroke;if(this.stroke!=='transparent')this._4.strokeRect(this._f*c,this._h*d,this._f*(f-c),this._h*(g-d))}catch(e){}},_26:function(c,d){var f=this._K(c).width;switch(this.gravity){case'west':return 0;case'east':return d-f;case'north':case'south':case'center':return(d-f)/2}},_27:function(c,d){var f=this._K(c).height;switch(this.gravity){case'north':return 0;case'south':return d-f;case'west':case'east':case'center':return(d-f)/2}},_1u:function(){var c=this._n.parentNode;if(c.className===this.klass.WRAPPER_CLASS)return c;c=document.createElement('div');c.className=this.klass.WRAPPER_CLASS;c.style.position='relative';c.style.border='none';c.style.padding='0 0 0 0';this._n.parentNode.insertBefore(c,this._n);c.appendChild(this._n);return c},_W:function(c,d){var f=this._28(d);f.style.fontFamily=this.font;f.style.fontSize=(typeof c==='number')?c+'px':c;return f},_28:function(c){var d=document.createElement('div');d.className=this.klass.TEXT_CLASS;d.style.position='absolute';d.appendChild(document.createTextNode(c));this._1u().appendChild(d);return d},_X:function(c){c.parentNode.removeChild(c);if(c.className===this.klass.TARGET_CLASS)Bluff.Event.stopObserving(c)},_K:function(c){var d=c.style.display;return(d&&d!=='none')?{width:c.offsetWidth,height:c.offsetHeight}:{width:c.clientWidth,height:c.clientHeight}}});Bluff.Event={_Y:[],_1v:(window.attachEvent&&navigator.userAgent.indexOf('Opera')===-1),observe:function(d,f,g,h){var i=Bluff.map(this._1w(d,f),function(c){return c._29});if(Bluff.index(i,g)!==-1)return;var j=function(c){g.call(h||null,d,Bluff.Event._2a(c))};this._Y.push({_Z:d,_1e:f,_29:g,_1x:j});if(d.addEventListener)d.addEventListener(f,j,false);else d.attachEvent('on'+f,j)},stopObserving:function(d){var f=d?this._1w(d):this._Y;Bluff.each(f,function(c){if(c._Z.removeEventListener)c._Z.removeEventListener(c._1e,c._1x,false);else c._Z.detachEvent('on'+c._1e,c._1x)})},_1w:function(d,f){var g=[];Bluff.each(this._Y,function(c){if(d&&c._Z!==d)return;if(f&&c._1e!==f)return;g.push(c)});return g},_2a:function(c){if(!this._1v)return c;if(!c)return false;if(c._2b)return c;c._2b=true;var d=this._2c(c);c.target=c.srcElement;c.pageX=d.x;c.pageY=d.y;return c},_2c:function(c){var d=document.documentElement,f=document.body||{scrollLeft:0,scrollTop:0};return{x:c.pageX||(c.clientX+(d.scrollLeft||f.scrollLeft)-(d.clientLeft||0)),y:c.pageY||(c.clientY+(d.scrollTop||f.scrollTop)-(d.clientTop||0))}}};if(Bluff.Event._1v)window.attachEvent('onunload',function(){Bluff.Event.stopObserving();Bluff.Event._Y=null});if(navigator.userAgent.indexOf('AppleWebKit/')>-1)window.addEventListener('unload',function(){},false);Bluff.Tooltip=new JS.Singleton({LEFT_OFFSET:20,TOP_OFFSET:-6,DATA_LENGTH:8,CLASS_NAME:'bluff-tooltip',setup:function(){this._o=document.createElement('div');this._o.className=this.CLASS_NAME;this._o.style.position='absolute';this.hide();document.body.appendChild(this._o);Bluff.Event.observe(document.body,'mousemove',function(c,d){this._o.style.left=(d.pageX+this.LEFT_OFFSET)+'px';this._o.style.top=(d.pageY+this.TOP_OFFSET)+'px'},this)},show:function(c,d,f){f=Number(String(f).substr(0,this.DATA_LENGTH));this._o.innerHTML='<span class="color" style="background: '+d+';">&nbsp;</span> <span class="label">'+c+'</span> <span class="data">'+f+'</span>';this._o.style.display=''},hide:function(){this._o.style.display='none'}});Bluff.Event.observe(window,'load',Bluff.Tooltip.method('setup'));Bluff.TableReader=new JS.Class({NUMBER_FORMAT:/\-?(0|[1-9]\d*)(\.\d+)?(e[\+\-]?\d+)?/i,initialize:function(c,d){this._1f=d||{};this._2d=this._1f.orientation||'auto';this._2e=(typeof c==='string')?document.getElementById(c):c},get_data:function(){if(!this._1)this._1y();return this._1},get_labels:function(){if(!this._1g)this._1y();return this._1g},get_title:function(){return this._2f},get_series:function(c){if(this._1[c])return this._1[c];return this._1[c]={points:[]}},_1y:function(){this._C=this._m=0;this._p=this._q=0;this._1=[];this._1g={};this._r=[];this._s=[];this._1h=[];this._1i=[];this._1z(this._2e);this._2g();this._2h();Bluff.each(this._s,function(c,d){this.get_series(d-this._q).name=c},this);Bluff.each(this._r,function(c,d){this._1g[d-this._p]=c},this)},_1z:function(c){this._2i(c);var d,f=c.childNodes,g=f.length;for(d=0;d<g;d++)this._1z(f[d])},_2i:function(c){if(!c.tagName)return;var d=this._1A(c.innerHTML),f,g;switch(c.tagName.toUpperCase()){case'TR':if(!this._c)this._p=this._C;this._C+=1;this._m=0;break;case'TD':if(!this._c)this._q=this._m;this._c=true;this._m+=1;d=d.match(this.NUMBER_FORMAT);if(d===null){this.get_series(f).points[g]=null}else{f=this._m-this._q-1;g=this._C-this._p-1;this.get_series(f).points[g]=parseFloat(d[0])}break;case'TH':this._m+=1;if(this._2j(c)){this._1i.push(this._m);this._1h.push(this._C)}if(this._m===1&&this._C===1)this._r[0]=this._s[0]=d;else if(c.scope==="row"||this._m===1)this._r[this._C-1]=d;else this._s[this._m-1]=d;break;case'CAPTION':this._2f=d;break}},_2j:function(c){if(!this._1f.except)return false;var d=this._1A(c.innerHTML),f=(c.className||'').split(/\s+/),g=[].concat(this._1f.except);if(Bluff.index(g,d)>=0)return true;var h=f.length;while(h--){if(Bluff.index(g,f[h])>=0)return true}return false},_2g:function(){var d=this._1i.length,f;while(d--){f=this._1i[d];if(f<=this._q)continue;this._s.splice(f-1,1);if(f>=this._q)this._1.splice(f-1-this._q,1)}var d=this._1h.length,f;while(d--){f=this._1h[d];if(f<=this._p)continue;this._r.splice(f-1,1);Bluff.each(this._1,function(c){if(f>=this._p)c.points.splice(f-1-this._p,1)},this)}},_2h:function(){switch(this._2d){case'auto':if((this._r.length>1&&this._s.length===1)||this._r.length<this._s.length){this._1B()}break;case'rows':this._1B();break}},_1B:function(){var h=this._1,i;this._1=[];Bluff.each(h,function(f,g){Bluff.each(f.points,function(c,d){this.get_series(d).points[g]=c},this)},this);i=this._r;this._r=this._s;this._s=i;i=this._p;this._p=this._q;this._q=i},_1A:function(c){return c.replace(/<\/?[^>]+>/gi,'')},extend:{Mixin:new JS.Module({data_from_table:function(d,f){var g=new Bluff.TableReader(d,f),h=g.get_data();Bluff.each(h,function(c){this.data(c.name,c.points)},this);this.labels=g.get_labels();this.title=g.get_title()||this.title}})}});Bluff.Base.include(Bluff.TableReader.Mixin);
@@ -0,0 +1,35 @@
1
+ // Copyright 2006 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ document.createElement("canvas").getContext||(function(){var s=Math,j=s.round,F=s.sin,G=s.cos,V=s.abs,W=s.sqrt,k=10,v=k/2;function X(){return this.context_||(this.context_=new H(this))}var L=Array.prototype.slice;function Y(b,a){var c=L.call(arguments,2);return function(){return b.apply(a,c.concat(L.call(arguments)))}}var M={init:function(b){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var a=b||document;a.createElement("canvas");a.attachEvent("onreadystatechange",Y(this.init_,this,a))}},init_:function(b){b.namespaces.g_vml_||
15
+ b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!b.styleSheets.ex_canvas_){var a=b.createStyleSheet();a.owningElement.id="ex_canvas_";a.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var c=b.getElementsByTagName("canvas"),d=0;for(;d<c.length;d++)this.initElement(c[d])},
16
+ initElement:function(b){if(!b.getContext){b.getContext=X;b.innerHTML="";b.attachEvent("onpropertychange",Z);b.attachEvent("onresize",$);var a=b.attributes;if(a.width&&a.width.specified)b.style.width=a.width.nodeValue+"px";else b.width=b.clientWidth;if(a.height&&a.height.specified)b.style.height=a.height.nodeValue+"px";else b.height=b.clientHeight}return b}};function Z(b){var a=b.srcElement;switch(b.propertyName){case "width":a.style.width=a.attributes.width.nodeValue+"px";a.getContext().clearRect();
17
+ break;case "height":a.style.height=a.attributes.height.nodeValue+"px";a.getContext().clearRect();break}}function $(b){var a=b.srcElement;if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}M.init();var N=[],B=0;for(;B<16;B++){var C=0;for(;C<16;C++)N[B*16+C]=B.toString(16)+C.toString(16)}function I(){return[[1,0,0],[0,1,0],[0,0,1]]}function y(b,a){var c=I(),d=0;for(;d<3;d++){var f=0;for(;f<3;f++){var h=0,g=0;for(;g<3;g++)h+=b[d][g]*a[g][f];c[d][f]=
18
+ h}}return c}function O(b,a){a.fillStyle=b.fillStyle;a.lineCap=b.lineCap;a.lineJoin=b.lineJoin;a.lineWidth=b.lineWidth;a.miterLimit=b.miterLimit;a.shadowBlur=b.shadowBlur;a.shadowColor=b.shadowColor;a.shadowOffsetX=b.shadowOffsetX;a.shadowOffsetY=b.shadowOffsetY;a.strokeStyle=b.strokeStyle;a.globalAlpha=b.globalAlpha;a.arcScaleX_=b.arcScaleX_;a.arcScaleY_=b.arcScaleY_;a.lineScale_=b.lineScale_}function P(b){var a,c=1;b=String(b);if(b.substring(0,3)=="rgb"){var d=b.indexOf("(",3),f=b.indexOf(")",d+
19
+ 1),h=b.substring(d+1,f).split(",");a="#";var g=0;for(;g<3;g++)a+=N[Number(h[g])];if(h.length==4&&b.substr(3,1)=="a")c=h[3]}else a=b;return{color:a,alpha:c}}function aa(b){switch(b){case "butt":return"flat";case "round":return"round";case "square":default:return"square"}}function H(b){this.m_=I();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=k*1;this.globalAlpha=1;this.canvas=b;
20
+ var a=b.ownerDocument.createElement("div");a.style.width=b.clientWidth+"px";a.style.height=b.clientHeight+"px";a.style.overflow="hidden";a.style.position="absolute";b.appendChild(a);this.element_=a;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}var i=H.prototype;i.clearRect=function(){this.element_.innerHTML=""};i.beginPath=function(){this.currentPath_=[]};i.moveTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};
21
+ i.lineTo=function(b,a){var c=this.getCoords_(b,a);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};i.bezierCurveTo=function(b,a,c,d,f,h){var g=this.getCoords_(f,h),l=this.getCoords_(b,a),e=this.getCoords_(c,d);Q(this,l,e,g)};function Q(b,a,c,d){b.currentPath_.push({type:"bezierCurveTo",cp1x:a.x,cp1y:a.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});b.currentX_=d.x;b.currentY_=d.y}i.quadraticCurveTo=function(b,a,c,d){var f=this.getCoords_(b,a),h=this.getCoords_(c,d),g={x:this.currentX_+
22
+ 0.6666666666666666*(f.x-this.currentX_),y:this.currentY_+0.6666666666666666*(f.y-this.currentY_)};Q(this,g,{x:g.x+(h.x-this.currentX_)/3,y:g.y+(h.y-this.currentY_)/3},h)};i.arc=function(b,a,c,d,f,h){c*=k;var g=h?"at":"wa",l=b+G(d)*c-v,e=a+F(d)*c-v,m=b+G(f)*c-v,r=a+F(f)*c-v;if(l==m&&!h)l+=0.125;var n=this.getCoords_(b,a),o=this.getCoords_(l,e),q=this.getCoords_(m,r);this.currentPath_.push({type:g,x:n.x,y:n.y,radius:c,xStart:o.x,yStart:o.y,xEnd:q.x,yEnd:q.y})};i.rect=function(b,a,c,d){this.moveTo(b,
23
+ a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath()};i.strokeRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.stroke();this.currentPath_=f};i.fillRect=function(b,a,c,d){var f=this.currentPath_;this.beginPath();this.moveTo(b,a);this.lineTo(b+c,a);this.lineTo(b+c,a+d);this.lineTo(b,a+d);this.closePath();this.fill();this.currentPath_=f};i.createLinearGradient=function(b,
24
+ a,c,d){var f=new D("gradient");f.x0_=b;f.y0_=a;f.x1_=c;f.y1_=d;return f};i.createRadialGradient=function(b,a,c,d,f,h){var g=new D("gradientradial");g.x0_=b;g.y0_=a;g.r0_=c;g.x1_=d;g.y1_=f;g.r1_=h;return g};i.drawImage=function(b){var a,c,d,f,h,g,l,e,m=b.runtimeStyle.width,r=b.runtimeStyle.height;b.runtimeStyle.width="auto";b.runtimeStyle.height="auto";var n=b.width,o=b.height;b.runtimeStyle.width=m;b.runtimeStyle.height=r;if(arguments.length==3){a=arguments[1];c=arguments[2];h=g=0;l=d=n;e=f=o}else if(arguments.length==
25
+ 5){a=arguments[1];c=arguments[2];d=arguments[3];f=arguments[4];h=g=0;l=n;e=o}else if(arguments.length==9){h=arguments[1];g=arguments[2];l=arguments[3];e=arguments[4];a=arguments[5];c=arguments[6];d=arguments[7];f=arguments[8]}else throw Error("Invalid number of arguments");var q=this.getCoords_(a,c),t=[];t.push(" <g_vml_:group",' coordsize="',k*10,",",k*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var E=[];E.push("M11=",
26
+ this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",j(q.x/k),",","Dy=",j(q.y/k),"");var p=q,z=this.getCoords_(a+d,c),w=this.getCoords_(a,c+f),x=this.getCoords_(a+d,c+f);p.x=s.max(p.x,z.x,w.x,x.x);p.y=s.max(p.y,z.y,w.y,x.y);t.push("padding:0 ",j(p.x/k),"px ",j(p.y/k),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",E.join(""),", sizingmethod='clip');")}else t.push("top:",j(q.y/k),"px;left:",j(q.x/k),"px;");t.push(' ">','<g_vml_:image src="',b.src,
27
+ '"',' style="width:',k*d,"px;"," height:",k*f,'px;"',' cropleft="',h/n,'"',' croptop="',g/o,'"',' cropright="',(n-h-l)/n,'"',' cropbottom="',(o-g-e)/o,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};i.stroke=function(b){var a=[],c=P(b?this.fillStyle:this.strokeStyle),d=c.color,f=c.alpha*this.globalAlpha;a.push("<g_vml_:shape",' filled="',!!b,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0 0" coordsize="',k*10," ",k*10,'"',' stroked="',
28
+ !b,'"',' path="');var h={x:null,y:null},g={x:null,y:null},l=0;for(;l<this.currentPath_.length;l++){var e=this.currentPath_[l];switch(e.type){case "moveTo":a.push(" m ",j(e.x),",",j(e.y));break;case "lineTo":a.push(" l ",j(e.x),",",j(e.y));break;case "close":a.push(" x ");e=null;break;case "bezierCurveTo":a.push(" c ",j(e.cp1x),",",j(e.cp1y),",",j(e.cp2x),",",j(e.cp2y),",",j(e.x),",",j(e.y));break;case "at":case "wa":a.push(" ",e.type," ",j(e.x-this.arcScaleX_*e.radius),",",j(e.y-this.arcScaleY_*e.radius),
29
+ " ",j(e.x+this.arcScaleX_*e.radius),",",j(e.y+this.arcScaleY_*e.radius)," ",j(e.xStart),",",j(e.yStart)," ",j(e.xEnd),",",j(e.yEnd));break}if(e){if(h.x==null||e.x<h.x)h.x=e.x;if(g.x==null||e.x>g.x)g.x=e.x;if(h.y==null||e.y<h.y)h.y=e.y;if(g.y==null||e.y>g.y)g.y=e.y}}a.push(' ">');if(b)if(typeof this.fillStyle=="object"){var m=this.fillStyle,r=0,n={x:0,y:0},o=0,q=1;if(m.type_=="gradient"){var t=m.x1_/this.arcScaleX_,E=m.y1_/this.arcScaleY_,p=this.getCoords_(m.x0_/this.arcScaleX_,m.y0_/this.arcScaleY_),
30
+ z=this.getCoords_(t,E);r=Math.atan2(z.x-p.x,z.y-p.y)*180/Math.PI;if(r<0)r+=360;if(r<1.0E-6)r=0}else{var p=this.getCoords_(m.x0_,m.y0_),w=g.x-h.x,x=g.y-h.y;n={x:(p.x-h.x)/w,y:(p.y-h.y)/x};w/=this.arcScaleX_*k;x/=this.arcScaleY_*k;var R=s.max(w,x);o=2*m.r0_/R;q=2*m.r1_/R-o}var u=m.colors_;u.sort(function(ba,ca){return ba.offset-ca.offset});var J=u.length,da=u[0].color,ea=u[J-1].color,fa=u[0].alpha*this.globalAlpha,ga=u[J-1].alpha*this.globalAlpha,S=[],l=0;for(;l<J;l++){var T=u[l];S.push(T.offset*q+
31
+ o+" "+T.color)}a.push('<g_vml_:fill type="',m.type_,'"',' method="none" focus="100%"',' color="',da,'"',' color2="',ea,'"',' colors="',S.join(","),'"',' opacity="',ga,'"',' g_o_:opacity2="',fa,'"',' angle="',r,'"',' focusposition="',n.x,",",n.y,'" />')}else a.push('<g_vml_:fill color="',d,'" opacity="',f,'" />');else{var K=this.lineScale_*this.lineWidth;if(K<1)f*=K;a.push("<g_vml_:stroke",' opacity="',f,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',aa(this.lineCap),
32
+ '"',' weight="',K,'px"',' color="',d,'" />')}a.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",a.join(""))};i.fill=function(){this.stroke(true)};i.closePath=function(){this.currentPath_.push({type:"close"})};i.getCoords_=function(b,a){var c=this.m_;return{x:k*(b*c[0][0]+a*c[1][0]+c[2][0])-v,y:k*(b*c[0][1]+a*c[1][1]+c[2][1])-v}};i.save=function(){var b={};O(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=y(I(),this.m_)};i.restore=function(){O(this.aStack_.pop(),
33
+ this);this.m_=this.mStack_.pop()};function ha(b){var a=0;for(;a<3;a++){var c=0;for(;c<2;c++)if(!isFinite(b[a][c])||isNaN(b[a][c]))return false}return true}function A(b,a,c){if(!!ha(a)){b.m_=a;if(c)b.lineScale_=W(V(a[0][0]*a[1][1]-a[0][1]*a[1][0]))}}i.translate=function(b,a){A(this,y([[1,0,0],[0,1,0],[b,a,1]],this.m_),false)};i.rotate=function(b){var a=G(b),c=F(b);A(this,y([[a,c,0],[-c,a,0],[0,0,1]],this.m_),false)};i.scale=function(b,a){this.arcScaleX_*=b;this.arcScaleY_*=a;A(this,y([[b,0,0],[0,a,
34
+ 0],[0,0,1]],this.m_),true)};i.transform=function(b,a,c,d,f,h){A(this,y([[b,a,0],[c,d,0],[f,h,1]],this.m_),true)};i.setTransform=function(b,a,c,d,f,h){A(this,[[b,a,0],[c,d,0],[f,h,1]],true)};i.clip=function(){};i.arcTo=function(){};i.createPattern=function(){return new U};function D(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}D.prototype.addColorStop=function(b,a){a=P(a);this.colors_.push({offset:b,color:a.color,alpha:a.alpha})};function U(){}G_vmlCanvasManager=
35
+ M;CanvasRenderingContext2D=H;CanvasGradient=D;CanvasPattern=U})();
@@ -0,0 +1 @@
1
+ this.JS=this.JS||{};JS.extend=function(a,b){b=b||{};for(var c in b){if(a[c]===b[c])continue;a[c]=b[c]}return a};JS.extend(JS,{makeFunction:function(){return function(){return this.initialize?(this.initialize.apply(this,arguments)||this):this}},makeBridge:function(a){var b=function(){};b.prototype=a.prototype;return new b},bind:function(){var a=JS.array(arguments),b=a.shift(),c=a.shift()||null;return function(){return b.apply(c,a.concat(JS.array(arguments)))}},callsSuper:function(a){return a.SUPER===undefined?a.SUPER=/\bcallSuper\b/.test(a.toString()):a.SUPER},mask:function(a){var b=a.toString().replace(/callSuper/g,'super');a.toString=function(){return b};return a},array:function(a){if(!a)return[];if(a.toArray)return a.toArray();var b=a.length,c=[];while(b--)c[b]=a[b];return c},indexOf:function(a,b){for(var c=0,d=a.length;c<d;c++){if(a[c]===b)return c}return-1},isFn:function(a){return a instanceof Function},isType:function(a,b){if(!a||!b)return false;return(b instanceof Function&&a instanceof b)||(typeof b==='string'&&typeof a===b)||(a.isA&&a.isA(b))},ignore:function(a,b){return/^(include|extend)$/.test(a)&&typeof b==='object'}});JS.Module=JS.makeFunction();JS.extend(JS.Module.prototype,{END_WITHOUT_DOT:/([^\.])$/,initialize:function(a,b,c){this.__mod__=this;this.__inc__=[];this.__fns__={};this.__dep__=[];this.__mct__={};if(typeof a==='string'){this.__nom__=this.displayName=a}else{this.__nom__=this.displayName='';c=b;b=a}c=c||{};this.__res__=c._1||null;if(b)this.include(b,false);if(JS.Module.__chainq__)JS.Module.__chainq__.push(this)},setName:function(a){this.__nom__=this.displayName=a||'';for(var b in this.__mod__.__fns__)this.__name__(b);if(a&&this.__meta__)this.__meta__.setName(a+'.')},__name__:function(a){if(!this.__nom__)return;var b=this.__mod__.__fns__[a]||{};a=this.__nom__.replace(this.END_WITHOUT_DOT,'$1#')+a;if(JS.isFn(b.setName))return b.setName(a);if(JS.isFn(b))b.displayName=a},define:function(a,b,c,d){var f=(d||{})._0||this;this.__fns__[a]=b;this.__name__(a);if(JS.Module._0&&f&&JS.isFn(b))JS.Module._0(a,f);if(c!==false)this.resolve()},instanceMethod:function(a){var b=this.lookup(a).pop();return JS.isFn(b)?b:null},instanceMethods:function(a,b){var c=this.__mod__,b=b||[],d=c.ancestors(),f=d.length,e;for(e in c.__fns__){if(c.__fns__.hasOwnProperty(e)&&JS.isFn(c.__fns__[e])&&JS.indexOf(b,e)===-1)b.push(e)}if(a===false)return b;while(f--)d[f].instanceMethods(false,b);return b},include:function(a,b,c){b=(b!==false);if(!a)return b?this.resolve():this.uncache();c=c||{};if(a.__mod__)a=a.__mod__;var d=a.include,f=a.extend,e=c._4||this,g,h,i,j;if(a.__inc__&&a.__fns__){this.__inc__.push(a);a.__dep__.push(this);if(c._2)a.extended&&a.extended(c._2);else a.included&&a.included(e)}else{if(c._5){for(h in a){if(JS.ignore(h,a[h]))continue;this.define(h,a[h],false,{_0:e||c._2||this})}}else{if(typeof d==='object'||JS.isType(d,JS.Module)){g=[].concat(d);for(i=0,j=g.length;i<j;i++)e.include(g[i],b,c)}if(typeof f==='object'||JS.isType(f,JS.Module)){g=[].concat(f);for(i=0,j=g.length;i<j;i++)e.extend(g[i],false);e.extend()}c._5=true;return e.include(a,b,c)}}b?this.resolve():this.uncache()},includes:function(a){var b=this.__mod__,c=b.__inc__.length;if(Object===a||b===a||b.__res__===a.prototype)return true;while(c--){if(b.__inc__[c].includes(a))return true}return false},match:function(a){return a.isA&&a.isA(this)},ancestors:function(a){var b=this.__mod__,c=(a===undefined),d=(b.__res__||{}).klass,f=(d&&b.__res__===d.prototype)?d:b,e,g;if(c&&b.__anc__)return b.__anc__.slice();a=a||[];for(e=0,g=b.__inc__.length;e<g;e++)b.__inc__[e].ancestors(a);if(JS.indexOf(a,f)===-1)a.push(f);if(c)b.__anc__=a.slice();return a},lookup:function(a){var b=this.__mod__,c=b.__mct__;if(c[a])return c[a].slice();var d=b.ancestors(),f=[],e,g,h;for(e=0,g=d.length;e<g;e++){h=d[e].__mod__.__fns__[a];if(h)f.push(h)}c[a]=f.slice();return f},make:function(a,b){if(!JS.isFn(b)||!JS.callsSuper(b))return b;var c=this;return function(){return c.chain(this,a,arguments)}},chain:JS.mask(function(c,d,f){var e=this.lookup(d),g=e.length-1,h=c.callSuper,i=JS.array(f),j;c.callSuper=function(){var a=arguments.length;while(a--)i[a]=arguments[a];g-=1;var b=e[g].apply(c,i);g+=1;return b};j=e.pop().apply(c,i);h?c.callSuper=h:delete c.callSuper;return j}),resolve:function(a){var b=this.__mod__,a=a||b,c=a.__res__,d,f,e,g;if(a===b){b.uncache(false);d=b.__dep__.length;while(d--)b.__dep__[d].resolve()}if(!c)return;for(d=0,f=b.__inc__.length;d<f;d++)b.__inc__[d].resolve(a);for(e in b.__fns__){g=a.make(e,b.__fns__[e]);if(c[e]!==g)c[e]=g}},uncache:function(a){var b=this.__mod__,c=b.__dep__.length;b.__anc__=null;b.__mct__={};if(a===false)return;while(c--)b.__dep__[c].uncache()}});JS.Class=JS.makeFunction();JS.extend(JS.Class.prototype=JS.makeBridge(JS.Module),{initialize:function(a,b,c){if(typeof a==='string'){this.__nom__=this.displayName=a}else{this.__nom__=this.displayName='';c=b;b=a}var d=JS.extend(JS.makeFunction(),this);d.klass=d.constructor=this.klass;if(!JS.isFn(b)){c=b;b=Object}d.inherit(b);d.include(c,false);d.resolve();do{b.inherited&&b.inherited(d)}while(b=b.superclass);return d},inherit:function(a){this.superclass=a;if(this.__eigen__&&a.__eigen__)this.extend(a.__eigen__(),true);this.subclasses=[];(a.subclasses||[]).push(this);var b=this.prototype=JS.makeBridge(a);b.klass=b.constructor=this;this.__mod__=new JS.Module(this.__nom__,{},{_1:this.prototype});this.include(JS.Kernel,false);if(a!==Object)this.include(a.__mod__||new JS.Module(a.prototype,{_1:a.prototype}),false)},include:function(a,b,c){if(!a)return;var d=this.__mod__,c=c||{};c._4=this;return d.include(a,b,c)},define:function(a,b,c,d){var f=this.__mod__;d=d||{};d._0=this;f.define(a,b,c,d)}});JS.Module=new JS.Class('Module',JS.Module.prototype);JS.Class=new JS.Class('Class',JS.Module,JS.Class.prototype);JS.Module.klass=JS.Module.constructor=JS.Class.klass=JS.Class.constructor=JS.Class;JS.extend(JS.Module,{_3:[],__chainq__:[],methodAdded:function(a,b){this._3.push([a,b])},_0:function(a,b){var c=this._3,d=c.length;while(d--)c[d][0].call(c[d][1]||null,a,b)}});JS.Kernel=JS.extend(new JS.Module('Kernel',{__eigen__:function(){if(this.__meta__)return this.__meta__;var a=this.__nom__,b=this.klass.__nom__,c=a||(b?'#<'+b+'>':''),d=this.__meta__=new JS.Module(c?c+'.':'',{},{_1:this});d.include(this.klass.__mod__,false);return d},equals:function(a){return this===a},extend:function(a,b){return this.__eigen__().include(a,b,{_2:this})},hash:function(){return this.__hashcode__=this.__hashcode__||JS.Kernel.getHashCode()},isA:function(a){return this.__eigen__().includes(a)},method:function(a){var b=this,c=b.__mcache__=b.__mcache__||{};if((c[a]||{}).fn===b[a])return c[a].bd;return(c[a]={fn:b[a],bd:JS.bind(b[a],b)}).bd},methods:function(){return this.__eigen__().instanceMethods(true)},tap:function(a,b){a.call(b||null,this);return this}}),{__hashIndex__:0,getHashCode:function(){this.__hashIndex__+=1;return(Math.floor(new Date().getTime()/1000)+this.__hashIndex__).toString(16)}});JS.Module.include(JS.Kernel);JS.extend(JS.Module,JS.Kernel.__fns__);JS.Class.include(JS.Kernel);JS.extend(JS.Class,JS.Kernel.__fns__);JS.Interface=new JS.Class({initialize:function(d){this.test=function(a,b){var c=d.length;while(c--){if(!JS.isFn(a[d[c]]))return b?d[c]:false}return true}},extend:{ensure:function(){var a=JS.array(arguments),b=a.shift(),c,d;while(c=a.shift()){d=c.test(b,true);if(d!==true)throw new Error('object does not implement '+d+'()');}}}});JS.Singleton=new JS.Class({initialize:function(a,b,c){return new(new JS.Class(a,b,c))}});
@@ -8,6 +8,7 @@ module BeanstalkdView
8
8
  begin
9
9
  @tubes = beanstalk.list_tubes
10
10
  @stats = beanstalk.stats
11
+ @total_jobs_data = get_total_jobs_data(@tubes)
11
12
  @message = session[:message]
12
13
  session[:message] = nil
13
14
  erb :index
@@ -133,6 +134,23 @@ module BeanstalkdView
133
134
  file = File.expand_path(File.join('resources', path), File.dirname(__FILE__))
134
135
  send_file file
135
136
  end
137
+
138
+ def get_total_jobs_data(tubes)
139
+ total_jobs_data = Hash.new
140
+ items = Array.new
141
+ tubes.keys.each do |key|
142
+ tubes[key].each do |tube|
143
+ stats = beanstalk.stats_tube(tube)
144
+ total_jobs = stats['total-jobs']
145
+ datum = Hash.new
146
+ datum["label"] = tube
147
+ datum["data"] = total_jobs
148
+ items << datum
149
+ end
150
+ end
151
+ total_jobs_data["items"] = items
152
+ total_jobs_data
153
+ end
136
154
 
137
155
  end
138
156
  end
@@ -1,3 +1,3 @@
1
1
  module BeanstalkdView
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -59,6 +59,34 @@
59
59
  </tbody>
60
60
  </table>
61
61
 
62
+ <table class="table">
63
+ <thead>
64
+ <tr>
65
+ <th colspan="2">Meta Statistics</th>
66
+ </tr>
67
+ </thead>
68
+ <tbody>
69
+ <tr rel="tooltip" title="The rate of job bury calls to reserve calls.">
70
+ <td>Bury Rate</td>
71
+ <% bury_reserve_rate = (@stats["cmd-bury"].to_f / @stats["cmd-reserve"].to_f) %>
72
+ <% if bury_reserve_rate > 0.01 %>
73
+ <td class="data_cell"><span class="badge badge-error"><%= bury_reserve_rate %></span></td>
74
+ <% else %>
75
+ <td class="data_cell"><%= bury_reserve_rate %></td>
76
+ <% end %>
77
+ </tr>
78
+ <tr rel="tooltip" title="The rate of job timeouts to reserve calls.">
79
+ <td>Timeout Rate</td>
80
+ <% timeout_reserve_rate = (@stats["job-timeouts"].to_f / @stats["cmd-reserve"].to_f) %>
81
+ <% if timeout_reserve_rate > 0.01 %>
82
+ <td class="data_cell"><span class="badge badge-error"><%= timeout_reserve_rate %></span></td>
83
+ <% else %>
84
+ <td class="data_cell"><%= timeout_reserve_rate %></td>
85
+ <% end %>
86
+ </tr>
87
+ </tbody>
88
+ </table>
89
+
62
90
  <table class="table">
63
91
  <thead>
64
92
  <tr>
@@ -250,7 +278,37 @@
250
278
  <a id="add_job_btn" href="javascript:false" class="btn">Add Job</a>
251
279
  </form>
252
280
  </div>
281
+
282
+ <div class="span6">
283
+ <h3>Total Jobs</h3>
284
+ <canvas id="total_jobs_chart"></canvas>
285
+ </div>
253
286
  </div>
254
287
  </div>
255
288
 
289
+ <script type="text/javascript">
290
+ $(document).ready(function(){
291
+ var data = <%= @total_jobs_data.to_json.html_safe %>
292
+ //Create pie chart
293
+ var bluffGraph = new Bluff.Pie('total_jobs_chart', 570);
294
+ //Setup theme
295
+ var colors = ['#6886B4', '#FDD84E', '#72AE6E', '#D1695E', '#8A6EAF', '#EFAA43', 'white'];
296
+ bluffGraph.set_theme({
297
+ colors: colors,
298
+ marker_color: 'white',
299
+ font_color: 'white',
300
+ background_colors: ['#008000', '#008000']
301
+ });
302
+ bluffGraph.tooltips = true;
303
+
304
+ for (i in data.items) {
305
+ var item = data.items[i];
306
+ //Add each data item to pie
307
+ bluffGraph.data(item.label, item.data);
308
+ }
309
+ //Finally draw the chart
310
+ bluffGraph.draw();
311
+ });
312
+ </script>
313
+
256
314
  <%= erb :job_info_popup %>
@@ -10,6 +10,9 @@
10
10
  <script type="text/javascript" src="<%= url('/resources/bootstrap/js/bootstrap.min.js') %>"></script>
11
11
  <script type="text/javascript" src="<%= url('/resources/js/json2.js') %>"></script>
12
12
  <script type="text/javascript" src="<%= url('/resources/js/peek_jobs.js') %>"></script>
13
+ <script language="javascript" src="<%= url('/resources/js/bluff/js-class.js') %>"></script>
14
+ <script language="javascript" src="<%= url('/resources/js/bluff/bluff-min.js') %>"></script>
15
+ <!--[if IE]><script language="javascript" src="<%= url('/resources/js/bluff/excanvas.js') %>"></script><![endif]-->
13
16
  <script type="text/javascript">
14
17
  <!-- Enable Tooltips -->
15
18
  $(document).ready(function() {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beanstalkd_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-27 00:00:00.000000000 Z
12
+ date: 2012-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &2153012620 !ruby/object:Gem::Requirement
16
+ requirement: &2156750980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153012620
24
+ version_requirements: *2156750980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: beanstalk-client
27
- requirement: &2153012040 !ruby/object:Gem::Requirement
27
+ requirement: &2156750420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.1.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153012040
35
+ version_requirements: *2156750420
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: vegas
38
- requirement: &2153011340 !ruby/object:Gem::Requirement
38
+ requirement: &2156749960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.1.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153011340
46
+ version_requirements: *2156749960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: json
49
- requirement: &2153010400 !ruby/object:Gem::Requirement
49
+ requirement: &2156749520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2153010400
57
+ version_requirements: *2156749520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &2153009900 !ruby/object:Gem::Requirement
60
+ requirement: &2156748940 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153009900
68
+ version_requirements: *2156748940
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack-test
71
- requirement: &2153009480 !ruby/object:Gem::Requirement
71
+ requirement: &2156748520 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153009480
79
+ version_requirements: *2156748520
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2153008860 !ruby/object:Gem::Requirement
82
+ requirement: &2156748080 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2153008860
90
+ version_requirements: *2156748080
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: capybara
93
- requirement: &2153008420 !ruby/object:Gem::Requirement
93
+ requirement: &2156747660 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2153008420
101
+ version_requirements: *2156747660
102
102
  description: A Sinatra app to view/manage beanstalkd queues that can be embedded in
103
103
  a Rails app similar to what's available in Resque
104
104
  email: dennis.kuczynski@gmail.com
@@ -110,6 +110,7 @@ files:
110
110
  - README.md
111
111
  - Gemfile
112
112
  - Rakefile
113
+ - MIT-LICENSE.txt
113
114
  - lib/beanstalkd_view/beanstalkd_utils.rb
114
115
  - lib/beanstalkd_view/Gemfile
115
116
  - lib/beanstalkd_view/Rakefile
@@ -118,6 +119,9 @@ files:
118
119
  - lib/beanstalkd_view/resources/bootstrap/img/glyphicons-halflings-white.png
119
120
  - lib/beanstalkd_view/resources/bootstrap/img/glyphicons-halflings.png
120
121
  - lib/beanstalkd_view/resources/bootstrap/js/bootstrap.min.js
122
+ - lib/beanstalkd_view/resources/js/bluff/bluff-min.js
123
+ - lib/beanstalkd_view/resources/js/bluff/excanvas.js
124
+ - lib/beanstalkd_view/resources/js/bluff/js-class.js
121
125
  - lib/beanstalkd_view/resources/js/jquery-1.7.1.min.js
122
126
  - lib/beanstalkd_view/resources/js/json2.js
123
127
  - lib/beanstalkd_view/resources/js/peek_jobs.js