Santosh
Santosh

Reputation: 1839

D3 tooltip off the chart

Here is the fiddle.

  divs.on("mousemove", function() {
    var top = (d3.event.pageY) + "px";
    var left = (d3.event.pageX) + "px";
    console.log(top + " " + left);
    tooltip.style("top", top).style("left", left);
  });

I am using d3.event.pageX and pageY to get current position of mouse, but still the tooltip doesnt attach to mouse.

Upvotes: 1

Views: 357

Answers (1)

mgraham
mgraham

Reputation: 6207

In your css rule charts.bar div:hover you have a zoom:150%; line. This balloons out your tooltip's positioning by 50%, so it gets worse the further you move right; when you remove it the tooltip gets better. (You could also try out something like d3.tip (http://bl.ocks.org/Caged/6476579) rather than rolling your own.)

Upvotes: 1

Related Questions