Reputation: 3143
I'm working on a visualization and working off of a jsfiddle I found on stackoverflow.
I haven't done D3 before, so I had a couple of questions.
I want to visualize some json like this
{word:"cat", count: 30},
{word:"dog", count: 15}....
I've been working on a jsfiddle here
http://jsfiddle.net/matthewpiatetsky/nCNyE/3/
Any tips would be much appreciated, thank you! (I know I can figure this stuff out myself, and I am doing so slowly, but some examples of how to do these things that I could play around with would be helpful!
Upvotes: 0
Views: 125
Reputation: 109232
The short answer for your first question is that you can't do this automatically with D3. You can try to ensure that this is the case by manually checking the positions of the labels and circles, or by using something like D3's force layout to lay them out automatically without overlap. Either of those options would be quite a bit of work though and in the second case you would have no guarantee that nothing would overlap.
Concerning your second question, you determine the size of the window and set the radius accordingly, e.g. something like
var radius = Math.sqrt(window.innerWidth * window.innerHeight) / 100;
Upvotes: 1