how can I use d3 to display a div at a fixed position over an svg?

11 views
Skip to first unread message

d3guy

unread,
Jan 11, 2017, 2:46:12 PM1/11/17
to d3-js
I have a d3 implementation which displays hover panels over elements on user mouseover. I have a new requirement to display a summary panel of the same style towards the lower right-hand corner of the svg.  Here's the d3 code that I use to display the onmouseover hover panels:

d3.select('UnitedStatesTotalPanel').style("top", (d3.event.pageY-10)+"px").style("left",(d3.event.pageX+10)+"px");

Is it possible to adapt this code to display a div over the svg in a fixed position?  The problem is that the code above is based on the occurence of an event so it seems that this code will need to be adapted or changed to accomodate a one-time display of a div.

Vlado Z

unread,
Jan 13, 2017, 10:04:24 AM1/13/17
to d3-js
I believe you can position html tags with CSS. Set a class to your div and then create CSS rule that positions it over a svg tag.
Reply all
Reply to author
Forward
0 new messages