Skip to content
Browse files

can manually activate tooltips now

  • Loading branch information...
1 parent c240fa2 commit be9c1fc58b7c7b606948d2a7a03c598445360b07 @jcarver989 committed Dec 11, 2012
Showing with 57 additions and 47 deletions.
  1. +7 −2 compiled/charts.js
  2. +43 −43 compiled/charts.min.js
  3. +1 −1 examples/examples.js
  4. +6 −1 src/coffeescript/charts/line.coffee
View
9 compiled/charts.js
@@ -1063,7 +1063,7 @@ Line = (function() {
};
Line.prototype.draw_dots_and_tooltips = function() {
- var dot, dots, i, max_point, min_point, point, raw_point, raw_points, scaled_points, tooltips, _i, _len;
+ var dot, dots, i, max_point, min_point, point, raw_point, raw_points, scaled_points, tooltip, tooltips, _i, _len;
scaled_points = this.scaled_points;
raw_points = this.raw_points;
tooltips = [];
@@ -1080,11 +1080,16 @@ Line = (function() {
min_point = i;
}
dot = new Dot(this.r, point, this.options);
+ tooltip = new Tooltip(this.r, dot.element, raw_point.options.tooltip || raw_point.y);
dots.push(dot);
- tooltips.push(new Tooltip(this.r, dots[i].element, raw_point.options.tooltip || raw_point.y));
+ tooltips.push(tooltip);
if (raw_point.options.no_dot === true) {
dot.hide();
}
+ if (raw_point.options.show_dot === true) {
+ dot.activate();
+ tooltip.show();
+ }
}
if (this.options.label_max) {
tooltips[max_point].show();
View
86 compiled/charts.min.js
@@ -25,46 +25,46 @@ function(){this.popup.toFront();this.text.toFront();this.animate_opacity(this.po
f[a].show();if(this.options.label_min)return f[c].show()};return g}();var J;J=function(){function g(){}g.create_path=function(b,a){var c,d,e,f,h,i;if(a==null)a=0.5;f="M"+b[0].x+", "+b[0].y;e=h=0;for(i=b.length;h<i;e=++h)if(e!==0){d=g.get_control_points(b,e-1,a);c=d[0];d=d[1];f+="C"+c.x+","+c.y+" "+d.x+","+d.y+" "+b[e].x+","+b[e].y}return f};g.get_control_points=function(b,a,c,d){var e,f,h,i;if(d==null)d=3;f=this.get_prev_and_next_points(b,a);e=f[0];f=f[1];a=this.get_prev_and_next_points(b,a+1);b=
a[0];h=a[1];a=this.get_tangent(e,f);e=a[0];a=a[1];i=this.get_tangent(b,h);h=i[0];i=i[1];e=b.x+e*c/d;b=b.y+a*c/d;a=f.x-h*c/d;c=f.y-i*c/d;d=new m(e,b);c=new m(a,c);return[d,c]};g.get_prev_and_next_points=function(b,a){var c,d;d=a-1;c=a+1;if(d<0)d=0;if(c>=b.length)c=b.length-1;return[b[d],b[c]]};g.get_tangent=function(b,a){return[a.x-b.x,a.y-b.y]};return g}();r.Bezier=J;var R;R=function(){function g(b,a,c,d,e,f){this.r=b;this.raw_points=a;this.scaled_points=c;this.height=d;this.width=e;this.options=
f!=null?f:{}}g.prototype.draw=function(){var b;b=J.create_path(this.scaled_points,this.options.smoothing);this.options.fill_area&&this.draw_area(b);this.draw_curve(b);this.options.dot_size>0&&this.draw_dots_and_tooltips(this.scaled_points,this.raw_points)};g.prototype.draw_curve=function(b){return this.r.path(b).attr({stroke:this.options.line_color,"stroke-width":this.options.line_width}).toFront()};g.prototype.draw_area=function(b){var a,c,d;c=this.scaled_points;d=this.height-this.options.y_padding;
-a=c[c.length-1];c=c[0];b+="L "+a.x+", "+d+" ";b+="L "+c.x+", "+d+" ";b+="Z";b=this.r.path(b);b.attr({fill:this.options.area_color,"fill-opacity":this.options.area_opacity,stroke:"none"});return b.toBack()};g.prototype.draw_dots_and_tooltips=function(){var b,a,c,d,e,f,h,i,j,k,l;i=this.scaled_points;h=this.raw_points;j=[];a=[];c=k=e=d=0;for(l=i.length;k<l;c=++k){b=i[c];f=h[c];if(f.y>=h[d].y)d=c;if(f.y<h[e].y)e=c;b=new B(this.r,b,this.options);a.push(b);j.push(new C(this.r,a[c].element,f.options.tooltip||
-f.y));f.options.no_dot===true&&b.hide()}if(this.options.label_max){j[d].show();a[d].activate()}if(this.options.label_min){j[e].show();return a[e].activate()}};return g}();var w,S;S=function(g){return g.tagName!==void 0?true:false};w=function(){function g(b,a){var c,d;c=S(b)?b:document.getElementById(b);d=this.get_dimensions(c);this.width=d[0];this.height=d[1];this.r=Raphael(c,this.width,this.height);this.options=a}g.prototype.get_dimensions=function(b){var a;a=parseInt(b.style.width);b=parseInt(b.style.height);
-return[a,b]};g.prototype.clear=function(){return this.r.clear()};return g}();var T,U,V,K;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};U=function(g){function b(a){return b.__super__.constructor.call(this,a,b.DEFAULTS)}s(b,g);b.DEFAULTS={main_circle_radius:70,child_radius_multiplier:0.15,hover_scale_multiplier:1.2,inactive_opacity:0.4,outer_radius_multiplier:1.35,
-outer_radius2_multiplier:1.5,bounce_radius:1.2,fill_color:"#00a6dd"};return b}(v);K=function(g,b,a){return new m(b*Math.cos(a)+g.x,b*Math.sin(a)+g.y)};V=function(g,b,a,c,d){var e;e=function(f,h,i,j){if(j==null)j=void 0;return f.animate({x:h.x,y:h.y,cx:h.x,cy:h.y},i,"<",j)};return e(g,b,c,function(){return e(g,a,d)})};T=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new U(c));this.center_point=new m(this.width/2,this.height/2);this.main_radius=this.options.main_circle_radius;
-this.child_radius=this.main_radius*this.options.child_radius_multiplier;this.outer_radius=this.main_radius*this.options.outer_radius_multiplier;this.outer_radius2=this.outer_radius*this.options.outer_radius2_multiplier;this.bounce_radius=this.outer_radius*this.options.bounce_radius;this.children=[]}s(b,g);b.prototype.add_hover=function(a){var c,d,e=this;c=function(){a[0].animate({r:e.options.hover_scale_multiplier*e.child_radius,opacity:1,"stroke-width":2,stroke:"rgba(0,0,0,.4)"},200);a[1].animate({"font-size":22,
-opacity:1,fill:"#fff"},200);return a._label.animate({opacity:1},200)};d=function(){a[0].animate({r:e.child_radius,opacity:e.options.inactive_opacity,stroke:"none","stroke-width":0},200);a[1].animate({opacity:0},200);return a._label.animate({opacity:0},200)};a._activate=c;a._deactivate=d;return a.hover(c,d)};b.prototype.add=function(a){return this.children.push(a)};b.prototype.create_circles_along_radius=function(a,c,d,e){var f,h,i,j,k,l,o,n,p;j=2*Math.PI/24;p=[];h=o=0;for(n=a.length;o<n;h=++o){i=
-a[h];h=h*j;f=K(this.center_point,d,h);k=f.x;l=f.y;f=this.draw_circle(this.center_point.x,this.center_point.y,c,16);f._realx=k;f._realy=l;f._radians=h;f.attr({opacity:this.options.inactive_opacity}).toFront();f[1].attr({opacity:0});this.add_label_to_circle(i,f);this.add_hover(f);p.push(e(i,f))}return p};b.prototype.bounce_circles=function(a,c){var d,e,f,h,i,j,k;if(c){k=[];h=i=0;for(j=c.length;i<j;h=++i){f=c[h];e=f._radians;d=K(this.center_point,this.bounce_radius,e);e=d.x;d=d.y;e=new m(e,d);if(a._active){d=
-c.length-h;h=this.center_point;f.toBack()}else{d=h;h=new m(f._realx,f._realy);f.toFront()}d=100+d*10;k.push(V(f,e,h,d,100))}return k}};b.prototype.add_click_to_circle=function(a,c){var d,e=this;if(c==null)c=false;d=function(){var f,h,i,j,k;if(a._active){a.hover(a._activate,a._deactivate);h=0;if(a._children){k=a._children;i=0;for(j=k.length;i<j;i++){f=k[i];if(f._active){f._deactivate();f._click_handler()}}}}else{a.unhover(a._activate,a._deactivate);h=45}e.bounce_circles(a,a._children);a.animate({transform:"r"+
-h},200);return a._active=!a._active};a._click_handler=d;return a.click(d)};b.prototype.add_label_to_circle=function(a,c){var d,e,f;d=this.r.text(c._realx,c._realy,a.label).attr({"font-size":14});e=this.r.text(c._realx,c._realy+15,F(a.value)).attr({"font-size":12,fill:this.options.fill_color}).toBack();f=this.r.set();f.push(d);f.push(e);if(c._realx>this.center_point.x){d="start";e=30}else{d="end";e=-30}f.attr({"text-anchor":d,x:c._realx+e,opacity:0});return c._label=f};b.prototype.add_grandchildren=
-function(a,c){if(a.children){c._children=[];return this.create_circles_along_radius(a.children,this.child_radius,this.outer_radius2,function(d,e){c._active=false;return c._children.push(e)})}};b.prototype.draw_circle=function(a,c,d,e){var f,h;f={fill:this.options.fill_color,stroke:"none"};h=this.r.set();h.push(this.r.circle(a,c,d).attr(f));h.push(this.r.text(a,c,"+").attr({"font-size":e,fill:"#fff"}));return h.attr({cursor:"pointer"}).toFront()};b.prototype.draw=function(){var a,c=this;a=this.draw_circle(this.center_point.x,
-this.center_point.y,this.main_radius,100);a._active=false;a._children=[];this.add_click_to_circle(a,true);this.create_circles_along_radius(this.children,this.child_radius,this.outer_radius,function(d,e){c.add_grandchildren(d,e);c.add_click_to_circle(e);return a._children.push(e)});return a.toFront()};return b}(w);r.PathMenu=T;var W,X;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;
-return g};X=function(g,b,a,c,d){var e,f,h;f=360/c*a;e=(90-f)*Math.PI/180;h=g+d*Math.cos(e);e=b-d*Math.sin(e);return{path:c===a?[["M",g,b-d],["A",d,d,0,1,1,g-0.01,b-d]]:[["M",g,b-d],["A",d,d,0,+(f>180),1,h,e]]}};W=function(g){function b(a){return b.__super__.constructor.call(this,a,b.DEFAULTS)}s(b,g);b.DEFAULTS={radius:55,stroke_width:30,font_color:"#333333",label_color:"#333333",fill_color:"#fff",stroke_color:"#81ae14",background_color:"#222222",text_shadow:false};return b}(v);v=function(g){function b(a,
-c,d,e){this.label=c;this.value=d;if(e==null)e={};b.__super__.constructor.call(this,a,new W(e));this.center_point=new m(this.width/2,this.height/2);this.r.customAttributes.arc=X}s(b,g);b.prototype.draw=function(){var a;a=this.r.path().attr({"stroke-width":this.options.stroke_width,stroke:this.options.stroke_color,arc:[this.center_point.x,this.center_point.y,0,100,this.options.radius]});this.r.circle(this.center_point.x,this.center_point.y,this.options.radius).attr({fill:this.options.fill_color,stroke:"none",
-"stroke-width":0});this.r.text(this.center_point.x,this.center_point.y,Math.round(this.value*100/100)+"%").attr({"font-size":this.options.radius/2.5,fill:this.options.font_color,"font-weight":"bold"});this.r.text(this.center_point.x,this.center_point.y+1.8*this.options.radius,this.label).attr({"font-size":this.options.radius/2.5,"font-weight":"bold",fill:this.options.label_color});this.options.text_shadow&&this.r.text(this.center_point.x,this.center_point.y+1.8*this.options.radius+1,this.label).attr({"font-size":this.options.radius/
-2.5,"font-weight":"bold",fill:this.options.text_shadow}).toBack();return a.animate({arc:[this.center_point.x,this.center_point.y,this.value,100,this.options.radius]},1500,"<")};return b}(w);r.CircleProgress=v;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};v=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new D(c));this.padding=26;
-this.all_points=[];this.line_indices=[];this.line_options=[]}s(b,g);b.prototype.add_line=function(a){var c,d,e,f,h;c=a.data;if(!(c.length<1)){e=[];f=0;for(h=c.length;f<h;f++){d=c[f];d.length===3?e.push(new m(d[0],d[1],d[2])):e.push(new m(d[0],d[1]))}c=this.all_points.length;this.line_indices.push([c,c+e.length-1]);this.all_points.push.apply(this.all_points,e);this.line_options.push(D.merge(this.options,a.options))}};b.prototype.draw_grid=function(a,c){var d,e,f,h,i,j,k;if(a==null)a=[];if(c==null)c=
-[];i=function(l,o,n){return l.attr({stroke:o,"stroke-width":n})};f=this.options.multi_axis?this.options.x_padding*2:this.options.x_padding;d=this.height-this.options.y_padding;h=this.width-f;f=this.r.set();j=0;for(k=a.length;j<k;j++){e=a[j];f.push(this.r.path("M "+e+", "+this.options.y_padding+" L "+e+", "+d+" Z"))}j=0;for(k=c.length;j<k;j++){e=c[j];f.push(this.r.path("M "+this.options.x_padding+", "+e+" L "+h+", "+e+" Z"))}if(this.options.multi_axis===true&&this.line_options.length===2){e=this.options.x_padding;
-e=this.r.path("M "+e+", "+this.options.y_padding+" L "+e+", "+d+" Z");h=this.width-this.options.x_padding*2;d=this.r.path("M "+h+", "+this.options.y_padding+" L "+h+", "+d+" Z");i(e,this.line_options[0].line_color,2).toBack();i(d,this.line_options[1].line_color,2).toBack()}return i(f,"#ccc",1).toBack()};b.prototype.create_scalers=function(a){var c,d,e,f,h,i,j,k,l,o=this;f=void 0;e=void 0;h=void 0;f=void 0;i=void 0;if(this.options.scale==="log"){d=new H;e=function(){var n,p,q;q=[];n=0;for(p=a.length;n<
-p;n++){j=a[n];q.push(new m(j.x,d(j.y)))}return q}();i=x.get_ranges_for_points(e);e=i[0];h=i[1];f=i[2];i=i[3]}else{i=x.get_ranges_for_points(a);e=i[0];h=i[1];f=i[2];i=i[3]}if(this.options.y_axis_scale.length===2){f=this.options.y_axis_scale;i=f[0];f=f[1]}k=this.options.multi_axis?this.options.x_padding*2:this.options.x_padding;e=(new A).domain([h,e]).range([this.options.x_padding,this.width-k]);l=(new A).domain([i,f]).range([this.options.y_padding,this.height-this.options.y_padding]);c=function(n){return o.height-
-l(n)};f=this.options.scale==="log"?function(n){return c(d(n))}:c;return[e,f]};b.prototype.create_scalers_for_single_point=function(){var a=this;return[function(){return 0.5*(a.width-a.options.x_padding)},function(){return 0.5*(a.height-a.options.y_padding)}]};b.prototype._draw_y_labels=function(a,c){var d,e,f,h,i,j,k,l,o;if(c==null)c=0;d=this.options.label_format;j=this.options.y_label_size;e=this.options.font_family;i=j+5;i=this.options.multi_axis&&c>0?c:c+i;if(a.length===1){h=this.create_scalers_for_single_point();
-k=h[1]}else{h=this.create_scalers(a);k=h[1]}h=[];f=l=0;for(o=a.length;l<o;f=++l){f=a[f];(new z(this.r,i,k(f.y),f.y,d,j,e)).draw();h.push(k(f.y))}return h};b.prototype.calc_y_label_step_size=function(a,c,d){if(d==null)d=this.options.max_y_labels;a=(c-a)/(d-1);if(c>1){a=Math.round(a);if(a===0)a=1}return a};b.prototype.draw_y_labels=function(a,c){var d,e,f,h,i,j;if(c==null)c=0;f=x.get_ranges_for_points(a);h=f[2];e=f[3];if(this.options.y_axis_scale.length===2){h=this.options.y_axis_scale;e=h[0];h=h[1]}if(h===
-e)return this._draw_y_labels([new m(0,h)],c);f=[];if(this.options.scale==="log"){d=new H;j=d(e);d=d(h);d=(d-j)/(this.options.max_y_labels-1);e=e;for(i=0;e<=h&&i<this.options.max_y_labels;){e=Math.pow(10,j+d*i);f.push(new m(0,e));i+=1}}else{j=e;for(d=this.calc_y_label_step_size(e,h);j<=h;){f.push(new m(0,j));j+=d}}if(h>1)f[f.length-1].y=Math.round(h);return this._draw_y_labels(f,c)};b.prototype.draw_x_label=function(a,c){var d,e,f;d=this.options.label_format;f=this.options.x_label_size;e=this.options.font_family;
-return(new z(this.r,c.x,this.height-f,a.is_date_type===true?new Date(a.x):Math.round(a.x),d,f,e)).draw()};b.prototype.draw_x_labels=function(a,c){var d,e,f,h,i,j;e=[];h=this.options.max_x_labels;this.draw_x_label(a[0],c[0]);e.push(c[0].x);if(!(h<2)){f=c.length-1;this.draw_x_label(a[f],c[f]);e.push(c[f].x);if(!(h<3)){f=c.length-2;h=f/(h-1);d=Math.round(h);if(h!==d)h=d+1;for(d=h;d<f;){j=a[d];i=c[d];this.draw_x_label(j,i);e.push(i.x);d+=h}return e}}};b.prototype.draw_line=function(a,c,d){return this.options.render===
-"bar"?(new Q(this.r,a,c,this.height,this.width,d)).draw():(new R(this.r,a,c,this.height,this.width,d)).draw()};b.prototype.clear=function(){b.__super__.clear.call(this);this.all_points=[];this.line_indices=[];return this.line_options=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l,o,n;if(!(this.all_points.length<1)){this.r.clear();d=this.all_points.length>1?this.create_scalers(this.all_points):this.create_scalers_for_single_point();j=d[0];k=d[1];n=this.line_indices;d=l=0;for(o=n.length;l<
-o;d=++l){c=n[d];a=c[0];c=c[1];i=this.all_points.slice(a,c+1||9E9);if(this.options.multi_axis){a=this.all_points.length>2?this.create_scalers(i):this.create_scalers_for_single_point();e=a[0];f=a[1]}else{e=j;f=k}c=function(){var p,q,u;u=[];p=0;for(q=i.length;p<q;p++){h=i[p];u.push(new m(e(h.x),f(h.y)))}return u}();a=this.line_options[d];this.draw_line(i,c,a);if(d===0){if(this.options.show_x_labels===true)this.x_label_coordinates=this.draw_x_labels(i,c);if(this.options.multi_axis&&this.options.show_y_labels===
-true)this.y_label_coordinates=this.draw_y_labels(i);else if(this.options.show_y_labels===true)this.y_label_coordinates=this.draw_y_labels(this.all_points);this.options.show_grid===true&&this.draw_grid(this.x_label_coordinates,this.y_label_coordinates)}else d===1&&this.options.multi_axis&&this.options.show_y_labels===true&&this.draw_y_labels(i,this.width-this.options.x_padding)}}};return b}(w);r.LineChart=v;var Y,Z,$;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,
-c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};Z=function(g,b,a){return{label:g,raw_value:b,index_value:a}};$=function(g,b,a){return{label:g,index_value:b,opacity:a}};Y=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new O(c));this.effects=new I(this.r);this.bars=[];this.guides=[];this.index=100}s(b,g);b.prototype.add=function(a,c,d){return this.bars.push(Z(a,c,d))};b.prototype.add_guide_line=function(a,c,d){if(d==null)d=1;
-return this.guides.push($(a,c,d))};b.prototype.add_raw_label=function(a){var c,d=this;c=(new E(this.r)).x(function(){return d.width-10}).y(function(e){return e*15+15}).size(this.options.label_size).attr({fill:"#333","text-anchor":"end","font-weight":"bold"});c.draw(a);return c.draw("(raw value)").attr({"font-weight":"normal","font-size":10})};b.prototype.set_bar_height=function(){return this.bar_height=(this.height-this.options.y_padding)/this.bars.length-this.options.bar_margin};b.prototype.set_threshold=
-function(){var a,c;c=function(){var d,e,f,h;f=this.guides;h=[];d=0;for(e=f.length;d<e;d++){a=f[d];h.push(a.index_value)}return h}.call(this);return this.threshold=Math.max.apply(Math.max,c)};b.prototype.format_tooltip=function(a){return a/100+"x"};b.prototype.draw_raw_bar=function(a,c){var d,e;d=Math.floor(7);e=this.options.x_padding_right-10;this.r.rect(this.width-e,c-d,this.width-this.options.x_padding_right,this.bar_height+14,this.options.rounding).attr({fill:this.options.raw_value_bar_color,stroke:"none"});
-return this.effects.straight_line(new m(this.width-e,this.options.y_padding-10),new m(this.width-e,this.height)).attr({stroke:"rgba(0,0,0,0.25)","stroke-width":0.1})};b.prototype.draw_bg_bar=function(a,c,d){c(a);c=this.options.bg_bar_padding;a=Math.floor(c/2);return this.r.rect(this.options.x_padding-a,d-a,this.width,this.bar_height+c,this.options.rounding).attr({fill:this.options.bar_bg_color,stroke:"none"}).toBack()};b.prototype.shade_bar=function(a,c){if(c==null)c=this.options.bar1_color;a.attr({fill:c,
-stroke:"none"});this.effects.one_px_shadow(a);return this.effects.one_px_highlight(a)};b.prototype.render_bar=function(a,c,d,e){if(e==null)e=this.options.bar1_color;a=this.r.rect(a,c,d,this.bar_height,this.options.rounding);this.shade_bar(a,e);return a};b.prototype.draw_bar=function(a,c,d){var e,f,h;h=c(x.threshold(a,this.threshold));if(a>this.index){e=c(this.index);c=this.render_bar(this.options.x_padding,d,e-this.options.x_padding);d=this.render_bar(e,d,h-e,this.options.bar2_color);f=new C(this.r,
-d,this.format_tooltip(a));f.translate(d.getBBox().width/2,0);c.mouseover(function(){return f.show()});return c.mouseout(function(){return f.hide()})}else{d=this.render_bar(this.options.x_padding,d,h-this.options.x_padding);f=new C(this.r,d,this.format_tooltip(a));return f.translate(d.getBBox().width/2,0)}};b.prototype.draw_guide_line=function(a,c,d,e){var f,h;if(e==null)e=1;h=new m(d,this.options.y_padding);f=new m(d,this.height);this.effects.vertical_dashed_line(h,f,this.options.dash_width).attr({fill:"rgba(0,0,0,"+
-e+")",stroke:"none"});e=(new E(this.r)).x(function(){return d}).y(function(i){return i*15+15}).size(this.options.label_size).attr({fill:"rgba(0,0,0,"+e+")"});e.draw(a).attr({"font-weight":"bold"});return e.draw(c).attr({"font-size":10})};b.prototype.sort_bars_by_index=function(){var a,c;c=function(){var d,e,f,h;f=this.bars;h=[];d=0;for(e=f.length;d<e;d++){a=f[d];h.push(a)}return h}.call(this);c.sort(function(d,e){return e.index_value-d.index_value});return c};b.prototype.clear=function(){b.__super__.clear.call(this);
-this.bars=[];return this.guides=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l,o,n,p,q=this;this.set_bar_height();this.set_threshold();h=this.bar_height+this.options.bar_margin;d=this.bar_height/2;l=this.options.y_padding;j=this.options.x_padding;c=(new E(this.r)).y(function(u){return u*h+l+d}).x(function(){return j-30}).size(12).attr({fill:"#fff","text-anchor":"end"});f=(new E(this.r)).y(function(u){return u*h+l+d}).x(function(){return q.width-10}).size(this.options.label_size).attr({fill:"#333",
-"text-anchor":"end"});i=(new A).domain([0,this.threshold]).range([this.options.x_padding,this.width-this.options.x_padding_right]);k=function(u){return u*(q.bar_height+q.options.bar_margin)+q.options.y_padding};p=this.sort_bars_by_index();e=o=0;for(n=p.length;o<n;e=++o){a=p[e];this.draw_bg_bar(a.index_value,i,k(e));this.draw_raw_bar(a.raw_value,k(e));this.draw_bar(a.index_value,i,k(e));f.draw(a.raw_value);a=c.draw(a.label);this.effects.black_nub(a)}o=this.guides;n=[];f=0;for(k=o.length;f<k;f++){c=
-o[f];n.push(this.draw_guide_line(c.label,c.index_value,i(c.index_value),c.opacity))}return n};return b}(w);r.IndexChart=function(g,b){return new Y(g,b)};var y;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};y=function(g,b,a,c){return{label:g,value:b,average:a,comparison:c}};v=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new N(c));
-this.bars=[]}s(b,g);b.prototype.add=function(){return this.bars.push(y.apply(y,arguments))};b.prototype.draw_background=function(a,c){return this.r.rect(this.options.x_padding,c,a.x,this.options.area_width).attr({fill:this.options.area_color,stroke:"none"})};b.prototype.draw_line=function(a,c){return this.r.rect(this.options.x_padding,c.y-this.options.line_width/2,a.x,this.options.line_width).attr({fill:this.options.line_color,stroke:"none"})};b.prototype.draw_average=function(a,c){return this.r.rect(a.x-
-this.options.average_width/2,c-this.options.average_height/2,this.options.average_width,this.options.average_height).attr({fill:this.options.average_color,stroke:"none"})};b.prototype.draw_label=function(){};b.prototype.clear=function(){b.__super__.clear.call(this);return this.bars=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l;k=this.bars;l=[];a=i=0;for(j=k.length;i<j;a=++i){y=k[a];e=[new m(y.comparison,0),new m(y.value,0),new m(y.average,0),new m(0,0)];d=x.get_ranges_for_points(e);c=d[0];
-d=d[1];h=(new A).domain([d,c]).range([this.options.x_padding,this.width-this.options.x_padding]);c=function(){var o,n,p;p=[];o=0;for(n=e.length;o<n;o++){f=e[o];p.push(new m(h(f.x),0))}return p}();d=a*(this.options.area_width+this.options.bar_margin);this.draw_background(c[0],d);a=d+this.options.area_width/2;this.draw_line(c[1],new m(c[0].x,a));this.draw_average(c[2],a);l.push((new z(this.r,0,d+this.options.area_width/2,y.label,"",this.size=14,this.options.font_family)).draw())}return l};return b}(w);
-r.BulletChart=v;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};w=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new G(c));this.effective_height=this.height-this.options.y_padding;this.bar_options=[];this.bars=[];this.values=[]}s(b,g);b.prototype.add=function(a){var c,d;c=a.label;d=a.value;this.bar_options.push(G.merge(this.options,
-a.options));this.values.push(d);return this.bars.push({label:c,value:d})};b.prototype.render_bar=function(a,c,d,e){this.r.rect(d.x,d.y,this.options.bar_width,this.effective_height-d.y,this.options.rounding).attr({fill:e.bar_color,stroke:"none"});(new z(this.r,d.x+this.options.bar_width/2,this.height-(this.options.x_label_size+5),a,"",this.options.x_label_size,this.options.font_family,this.options.x_label_color)).draw();return(new z(this.r,d.x+this.options.bar_width/2,d.y-this.options.y_label_size-
-5,c,"",this.options.y_label_size,this.options.font_family,this.options.y_label_color)).draw()};b.prototype.clear=function(){b.__super__.clear.call(this);this.bars=[];return this.values=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l,o,n,p=this;e=function(){var q,u,L,M;L=this.values;M=[];c=q=0;for(u=L.length;q<u;c=++q){i=L[c];M.push(new m(c,i))}return M}.call(this);e.push(new m(0,0));d=x.get_ranges_for_points(e);a=d[2];d=d[3];j=(new A).domain([d,a]).range([this.options.y_padding,this.height-
-this.options.y_padding]);d=function(q){return p.height-j(q)};o=this.bars;n=[];c=k=0;for(l=o.length;k<l;c=++k){a=o[c];f=c*(this.options.bar_width+this.options.bar_spacing)+this.options.x_padding;h=d(e[c].y);f=new m(f,h);n.push(this.render_bar(a.label,a.value,f,this.bar_options[c]))}return n};return b}(w);r.BarChart=w});})();
+a=c[c.length-1];c=c[0];b+="L "+a.x+", "+d+" ";b+="L "+c.x+", "+d+" ";b+="Z";b=this.r.path(b);b.attr({fill:this.options.area_color,"fill-opacity":this.options.area_opacity,stroke:"none"});return b.toBack()};g.prototype.draw_dots_and_tooltips=function(){var b,a,c,d,e,f,h,i,j,k,l;i=this.scaled_points;h=this.raw_points;j=[];a=[];b=k=d=c=0;for(l=i.length;k<l;b=++k){e=i[b];f=h[b];if(f.y>=h[c].y)c=b;if(f.y<h[d].y)d=b;b=new B(this.r,e,this.options);e=new C(this.r,b.element,f.options.tooltip||f.y);a.push(b);
+j.push(e);f.options.no_dot===true&&b.hide();if(f.options.show_dot===true){b.activate();e.show()}}if(this.options.label_max){j[c].show();a[c].activate()}if(this.options.label_min){j[d].show();return a[d].activate()}};return g}();var w,S;S=function(g){return g.tagName!==void 0?true:false};w=function(){function g(b,a){var c,d;c=S(b)?b:document.getElementById(b);d=this.get_dimensions(c);this.width=d[0];this.height=d[1];this.r=Raphael(c,this.width,this.height);this.options=a}g.prototype.get_dimensions=
+function(b){var a;a=parseInt(b.style.width);b=parseInt(b.style.height);return[a,b]};g.prototype.clear=function(){return this.r.clear()};return g}();var T,U,V,K;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};U=function(g){function b(a){return b.__super__.constructor.call(this,a,b.DEFAULTS)}s(b,g);b.DEFAULTS={main_circle_radius:70,child_radius_multiplier:0.15,hover_scale_multiplier:1.2,
+inactive_opacity:0.4,outer_radius_multiplier:1.35,outer_radius2_multiplier:1.5,bounce_radius:1.2,fill_color:"#00a6dd"};return b}(v);K=function(g,b,a){return new m(b*Math.cos(a)+g.x,b*Math.sin(a)+g.y)};V=function(g,b,a,c,d){var e;e=function(f,h,i,j){if(j==null)j=void 0;return f.animate({x:h.x,y:h.y,cx:h.x,cy:h.y},i,"<",j)};return e(g,b,c,function(){return e(g,a,d)})};T=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new U(c));this.center_point=new m(this.width/2,this.height/
+2);this.main_radius=this.options.main_circle_radius;this.child_radius=this.main_radius*this.options.child_radius_multiplier;this.outer_radius=this.main_radius*this.options.outer_radius_multiplier;this.outer_radius2=this.outer_radius*this.options.outer_radius2_multiplier;this.bounce_radius=this.outer_radius*this.options.bounce_radius;this.children=[]}s(b,g);b.prototype.add_hover=function(a){var c,d,e=this;c=function(){a[0].animate({r:e.options.hover_scale_multiplier*e.child_radius,opacity:1,"stroke-width":2,
+stroke:"rgba(0,0,0,.4)"},200);a[1].animate({"font-size":22,opacity:1,fill:"#fff"},200);return a._label.animate({opacity:1},200)};d=function(){a[0].animate({r:e.child_radius,opacity:e.options.inactive_opacity,stroke:"none","stroke-width":0},200);a[1].animate({opacity:0},200);return a._label.animate({opacity:0},200)};a._activate=c;a._deactivate=d;return a.hover(c,d)};b.prototype.add=function(a){return this.children.push(a)};b.prototype.create_circles_along_radius=function(a,c,d,e){var f,h,i,j,k,l,o,
+n,p;j=2*Math.PI/24;p=[];h=o=0;for(n=a.length;o<n;h=++o){i=a[h];h=h*j;f=K(this.center_point,d,h);k=f.x;l=f.y;f=this.draw_circle(this.center_point.x,this.center_point.y,c,16);f._realx=k;f._realy=l;f._radians=h;f.attr({opacity:this.options.inactive_opacity}).toFront();f[1].attr({opacity:0});this.add_label_to_circle(i,f);this.add_hover(f);p.push(e(i,f))}return p};b.prototype.bounce_circles=function(a,c){var d,e,f,h,i,j,k;if(c){k=[];h=i=0;for(j=c.length;i<j;h=++i){f=c[h];e=f._radians;d=K(this.center_point,
+this.bounce_radius,e);e=d.x;d=d.y;e=new m(e,d);if(a._active){d=c.length-h;h=this.center_point;f.toBack()}else{d=h;h=new m(f._realx,f._realy);f.toFront()}d=100+d*10;k.push(V(f,e,h,d,100))}return k}};b.prototype.add_click_to_circle=function(a,c){var d,e=this;if(c==null)c=false;d=function(){var f,h,i,j,k;if(a._active){a.hover(a._activate,a._deactivate);h=0;if(a._children){k=a._children;i=0;for(j=k.length;i<j;i++){f=k[i];if(f._active){f._deactivate();f._click_handler()}}}}else{a.unhover(a._activate,a._deactivate);
+h=45}e.bounce_circles(a,a._children);a.animate({transform:"r"+h},200);return a._active=!a._active};a._click_handler=d;return a.click(d)};b.prototype.add_label_to_circle=function(a,c){var d,e,f;d=this.r.text(c._realx,c._realy,a.label).attr({"font-size":14});e=this.r.text(c._realx,c._realy+15,F(a.value)).attr({"font-size":12,fill:this.options.fill_color}).toBack();f=this.r.set();f.push(d);f.push(e);if(c._realx>this.center_point.x){d="start";e=30}else{d="end";e=-30}f.attr({"text-anchor":d,x:c._realx+
+e,opacity:0});return c._label=f};b.prototype.add_grandchildren=function(a,c){if(a.children){c._children=[];return this.create_circles_along_radius(a.children,this.child_radius,this.outer_radius2,function(d,e){c._active=false;return c._children.push(e)})}};b.prototype.draw_circle=function(a,c,d,e){var f,h;f={fill:this.options.fill_color,stroke:"none"};h=this.r.set();h.push(this.r.circle(a,c,d).attr(f));h.push(this.r.text(a,c,"+").attr({"font-size":e,fill:"#fff"}));return h.attr({cursor:"pointer"}).toFront()};
+b.prototype.draw=function(){var a,c=this;a=this.draw_circle(this.center_point.x,this.center_point.y,this.main_radius,100);a._active=false;a._children=[];this.add_click_to_circle(a,true);this.create_circles_along_radius(this.children,this.child_radius,this.outer_radius,function(d,e){c.add_grandchildren(d,e);c.add_click_to_circle(e);return a._children.push(e)});return a.toFront()};return b}(w);r.PathMenu=T;var W,X;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,
+c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};X=function(g,b,a,c,d){var e,f,h;f=360/c*a;e=(90-f)*Math.PI/180;h=g+d*Math.cos(e);e=b-d*Math.sin(e);return{path:c===a?[["M",g,b-d],["A",d,d,0,1,1,g-0.01,b-d]]:[["M",g,b-d],["A",d,d,0,+(f>180),1,h,e]]}};W=function(g){function b(a){return b.__super__.constructor.call(this,a,b.DEFAULTS)}s(b,g);b.DEFAULTS={radius:55,stroke_width:30,font_color:"#333333",label_color:"#333333",fill_color:"#fff",stroke_color:"#81ae14",
+background_color:"#222222",text_shadow:false};return b}(v);v=function(g){function b(a,c,d,e){this.label=c;this.value=d;if(e==null)e={};b.__super__.constructor.call(this,a,new W(e));this.center_point=new m(this.width/2,this.height/2);this.r.customAttributes.arc=X}s(b,g);b.prototype.draw=function(){var a;a=this.r.path().attr({"stroke-width":this.options.stroke_width,stroke:this.options.stroke_color,arc:[this.center_point.x,this.center_point.y,0,100,this.options.radius]});this.r.circle(this.center_point.x,
+this.center_point.y,this.options.radius).attr({fill:this.options.fill_color,stroke:"none","stroke-width":0});this.r.text(this.center_point.x,this.center_point.y,Math.round(this.value*100/100)+"%").attr({"font-size":this.options.radius/2.5,fill:this.options.font_color,"font-weight":"bold"});this.r.text(this.center_point.x,this.center_point.y+1.8*this.options.radius,this.label).attr({"font-size":this.options.radius/2.5,"font-weight":"bold",fill:this.options.label_color});this.options.text_shadow&&this.r.text(this.center_point.x,
+this.center_point.y+1.8*this.options.radius+1,this.label).attr({"font-size":this.options.radius/2.5,"font-weight":"bold",fill:this.options.text_shadow}).toBack();return a.animate({arc:[this.center_point.x,this.center_point.y,this.value,100,this.options.radius]},1500,"<")};return b}(w);r.CircleProgress=v;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};v=function(g){function b(a,
+c){if(c==null)c={};b.__super__.constructor.call(this,a,new D(c));this.padding=26;this.all_points=[];this.line_indices=[];this.line_options=[]}s(b,g);b.prototype.add_line=function(a){var c,d,e,f,h;c=a.data;if(!(c.length<1)){e=[];f=0;for(h=c.length;f<h;f++){d=c[f];d.length===3?e.push(new m(d[0],d[1],d[2])):e.push(new m(d[0],d[1]))}c=this.all_points.length;this.line_indices.push([c,c+e.length-1]);this.all_points.push.apply(this.all_points,e);this.line_options.push(D.merge(this.options,a.options))}};
+b.prototype.draw_grid=function(a,c){var d,e,f,h,i,j,k;if(a==null)a=[];if(c==null)c=[];i=function(l,o,n){return l.attr({stroke:o,"stroke-width":n})};f=this.options.multi_axis?this.options.x_padding*2:this.options.x_padding;d=this.height-this.options.y_padding;h=this.width-f;f=this.r.set();j=0;for(k=a.length;j<k;j++){e=a[j];f.push(this.r.path("M "+e+", "+this.options.y_padding+" L "+e+", "+d+" Z"))}j=0;for(k=c.length;j<k;j++){e=c[j];f.push(this.r.path("M "+this.options.x_padding+", "+e+" L "+h+", "+
+e+" Z"))}if(this.options.multi_axis===true&&this.line_options.length===2){e=this.options.x_padding;e=this.r.path("M "+e+", "+this.options.y_padding+" L "+e+", "+d+" Z");h=this.width-this.options.x_padding*2;d=this.r.path("M "+h+", "+this.options.y_padding+" L "+h+", "+d+" Z");i(e,this.line_options[0].line_color,2).toBack();i(d,this.line_options[1].line_color,2).toBack()}return i(f,"#ccc",1).toBack()};b.prototype.create_scalers=function(a){var c,d,e,f,h,i,j,k,l,o=this;f=void 0;e=void 0;h=void 0;f=
+void 0;i=void 0;if(this.options.scale==="log"){d=new H;e=function(){var n,p,q;q=[];n=0;for(p=a.length;n<p;n++){j=a[n];q.push(new m(j.x,d(j.y)))}return q}();i=x.get_ranges_for_points(e);e=i[0];h=i[1];f=i[2];i=i[3]}else{i=x.get_ranges_for_points(a);e=i[0];h=i[1];f=i[2];i=i[3]}if(this.options.y_axis_scale.length===2){f=this.options.y_axis_scale;i=f[0];f=f[1]}k=this.options.multi_axis?this.options.x_padding*2:this.options.x_padding;e=(new A).domain([h,e]).range([this.options.x_padding,this.width-k]);
+l=(new A).domain([i,f]).range([this.options.y_padding,this.height-this.options.y_padding]);c=function(n){return o.height-l(n)};f=this.options.scale==="log"?function(n){return c(d(n))}:c;return[e,f]};b.prototype.create_scalers_for_single_point=function(){var a=this;return[function(){return 0.5*(a.width-a.options.x_padding)},function(){return 0.5*(a.height-a.options.y_padding)}]};b.prototype._draw_y_labels=function(a,c){var d,e,f,h,i,j,k,l,o;if(c==null)c=0;d=this.options.label_format;j=this.options.y_label_size;
+e=this.options.font_family;i=j+5;i=this.options.multi_axis&&c>0?c:c+i;if(a.length===1){h=this.create_scalers_for_single_point();k=h[1]}else{h=this.create_scalers(a);k=h[1]}h=[];f=l=0;for(o=a.length;l<o;f=++l){f=a[f];(new z(this.r,i,k(f.y),f.y,d,j,e)).draw();h.push(k(f.y))}return h};b.prototype.calc_y_label_step_size=function(a,c,d){if(d==null)d=this.options.max_y_labels;a=(c-a)/(d-1);if(c>1){a=Math.round(a);if(a===0)a=1}return a};b.prototype.draw_y_labels=function(a,c){var d,e,f,h,i,j;if(c==null)c=
+0;f=x.get_ranges_for_points(a);h=f[2];e=f[3];if(this.options.y_axis_scale.length===2){h=this.options.y_axis_scale;e=h[0];h=h[1]}if(h===e)return this._draw_y_labels([new m(0,h)],c);f=[];if(this.options.scale==="log"){d=new H;j=d(e);d=d(h);d=(d-j)/(this.options.max_y_labels-1);e=e;for(i=0;e<=h&&i<this.options.max_y_labels;){e=Math.pow(10,j+d*i);f.push(new m(0,e));i+=1}}else{j=e;for(d=this.calc_y_label_step_size(e,h);j<=h;){f.push(new m(0,j));j+=d}}if(h>1)f[f.length-1].y=Math.round(h);return this._draw_y_labels(f,
+c)};b.prototype.draw_x_label=function(a,c){var d,e,f;d=this.options.label_format;f=this.options.x_label_size;e=this.options.font_family;return(new z(this.r,c.x,this.height-f,a.is_date_type===true?new Date(a.x):Math.round(a.x),d,f,e)).draw()};b.prototype.draw_x_labels=function(a,c){var d,e,f,h,i,j;e=[];h=this.options.max_x_labels;this.draw_x_label(a[0],c[0]);e.push(c[0].x);if(!(h<2)){f=c.length-1;this.draw_x_label(a[f],c[f]);e.push(c[f].x);if(!(h<3)){f=c.length-2;h=f/(h-1);d=Math.round(h);if(h!==d)h=
+d+1;for(d=h;d<f;){j=a[d];i=c[d];this.draw_x_label(j,i);e.push(i.x);d+=h}return e}}};b.prototype.draw_line=function(a,c,d){return this.options.render==="bar"?(new Q(this.r,a,c,this.height,this.width,d)).draw():(new R(this.r,a,c,this.height,this.width,d)).draw()};b.prototype.clear=function(){b.__super__.clear.call(this);this.all_points=[];this.line_indices=[];return this.line_options=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l,o,n;if(!(this.all_points.length<1)){this.r.clear();d=this.all_points.length>
+1?this.create_scalers(this.all_points):this.create_scalers_for_single_point();j=d[0];k=d[1];n=this.line_indices;d=l=0;for(o=n.length;l<o;d=++l){c=n[d];a=c[0];c=c[1];i=this.all_points.slice(a,c+1||9E9);if(this.options.multi_axis){a=this.all_points.length>2?this.create_scalers(i):this.create_scalers_for_single_point();e=a[0];f=a[1]}else{e=j;f=k}c=function(){var p,q,u;u=[];p=0;for(q=i.length;p<q;p++){h=i[p];u.push(new m(e(h.x),f(h.y)))}return u}();a=this.line_options[d];this.draw_line(i,c,a);if(d===
+0){if(this.options.show_x_labels===true)this.x_label_coordinates=this.draw_x_labels(i,c);if(this.options.multi_axis&&this.options.show_y_labels===true)this.y_label_coordinates=this.draw_y_labels(i);else if(this.options.show_y_labels===true)this.y_label_coordinates=this.draw_y_labels(this.all_points);this.options.show_grid===true&&this.draw_grid(this.x_label_coordinates,this.y_label_coordinates)}else d===1&&this.options.multi_axis&&this.options.show_y_labels===true&&this.draw_y_labels(i,this.width-
+this.options.x_padding)}}};return b}(w);r.LineChart=v;var Y,Z,$;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};Z=function(g,b,a){return{label:g,raw_value:b,index_value:a}};$=function(g,b,a){return{label:g,index_value:b,opacity:a}};Y=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new O(c));this.effects=new I(this.r);this.bars=[];this.guides=
+[];this.index=100}s(b,g);b.prototype.add=function(a,c,d){return this.bars.push(Z(a,c,d))};b.prototype.add_guide_line=function(a,c,d){if(d==null)d=1;return this.guides.push($(a,c,d))};b.prototype.add_raw_label=function(a){var c,d=this;c=(new E(this.r)).x(function(){return d.width-10}).y(function(e){return e*15+15}).size(this.options.label_size).attr({fill:"#333","text-anchor":"end","font-weight":"bold"});c.draw(a);return c.draw("(raw value)").attr({"font-weight":"normal","font-size":10})};b.prototype.set_bar_height=
+function(){return this.bar_height=(this.height-this.options.y_padding)/this.bars.length-this.options.bar_margin};b.prototype.set_threshold=function(){var a,c;c=function(){var d,e,f,h;f=this.guides;h=[];d=0;for(e=f.length;d<e;d++){a=f[d];h.push(a.index_value)}return h}.call(this);return this.threshold=Math.max.apply(Math.max,c)};b.prototype.format_tooltip=function(a){return a/100+"x"};b.prototype.draw_raw_bar=function(a,c){var d,e;d=Math.floor(7);e=this.options.x_padding_right-10;this.r.rect(this.width-
+e,c-d,this.width-this.options.x_padding_right,this.bar_height+14,this.options.rounding).attr({fill:this.options.raw_value_bar_color,stroke:"none"});return this.effects.straight_line(new m(this.width-e,this.options.y_padding-10),new m(this.width-e,this.height)).attr({stroke:"rgba(0,0,0,0.25)","stroke-width":0.1})};b.prototype.draw_bg_bar=function(a,c,d){c(a);c=this.options.bg_bar_padding;a=Math.floor(c/2);return this.r.rect(this.options.x_padding-a,d-a,this.width,this.bar_height+c,this.options.rounding).attr({fill:this.options.bar_bg_color,
+stroke:"none"}).toBack()};b.prototype.shade_bar=function(a,c){if(c==null)c=this.options.bar1_color;a.attr({fill:c,stroke:"none"});this.effects.one_px_shadow(a);return this.effects.one_px_highlight(a)};b.prototype.render_bar=function(a,c,d,e){if(e==null)e=this.options.bar1_color;a=this.r.rect(a,c,d,this.bar_height,this.options.rounding);this.shade_bar(a,e);return a};b.prototype.draw_bar=function(a,c,d){var e,f,h;h=c(x.threshold(a,this.threshold));if(a>this.index){e=c(this.index);c=this.render_bar(this.options.x_padding,
+d,e-this.options.x_padding);d=this.render_bar(e,d,h-e,this.options.bar2_color);f=new C(this.r,d,this.format_tooltip(a));f.translate(d.getBBox().width/2,0);c.mouseover(function(){return f.show()});return c.mouseout(function(){return f.hide()})}else{d=this.render_bar(this.options.x_padding,d,h-this.options.x_padding);f=new C(this.r,d,this.format_tooltip(a));return f.translate(d.getBBox().width/2,0)}};b.prototype.draw_guide_line=function(a,c,d,e){var f,h;if(e==null)e=1;h=new m(d,this.options.y_padding);
+f=new m(d,this.height);this.effects.vertical_dashed_line(h,f,this.options.dash_width).attr({fill:"rgba(0,0,0,"+e+")",stroke:"none"});e=(new E(this.r)).x(function(){return d}).y(function(i){return i*15+15}).size(this.options.label_size).attr({fill:"rgba(0,0,0,"+e+")"});e.draw(a).attr({"font-weight":"bold"});return e.draw(c).attr({"font-size":10})};b.prototype.sort_bars_by_index=function(){var a,c;c=function(){var d,e,f,h;f=this.bars;h=[];d=0;for(e=f.length;d<e;d++){a=f[d];h.push(a)}return h}.call(this);
+c.sort(function(d,e){return e.index_value-d.index_value});return c};b.prototype.clear=function(){b.__super__.clear.call(this);this.bars=[];return this.guides=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l,o,n,p,q=this;this.set_bar_height();this.set_threshold();h=this.bar_height+this.options.bar_margin;d=this.bar_height/2;l=this.options.y_padding;j=this.options.x_padding;c=(new E(this.r)).y(function(u){return u*h+l+d}).x(function(){return j-30}).size(12).attr({fill:"#fff","text-anchor":"end"});
+f=(new E(this.r)).y(function(u){return u*h+l+d}).x(function(){return q.width-10}).size(this.options.label_size).attr({fill:"#333","text-anchor":"end"});i=(new A).domain([0,this.threshold]).range([this.options.x_padding,this.width-this.options.x_padding_right]);k=function(u){return u*(q.bar_height+q.options.bar_margin)+q.options.y_padding};p=this.sort_bars_by_index();e=o=0;for(n=p.length;o<n;e=++o){a=p[e];this.draw_bg_bar(a.index_value,i,k(e));this.draw_raw_bar(a.raw_value,k(e));this.draw_bar(a.index_value,
+i,k(e));f.draw(a.raw_value);a=c.draw(a.label);this.effects.black_nub(a)}o=this.guides;n=[];f=0;for(k=o.length;f<k;f++){c=o[f];n.push(this.draw_guide_line(c.label,c.index_value,i(c.index_value),c.opacity))}return n};return b}(w);r.IndexChart=function(g,b){return new Y(g,b)};var y;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};y=function(g,b,a,c){return{label:g,value:b,
+average:a,comparison:c}};v=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new N(c));this.bars=[]}s(b,g);b.prototype.add=function(){return this.bars.push(y.apply(y,arguments))};b.prototype.draw_background=function(a,c){return this.r.rect(this.options.x_padding,c,a.x,this.options.area_width).attr({fill:this.options.area_color,stroke:"none"})};b.prototype.draw_line=function(a,c){return this.r.rect(this.options.x_padding,c.y-this.options.line_width/2,a.x,this.options.line_width).attr({fill:this.options.line_color,
+stroke:"none"})};b.prototype.draw_average=function(a,c){return this.r.rect(a.x-this.options.average_width/2,c-this.options.average_height/2,this.options.average_width,this.options.average_height).attr({fill:this.options.average_color,stroke:"none"})};b.prototype.draw_label=function(){};b.prototype.clear=function(){b.__super__.clear.call(this);return this.bars=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l;k=this.bars;l=[];a=i=0;for(j=k.length;i<j;a=++i){y=k[a];e=[new m(y.comparison,0),new m(y.value,
+0),new m(y.average,0),new m(0,0)];d=x.get_ranges_for_points(e);c=d[0];d=d[1];h=(new A).domain([d,c]).range([this.options.x_padding,this.width-this.options.x_padding]);c=function(){var o,n,p;p=[];o=0;for(n=e.length;o<n;o++){f=e[o];p.push(new m(h(f.x),0))}return p}();d=a*(this.options.area_width+this.options.bar_margin);this.draw_background(c[0],d);a=d+this.options.area_width/2;this.draw_line(c[1],new m(c[0].x,a));this.draw_average(c[2],a);l.push((new z(this.r,0,d+this.options.area_width/2,y.label,
+"",this.size=14,this.options.font_family)).draw())}return l};return b}(w);r.BulletChart=v;t={}.hasOwnProperty;s=function(g,b){function a(){this.constructor=g}for(var c in b)if(t.call(b,c))g[c]=b[c];a.prototype=b.prototype;g.prototype=new a;g.__super__=b.prototype;return g};w=function(g){function b(a,c){if(c==null)c={};b.__super__.constructor.call(this,a,new G(c));this.effective_height=this.height-this.options.y_padding;this.bar_options=[];this.bars=[];this.values=[]}s(b,g);b.prototype.add=function(a){var c,
+d;c=a.label;d=a.value;this.bar_options.push(G.merge(this.options,a.options));this.values.push(d);return this.bars.push({label:c,value:d})};b.prototype.render_bar=function(a,c,d,e){this.r.rect(d.x,d.y,this.options.bar_width,this.effective_height-d.y,this.options.rounding).attr({fill:e.bar_color,stroke:"none"});(new z(this.r,d.x+this.options.bar_width/2,this.height-(this.options.x_label_size+5),a,"",this.options.x_label_size,this.options.font_family,this.options.x_label_color)).draw();return(new z(this.r,
+d.x+this.options.bar_width/2,d.y-this.options.y_label_size-5,c,"",this.options.y_label_size,this.options.font_family,this.options.y_label_color)).draw()};b.prototype.clear=function(){b.__super__.clear.call(this);this.bars=[];return this.values=[]};b.prototype.draw=function(){var a,c,d,e,f,h,i,j,k,l,o,n,p=this;e=function(){var q,u,L,M;L=this.values;M=[];c=q=0;for(u=L.length;q<u;c=++q){i=L[c];M.push(new m(c,i))}return M}.call(this);e.push(new m(0,0));d=x.get_ranges_for_points(e);a=d[2];d=d[3];j=(new A).domain([d,
+a]).range([this.options.y_padding,this.height-this.options.y_padding]);d=function(q){return p.height-j(q)};o=this.bars;n=[];c=k=0;for(l=o.length;k<l;c=++k){a=o[c];f=c*(this.options.bar_width+this.options.bar_spacing)+this.options.x_padding;h=d(e[c].y);f=new m(f,h);n.push(this.render_bar(a.label,a.value,f,this.bar_options[c]))}return n};return b}(w);r.BarChart=w});})();
View
2 examples/examples.js
@@ -283,7 +283,7 @@ $(document).ready(function() {
});
multi_axis_zeros.add_line({
- data: [[1, 0],[2, 0, {tooltip: "custom tooltip"}],[3, 0, {no_dot: true }],[4, 0, {no_dot: true}],[5, 0],[6, 0],[7, 0]],
+ data: [[1, 0],[2, 0, {tooltip: "custom tooltip", show_dot: true}],[3, 0, {no_dot: true }],[4, 0, {no_dot: true}],[5, 0],[6, 0],[7, 0]],
options: {
line_color: colors[0],
dot_color: colors[0],
View
7 src/coffeescript/charts/line.coffee
@@ -70,12 +70,17 @@ class Line
min_point = i if raw_point.y < raw_points[min_point].y
dot = new Dot(@r, point, @options)
+ tooltip = new Tooltip(@r, dot.element, raw_point.options.tooltip || raw_point.y)
dots.push dot
- tooltips.push new Tooltip(@r, dots[i].element, raw_point.options.tooltip || raw_point.y)
+ tooltips.push tooltip
if raw_point.options.no_dot == true
dot.hide()
+ if raw_point.options.show_dot == true
+ dot.activate()
+ tooltip.show()
+
if @options.label_max
tooltips[max_point].show()
dots[max_point].activate()

0 comments on commit be9c1fc

Please sign in to comment.
Something went wrong with that request. Please try again.