wordcloud2.js icon indicating copy to clipboard operation
wordcloud2.js copied to clipboard

Noting is showing up

Open aaronucsd opened this issue 10 years ago • 10 comments

I tried what was in the Simple usage, but still nothing showing up. < div id="my_canvas" >< /div > < script > var list = [['foo', 12], ['bar', 6]]; WordCloud(document.getElementById('my_canvas'), { list: list } ); < /script >

aaronucsd avatar Jun 26 '15 20:06 aaronucsd

Looks like you need to give the div with the id 'my_canvas' a defined dimensions (w + h). Could you please add this into your usage? It's obvious but not to everyone. Also, can you have more usages/examples? From the demo i'm not able to see how you did it in code. Thanks.

aaronucsd avatar Jun 26 '15 20:06 aaronucsd

Looks like you need to give the div with the id 'my_canvas' a defined dimensions (w + h). Could you please add this into your usage? It's obvious but not to everyone. Also, can you have more usages/examples? From the demo i'm not able to see how you did it in code. Thanks.

Sounds reasonable. Would you like to submit a pull request to patch README for that? Thanks!

timdream avatar Jun 26 '15 20:06 timdream

Sure. Thanks.

aaronucsd avatar Jun 26 '15 20:06 aaronucsd

Btw, i tested with the array below and only HTTP shows up on the rendering. Why not 'foo' and 'bar'? It's a good size display 100%x500px.

this.list = [['foo', 868], ['bar', 832], ['HTTP', 77]];

@timdream Any ideas? Thanks.

aaronucsd avatar Jun 26 '15 22:06 aaronucsd

For others seeing this post, I had this problem (items not showing up). It's because the size is the font size, not an arbitrary number. Try normalising your size values to sensible font sizes.

I think this issue is covered in issue #53

timcroydon avatar Jan 08 '16 15:01 timcroydon

This element div.#my_canvas must have height and width

MiduoWiki avatar May 03 '17 07:05 MiduoWiki

i have the same issue, at the first time, the whole page is blank, and i modify the num in list to sensible font sizes. it does work. but there are still some words lost..

liz282907 avatar Feb 02 '18 09:02 liz282907

I have the same issue, even i gives the same attributes with the official website. I have not find out the reason.someone can help? let option = { list: [['Les Misérables', '20'], ['Victor Hugo', '20']], gridSize: 18, weightFactor: 3, fontFamily: 'Average, Times, serif', backgroundColor: '#333' }; wordcloud(containerEl, option);

lyqline avatar Feb 05 '18 07:02 lyqline

I have found out the reason why nothing has shown.We need to set weightFactor: 1.If weightFactor is too big ,we need to set the attribute drawOutOfBound for true.

lyqline avatar Feb 05 '18 07:02 lyqline

Having a defined width and height makes everything unscalable. i.e. With a response page that changes the size of elements with window size, the word cloud will eventually draw out of bounds. Rather than scale with the space. Using canvas, if you don't specify height, the canvas will scale nicely and the wrapping element height will fit the canvas.

ryanbooker avatar Mar 15 '18 07:03 ryanbooker