Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

Bug: overlapping words #15

Open
drag0s opened this issue Mar 18, 2019 · 2 comments
Open

Bug: overlapping words #15

drag0s opened this issue Mar 18, 2019 · 2 comments

Comments

@drag0s
Copy link

drag0s commented Mar 18, 2019

Hey there! 馃憢

Sometimes I experience overlapping words like in this picture:

image

Is there anything I can do to avoid overlapping words?

The code from the screenshot: (https://stackblitz.com/edit/react-tag-cloud-dqfvdv?file=App.js)

<TagCloud
        style={{
          fontFamily: 'sans-serif',
          color: 'blue',
          width: '100%',
          height: '400px',
        }}
>
        <div style={{fontSize: 20}}>easy</div>
        <div style={{fontSize: 20}}>income</div>
        <div style={{fontSize: 20}}>platform</div>
        <div style={{fontSize: 20}}>streamers</div>
        <div style={{fontSize: 20}}>asd</div>
        <div style={{fontSize: 70}}>money</div>
        <div style={{fontSize: 20}}>communication</div>
        <div style={{fontSize: 20}}>audience</div>
        <div style={{fontSize: 20}}>nice</div>
        <div style={{fontSize: 20}}>logos</div>
        <div style={{fontSize: 20}}>twitch</div>
        <div style={{fontSize: 20}}>stream</div>
</TagCloud>

Thanks in advance!

@drag0s drag0s changed the title How to avoid overlapping words Bug: overlapping words Mar 20, 2019
@shp7724
Copy link

shp7724 commented Jul 12, 2020

Same here.
Seems like it's failing to calculate the positions of word, unlike the demo.

image

@dkadrios
Copy link

dkadrios commented Apr 7, 2021

I ran into this as well, but I managed to get it working in the end. For me, it was the ommision of some things from the demo which seemed superfluous at the time, along with using the material-ui style system, rather than inline styles.

The inline styles on the WordCloud tag are necessary as it appears that the underlying d3-cloud component uses it to determine metrics. In particular, it needs fontSize and padding (and maybe more?). Setting these through className did not work, it had to be set through style.

HTH

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

3 participants