Permalink
Browse files

adjust order of rendering for draw chart

  • Loading branch information...
1 parent 4a6e2c6 commit 9e2fc4a62cd66856aba15aba60171aa4d15a4374 @jcarver989 committed Nov 1, 2012
Showing with 26 additions and 23 deletions.
  1. +3 −3 compiled/charts.js
  2. +17 −17 compiled/charts.min.js
  3. +6 −3 src/coffeescript/charts/line_chart.coffee
View
6 compiled/charts.js
@@ -1588,15 +1588,15 @@ LineChart = (function(_super) {
val = y_coordinates[_j];
paths.push(this.r.path("M " + this.options.x_padding + ", " + val + " L " + width + ", " + val + " Z"));
}
- stroke(paths, "#ccc", 1).toBack();
if (this.options.multi_axis === true && this.line_options.length === 2) {
left_side = this.options.x_padding;
left_stroke = this.r.path("M " + left_side + ", " + this.options.y_padding + " L " + left_side + ", " + height + " Z");
right_side = this.width - this.options.x_padding * 2;
right_stroke = this.r.path("M " + right_side + ", " + this.options.y_padding + " L " + right_side + ", " + height + " Z");
- stroke(left_stroke, this.line_options[0].line_color, 2);
- return stroke(right_stroke, this.line_options[1].line_color, 2);
+ stroke(left_stroke, this.line_options[0].line_color, 2).toBack();
+ stroke(right_stroke, this.line_options[1].line_color, 2).toBack();
}
+ return stroke(paths, "#ccc", 1).toBack();
};
LineChart.prototype.create_scalers = function(points) {
View
34 compiled/charts.min.js
@@ -40,23 +40,23 @@ b-d]]:[["M",g,b-d],["A",d,d,0,+(f>180),1,h,e]]}};W=function(g){function b(a){ret
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;d=a.data;if(!(d.length<1)){e=function(){var h,
-i,j;j=[];h=0;for(i=d.length;h<i;h++){c=d[h];j.push(new l(c[0],c[1]))}return j}();f=this.all_points.length;this.line_indices.push([f,f+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=[];h=function(m,o,n){return m.attr({stroke:o,"stroke-width":n})};e=this.options.multi_axis?this.options.x_padding*2:this.options.x_padding;d=this.height-this.options.y_padding;
-i=this.width-e;e=this.r.set();j=0;for(k=a.length;j<k;j++){f=a[j];e.push(this.r.path("M "+f+", "+this.options.y_padding+" L "+f+", "+d+" Z"))}j=0;for(k=c.length;j<k;j++){f=c[j];e.push(this.r.path("M "+this.options.x_padding+", "+f+" L "+i+", "+f+" Z"))}h(e,"#ccc",1).toBack();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");f=this.width-this.options.x_padding*2;d=this.r.path("M "+f+", "+this.options.y_padding+
-" L "+f+", "+d+" Z");h(e,this.line_options[0].line_color,2);return h(d,this.line_options[1].line_color,2)}};b.prototype.create_scalers=function(a){var c,d,e,f,h,i,j,k,m,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 l(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]);m=(new A).domain([i,f]).range([this.options.y_padding,this.height-this.options.y_padding]);c=function(n){return o.height-m(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,m,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=m=0;for(o=a.length;m<o;f=++m){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 l(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 l(0,e));i+=1}}else{j=e;for(d=this.calc_y_label_step_size(e,h);j<=h;){f.push(new l(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,m,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=m=0;for(o=n.length;m<o;d=++m){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 l(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 l(this.width-e,this.options.y_padding-10),new l(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 l(d,this.options.y_padding);f=new l(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"});
+i,j;j=[];h=0;for(i=d.length;h<i;h++){c=d[h];j.push(new l(c[0],c[1]))}return j}();f=this.all_points.length;this.line_indices.push([f,f+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(m,o,n){return m.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,m,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 l(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]);m=(new A).domain([i,f]).range([this.options.y_padding,this.height-this.options.y_padding]);c=function(n){return o.height-m(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,m,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=m=0;for(o=a.length;m<o;f=++m){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 l(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 l(0,e));i+=1}}else{j=e;for(d=this.calc_y_label_step_size(e,h);j<=h;){f.push(new l(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,m,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=m=0;for(o=n.length;m<o;d=++m){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 l(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 l(this.width-e,this.options.y_padding-10),new l(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 l(d,this.options.y_padding);f=new l(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,m,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;m=this.options.y_padding;j=this.options.x_padding;c=(new E(this.r)).y(function(u){return u*h+m+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+m+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,
View
9 src/coffeescript/charts/line_chart.coffee
@@ -64,7 +64,6 @@ class LineChart extends BaseChart
for val in y_coordinates
paths.push @r.path("M #{@options.x_padding}, #{val} L #{width}, #{val} Z")
- stroke(paths, "#ccc", 1).toBack()
# color the axis for easier reading
if @options.multi_axis == true && @line_options.length == 2
@@ -74,8 +73,12 @@ class LineChart extends BaseChart
right_side = @width - @options.x_padding * 2
right_stroke = @r.path("M #{right_side}, #{@options.y_padding} L #{right_side}, #{height} Z")
- stroke(left_stroke, @line_options[0].line_color, 2)
- stroke(right_stroke, @line_options[1].line_color, 2)
+ stroke(left_stroke, @line_options[0].line_color, 2).toBack()
+ stroke(right_stroke, @line_options[1].line_color, 2).toBack()
+
+
+ # do this last to avoid overwriting the multi axis colors
+ stroke(paths, "#ccc", 1).toBack()
create_scalers: (points) ->
y = undefined

0 comments on commit 9e2fc4a

Please sign in to comment.