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

Tags disappearing from tagcloud highcharts while using deriveFontSize method #7491

Closed
vbivinothk opened this Issue Dec 5, 2017 · 13 comments

Comments

Projects
None yet
6 participants
@vbivinothk
Copy link

vbivinothk commented Dec 5, 2017

Expected behaviour

When using deriveFontSize method in highcharts tagcloud all tags should return a fontSize based on maxFontSize.

Actual behaviour

When executing the code again and again in the fiddle some of the tags are disappearing.The code is working correctly when Highcharts.seriesTypes.wordcloud.prototype.deriveFontSize method is not included. code goes here.

Highcharts.seriesTypes.wordcloud.prototype.deriveFontSize = function(relativeWeight) {
  var maxFontSize = 55;
  // Will return a fontSize based on maxFontSize.
  var rWeight = Math.floor(maxFontSize * relativeWeight);
  var size = rWeight < 1 ? 1 : rWeight;
  return size;
};

It will be working when the maxFontSize value lesser than 20.
issue_tc_1

Live demo with steps to reproduce

fiddle

Affected browser(s)

Chrome 62.0.3202.84

@KacperMadej

This comment has been minimized.

Copy link
Contributor

KacperMadej commented Dec 5, 2017

Hi,

Thank for reporting about the problem.
It's because there's not enough space for the words and some are not added.

@KacperMadej

This comment has been minimized.

Copy link
Contributor

KacperMadej commented Feb 27, 2018

@jon-a-nygaard Looks like the playing field is too small. The chart is scaled later, so all fits. The number 256 is hard coded and placed in a not accessible function. I've changed it to 1e6 and words might be small, but fits for this case:
Demo: http://jsfiddle.net/BlackLabel/ewyLur53/

And another that I recently received through support:
Problem: http://jsfiddle.net/BlackLabel/0kc6z2h4/3/
Resolved: http://jsfiddle.net/BlackLabel/0kc6z2h4/2/

@jon-a-nygaard jon-a-nygaard added this to the v6.0.8 milestone Feb 28, 2018

@jon-a-nygaard

This comment has been minimized.

Copy link
Member

jon-a-nygaard commented Feb 28, 2018

What you are saying @KacperMadej is correct, the playing field is too small in some cases.
Your workaround works fine when placementStrategy is 'center', but will likely give a very fragmented visualization when placementStrategy is 'random' or when someone is using a similar custom strategy.

I am currently working on a bugfix which implements a smarter algorithm for the playing field - which will take into account the size of the words and decide how big the field needs to be.
That will fix this issue and should provide a better result in all use cases.

I will prioritize this issue so that we can have a fix implemented in the next maintenance release.

@FloPrey

This comment has been minimized.

Copy link

FloPrey commented Mar 5, 2018

Hi @jon-a-nygaard,

can you give us an ETA when this next maintenance release is, as we would need this fixes for our wordcloud to work?

@jon-a-nygaard

This comment has been minimized.

Copy link
Member

jon-a-nygaard commented Mar 6, 2018

Hi @FloPrey, we do not have a specific date for the next release. We try to release a maintenace approximately once a month. So I would say the ETA is within 2-3 weeks.

In the mean time it is possible for you to use a custom build from https://github.highcharts.com/modules/wordcloud.js.
Here's a example of usage with a direct link, but I recommend that you host the file yourself as github.highcharts.com is meant for testing purposes.

Let me know if there is anything else I can assist with.

Best regards
Jon

@AmmyXu

This comment has been minimized.

Copy link

AmmyXu commented Jul 18, 2018

Hi @jon-a-nygaard,
The problem of dropping words still exists, even when referring to the latest version of the wordcloud.js (https://github.highcharts.com/modules/wordcloud.js.).

For the time being, we are using the previously mentioned solution to solve the problem of missing words. ( http://jsfiddle.net/BlackLabel/0kc6z2h4/2/)

But we find another problem of word occlusion with Chinese words.(Demo: http://jsfiddle.net/0kc6z2h4/29/).

we hope you can provide a solution to the problem of word dropping and word occlusion as soon as possible. Thanks.

Best regards
AmmyXu

@jon-a-nygaard

This comment has been minimized.

Copy link
Member

jon-a-nygaard commented Jul 31, 2018

Hi @AmmyXu,

Do you have an example of the case where the words are dropped?

I tested both examples you provided in your comment against the latest version v6.1.1, and they seem fine:

Best regards
Jon

@AmmyXu

This comment has been minimized.

Copy link

AmmyXu commented Jul 31, 2018

Hi @jon-a-nygaard,

There is no occlusion problem with the latest version v6.1.1, but some characters will be dropped when the panel shrinks: http://jsfiddle.net/jon_a_nygaard/w9Lx2yv1/

Best regards
AmmyXu

@AmmyXu

This comment has been minimized.

Copy link

AmmyXu commented Aug 21, 2018

Hi @jon-a-nygaard,
Has the problem been solved?
Some words are lost when the canvas is scaled.
For example,in the demo below, “word2” is missing.
Demo: http://jsfiddle.net/w9Lx2yv1/4/
image
image

@pawelfus

This comment has been minimized.

Copy link
Contributor

pawelfus commented Aug 23, 2018

Hi @AmmyXu

Thanks for pointing this out. It looks like fixed width for the chart is required to recreate the issue: http://jsfiddle.net/BlackLabel/w9Lx2yv1/10/ - let me reopen this issue.

@pawelfus pawelfus reopened this Aug 23, 2018

@AmmyXu

This comment has been minimized.

Copy link

AmmyXu commented Aug 23, 2018

Hi @pawelfus
Thanks for your quick reply.
We are the paying users of HighCharts. This problem has a great impact on the display of word cloud. May I ask how long it will take to solve this problem?

@jon-a-nygaard

This comment has been minimized.

Copy link
Member

jon-a-nygaard commented Aug 24, 2018

Hi @AmmyXu, I will a look into it today and see if I can provide a fix for this.

It is a bit difficult to give an ETA for this since next maintenance release will likely come in next week. If I am able to provide a fix before that, then it will be available in next week, otherwise it will take some longer before it is available.

@jon-a-nygaard

This comment has been minimized.

Copy link
Member

jon-a-nygaard commented Aug 27, 2018

Hi @AmmyXu,

I've found a solution which seems to work well to solve the problem. Currently working on adding unit-tests for the new code, but it looks promising in regards to have it shipped with the next maintenance release.

Here's the previous demo running with the updated wordcloud: http://jsfiddle.net/jon_a_nygaard/k4p5vo38/

You can load and test the new wordcloud source file from https://github.highcharts.com/master/modules/wordcloud.src.js

EDIT: updated url to source file after the PR has been merged into master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.