timdream / wordcloud2.js

Tag cloud/Wordle presentation on 2D canvas or HTML

Home Page:https://wordcloud2-js.timdream.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add more data to the callbacks (color, classes and fontWeight )

adrienpwd opened this issue · comments

Hi !
Thank you for this great wordcloud.
I would like to propose an enhancement for the color, classes and fontWeight callbacks.
Like the hover and click event, I think the other callbacks should all have access to the item data.
Instead of only having word and weight they should also have access to any additional data we pass in the 2d array.
I already have a PR for it, but I'm not sure how to run the project locally so I can make sure the changes I made are fully functional. For now I run the wordcloud.js file directly in my project and it seems okay, but I don't use all the features.

This will allow us to make a better use of the callbacks. In my case I needed to get the color from the extra data ([["word1", 23, "#000"], ["word2", 50, "#FFF"])

Sounds good as long as there are no breaking changes.

Sounds good. By the way, do I need write access on the project to open a PR ?

No you do not

Hi there !
Thanks for the quick review and merge.
I'm wondering if I should have increased the version number in the PR.
When I pull the library in my project I don't see the changes I made.

I will push a version soon.