Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting font sizes dynamically based on height and width of container. #115

Closed
saikiriti opened this issue Feb 8, 2017 · 2 comments
Closed

Comments

@saikiriti
Copy link

Currently I am plotting word cloud chart by assigning maximum font size to most occurring word and minimum font size to least occurring word and calculating font size of of all intermediate words using formula:
fontSize = (currentCount / maxCount) * (maxFont - minFont) + minFont;
where currentCount is number of occurrence of a particular word and
maxCount is number of occurrence of maximum occurring word.

Currently the min and max font sizes are hard coded.

When dimensions of container are dynamically changed or resized, i am unable to plot most occurring words with maxFont size that is set initially. Because the min and max font size may not be the best fit for all container dimensions. So we need a calculation or formula where we can calculate min and max font sizes for each different dimensions instead of manually setting them.

Questions & Problems to fix:

  1. How to set font sizes differently for each plot area based on width and height?
  2. If not set different font sizes the most occurring words are missing from the chart and is not consistent across various plot area dimensions.
  3. Is there any other approach to make most occurring word with max font size visible for all dimensions other than using overflow(true) ?

Sample Fiddle: https://jsfiddle.net/h7u5k1ab/4/

@jasondavies
Copy link
Owner

Thanks for the report. I’m closing as a duplicate of #36, as this would be solved by auto-scaling internally to ensure no words are dropped.

@vishalsomaniecotech
Copy link

Auto-scaling does not consider frequency of word. Font size should depend on container size and word frequency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants