javascript - D3.js tooltip positioning -
so i'm trying create tooltip on line chart. i've done this
var tooltipdiv = d3.select('body') .append('div') .attr('class', 'tooltip') .style('opacity', 0);
in mouseover function did this-
tooltipdiv.transition() .duration(200) .style("opacity",0.9); tooltipdiv.html( "<div class='tooltip-val'>" + d[model.get('linetitle')] + "</div>" + "<div class='tooltip-date'>" + date + "</div>" ) .style("left", d3.event.pagex + "px") .style("top", d3.event.pagey + "px");
but makes div appear in topleft , never around point @ mouse event happens.
why?
Comments
Post a Comment