Browse Source

Fix xgrid focus when rotated

pull/1/head
Masayuki Tanaka 12 years ago committed by masayuki
parent
commit
ce214de3c8
  1. 12
      c3.js

12
c3.js

@ -765,10 +765,10 @@
.attr("class", "xgrid-focus") .attr("class", "xgrid-focus")
.append('line') .append('line')
.attr('class', 'xgrid-focus') .attr('class', 'xgrid-focus')
.attr("x1", -10) .attr("x1", __axis_rotated ? 0 : -10)
.attr("x2", -10) .attr("x2", __axis_rotated ? width : -10)
.attr("y1", margin.top) .attr("y1", __axis_rotated ? -10 : margin.top)
.attr("y2", height) .attr("y2", __axis_rotated ? -10 : height)
} }
// Y-Grid // Y-Grid
@ -862,8 +862,8 @@
main.selectAll('line.xgrid-focus') main.selectAll('line.xgrid-focus')
.style("visibility","visible") .style("visibility","visible")
.data([selectedData[0]]) .data([selectedData[0]])
.attr('x1', function(d){ return x(d.x) }) .attr(__axis_rotated ? 'y1' : 'x1', function(d){ return x(d.x) })
.attr('x2', function(d){ return x(d.x) }) .attr(__axis_rotated ? 'y2' : 'x2', function(d){ return x(d.x) })
// Set tooltip // Set tooltip
tooltip.style("top", (d3.mouse(this)[1] + 30) + "px") tooltip.style("top", (d3.mouse(this)[1] + 30) + "px")

Loading…
Cancel
Save