jasondavies / d3-cloud

Create word clouds in JavaScript.
https://www.jasondavies.com/wordcloud/
Other
3.85k stars 1.07k forks source link

Get word coordinates on hover? #141

Closed bogdancss closed 6 years ago

bogdancss commented 6 years ago

I am trying to get the current word coordinates, so I can place a rect behind it on hover.

text.on('mouseover', function(d) { let word = d3.select(this); let bbox = word.node().getBBox(); let boundRect = word.node().getBoundingClientRect(); }

I trying to make sense of these coordinates, but they all seem to be very hectic. Can someone provide any sort of pointers on how to get the current word coordinates in relation the the svg?

jasondavies commented 6 years ago

Sorry, these GitHub issues are for bug reports/feature requests only. Please try StackOverflow if you need general help.