Giter VIP home page Giter VIP logo

Comments (12)

ajm113 avatar ajm113 commented on July 26, 2024 2

An easy way to fix this issue is to 'normalize' the array of word's weights. So that the range of weight can only be 10-20, 10-50, etc.. So your not plugging in raw weights, that may cause the browser to crash or have that particular line return 'null'.

Would be nice if the library normalized the weights for you. ;)

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

Thanks for filing!

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

Oh crap, I can actually crash the tab on Chrome with your code here ...

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

... and Firefox hangs w/o any way to recover. I would have to kill the browser.

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

I now concluded this is a bug of the browser, or even the canvas API, but not on the library side. The browsers died at getImageData() call presumably the large TypedArray data flood into the memory.

I'll file bugs on Firefox and Chrome.

There is no way in JavaScript to know the size limit of the array, or canvas. The way to fix this here would be expose a config allowing people to set a size limit, but again, deciding that limit will be a problem.

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

Sorry for the delay, Firefox bug filed https://bugzilla.mozilla.org/show_bug.cgi?id=952909

from wordcloud2.js.

speg avatar speg commented on July 26, 2024

+1 what's the safe way to work around this? I get the same error even with small values, if they come after an even smaller value. e.g., [..., ['Foo', 10], ['Bar', 11]]

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

Maybe your canvas is too big so the resulting pixel size of word to draw need to be big? Maybe your weightFactor is set too big?

I don't have a way to workaround this, as I previously stated.

from wordcloud2.js.

JacquiManzi avatar JacquiManzi commented on July 26, 2024

I personally have not run into this issue with count values as small as the ones in speg's comment, but have run into it with much larger values. The way I safely got around this was to pick a max count value that would not cause the browser to crash and normalize all count values based on the max value.

As tim suggested, I would definitely make sure your weight factor is not too big as well.

from wordcloud2.js.

Kiel-H-Byrne avatar Kiel-H-Byrne commented on July 26, 2024

Is this still an issue?
My wordcloud crashes servers (i deployed to a meteor server and it crashed that server).
I thought it crashed when the result set was too large, not necessarily because of word size... i have a formula set so the size of the word doesn't get too large. And i only implented that because when the words were too large they would write over the whole screen (behind other dom elements, kinda looked like a nice background feature)

but nevertheless... i'm wondering if large word sets are causing this to crash?

from wordcloud2.js.

timdream avatar timdream commented on July 26, 2024

I don't know how meteor renders canvases on server (maybe w/ a headless WebKit/Chromium?), but I would imagine this issue is still valid.

from wordcloud2.js.

jctelo avatar jctelo commented on July 26, 2024

@ajm113 you're a genious! It worked for me :-)

from wordcloud2.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.