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

Multi-centers word cloud (or sub-clouds support) #98

Open
jenkin opened this issue Jul 22, 2016 · 3 comments
Open

Multi-centers word cloud (or sub-clouds support) #98

jenkin opened this issue Jul 22, 2016 · 3 comments
Labels

Comments

@jenkin
Copy link

jenkin commented Jul 22, 2016

At this moment, fixing the size of the available space for the cloud, it will be positioned at the center of this container (you can translate your g container where you want into the svg, of course).

But I need a sort of clustered word cloud, or a multi-centers word cloud, with words positioned into sub-clouds, without use several layout instances and containers. Sub-clouds centers are attributes of words.

Here you can see my solution to this problem: https://jenkin.github.io/d3-cloud/examples/ (code here).

There are two new public methods: center() to set the getter function (default: return center attribute of word, if any) and ratio() to control the aspect ratio of sub-clouds. Now there are also a local (and word-based) size, equal to the minimum distance of the center from boundaries.

What do you think? My final goal is drawing a word cloud map, with centers coming from projection of locations.

@jenkin
Copy link
Author

jenkin commented Jul 22, 2016

Uh, maybe it's related to issue #8 ... :)

@jenkin
Copy link
Author

jenkin commented Jul 22, 2016

EDIT: now I use a square() method instead of the ratio() one to force a sub-cloud to be square. The center() method accept also a static value (an array of two coordinates) to center the cloud in any location into the viewport. If it is a function taking a value from word data, then you have sub-clouds.

@wdss93
Copy link

wdss93 commented Apr 1, 2019

Perfect! @jenkin

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

No branches or pull requests

3 participants