Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Vis hangs trying to wrap awkward labels. #3429

Open
sawatts opened this issue Sep 8, 2017 · 4 comments
Open

Vis hangs trying to wrap awkward labels. #3429

sawatts opened this issue Sep 8, 2017 · 4 comments

Comments

@sawatts
Copy link

sawatts commented Sep 8, 2017

We can set a maximum width in the attributes of a node, group, or global options, and the documentation states that the labels will wrap on spaces to keep within the limit.

I have observed that labels that do not contain spaces force the node to be wider than the maximum. Thats fine - perhaps should be mentioned in the documentation though.

However there is an issue where a label contains spaces, but also contains words which are wider than the maximum. This appears to cause Vis to hang / go into an endless loop.

The following jsbin will demonstrate this - uncomment the maximum width from the options in the code and the script will hang. This example includes:

  • "Short" label should be fine.
  • "Long Label with Spaces in it" is wrapped on spaces.
  • "LONG_LABEL_WITHOUT_ANY_SPACES_AT_ALL" isn't wrapped and displays longer than the max.
  • "Lets talk about Antidisestablishmentarianism again." goes horribly wrong when max is set!

Presumably Vis is doing a check whether there are any spaces, but isn't doing a check on the word lengths thereafter?

@wimrijnders
Copy link
Contributor

Interesting. this should have been fixed with #3228, but you found a combination which breaks it again.

It's the fourth which causes the infinite loop of course. The third I don't consider to be too critical, however the mentioned PR should have fixed that as well. Back to the drawing board.

Thanks for reporting!

@wimrijnders
Copy link
Contributor

wimrijnders commented Sep 13, 2017

The good news is that this has indeed been fixed with #3228:

download

The bad news is that this fix has not been released yet; that was my confusion in my previous comment. You'll have to wait for the next release for the fix; if this fix is of critical importance to you, I can provide you an interim build of the develop-branch.

@wimrijnders
Copy link
Contributor

Duplicate of #3171.

@wimrijnders
Copy link
Contributor

@sawatts vis.js v4.21.0 has just been released. Would you mind checking that the labels render as expected now?

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

No branches or pull requests

2 participants