jasondavies / d3-cloud

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

Link / Action for each word #173

Open magicpauluk opened 2 years ago

magicpauluk commented 2 years ago

This is ideal for a project I am working on. I wondered if anyone had applied an action or hyperlink to the words?

jasondavies commented 2 years ago

This should be straightforward: you can use HTML hyperlink elements or add event listeners to SVG.

jasondavies commented 2 years ago

Actually, I'll leave this open as it may be helpful to create an example or add this feature to my app.

CappuccinoAaron commented 2 years ago

You can add ".attr("onclick", function(d) { return "window.open('You URL')"; })" in js 'draw' function.

nickde9999 commented 3 months ago

Is there a way to add the word to the url ? If I add + d.word it says d is not defined

mypeaceduck commented 1 month ago

This should be straightforward: you can use HTML hyperlink elements or add event listeners to SVG.

How to track clicks on a word?