From 0ec2bcc6d0705b07f74ea3409653a74214c8e6ba Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 21 May 2013 16:58:31 +0900 Subject: [PATCH] Fix trivial --- c3.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/c3.js b/c3.js index 354f7ed..8d78763 100644 --- a/c3.js +++ b/c3.js @@ -484,6 +484,13 @@ function classCircle (d,i) { return classShape(d,i) + " __circle __circle-" + i } function classBar (d,i) { return classShape(d,i) + " __bar __bar-" + i } + function xx (d) { + return x(d.x) + } + function yv (d) { + return y(d.value) + } + //-- Circle --/ function circleX (d) { @@ -784,8 +791,8 @@ .attr("class", function(d){ return "ygrid-line " + d['class'] }) .attr("x1", 0) .attr("x2", width) - .attr("y1", function(d){ return y(d.value) }) - .attr("y2", function(d){ return y(d.value) }) + .attr("y1", yv) + .attr("y2", yv) } // Area @@ -862,8 +869,8 @@ main.selectAll('line.xgrid-focus') .style("visibility","visible") .data([selectedData[0]]) - .attr(__axis_rotated ? 'y1' : 'x1', function(d){ return x(d.x) }) - .attr(__axis_rotated ? 'y2' : 'x2', function(d){ return x(d.x) }) + .attr(__axis_rotated ? 'y1' : 'x1', xx) + .attr(__axis_rotated ? 'y2' : 'x2', xx) // Set tooltip tooltip.style("top", (d3.mouse(this)[1] + 30) + "px") @@ -1153,8 +1160,8 @@ } if (withY && __grid_y_lines) { main.select('.ygrid-lines').selectAll('.ygrid-line') - .attr("y1", function(d){ return y(d.value) }) - .attr("y2", function(d){ return y(d.value) }) + .attr("y1", yv) + .attr("y2", yv) } // bars