timdream / wordcloud2.js

Tag cloud/Wordle presentation on 2D canvas or HTML
https://wordcloud2-js.timdream.org/
MIT License
2.34k stars 510 forks source link

How to render correct sizes based on order instead of count? #210

Open ivanjaros opened 3 weeks ago

ivanjaros commented 3 weeks ago

In case i have a shorter text, the resulting image will contain tiny words because the occurrence is not as high as in long text(larger sample). I want to consider weighted order as well, not just number of occurrences to avoid this issue.

What would be a good way to solve this?

PS: the weightFactor method is useless because the words won't fill the entire canvas. PPS: right now I check if first/largest value is at least 15, if not, i will multiply all values by 15. This kinda works but I would prefer for properly weighted order to take precedence over this kinda random approach.