tag:support.nodebox.net,2012-11-01:/discussions/nodebox-2-3/5809-placing-pie-charts-in-a-list-in-orderNodeBox: Discussion 2016-09-29T21:18:21Ztag:support.nodebox.net,2012-11-01:Comment/408695162016-09-29T14:09:09Z2016-09-29T14:09:12ZPlacing pie charts in a list/ in order.<div><p>Hi,</p>
<p>I started with this amazing software 3-4 weeks ago - I'm more
designer than programmer/coder.</p>
<p>I'have found on this forum really nice example of generating pie
chart. Modified this a bit using my CSV file - that works fine.</p>
<p>Started positioning charts and it works ok when I use Grid node,
but my problem is that need to put charts like elements of list
(see attached img). Tried to define each chart position by
resampling e.g. ellipse etc. - but it destroy pieces of each single
chart...</p>
<p>Any idea how to place them like problem-description.jpg ? or
where should I start looking for solution?</p>
<p>All files and description attached.</p></div>Kubatag:support.nodebox.net,2012-11-01:Comment/408695162016-09-29T21:18:18Z2016-09-29T21:18:18ZPlacing pie charts in a list/ in order.<div><p>Hi Kuba,</p>
<p>Welcome to the Nodebox community!</p>
<p>The problem with your current approach is that you are creating
a mass of independent pieces. You have a total of 30 arcs (3 per
pie), 30 center covers, and 10 labels - a total of 70 objects. It
then becomes hard to herd all these objects into the right
place.</p>
<p>A better approach is to make one pie at a time, group each one
into a single object, and then arrange those 10 objects in a
grid.</p>
<p>I have attached a solution. Basically I just combined most of
your current nodes into a single subnetwork called donut. For each
row of the table you feed into it, donut produces one pie chart
complete with center cover and label. If you look inside donut you
will see that the final node is a group node. This is what glues
everything together into a single pie object.</p>
<p>When creating objects like this, there is no need to worry about
positioning them until later. Inside donut everything is centered
at the origin. This simplifies everything.</p>
<p>When you hook donut to the csv node you wind up with 10 donuts
on top of each other. To space them out all you need to do is feed
that list of 10 donuts into a translate node and use a grid to
define the 10 positions.</p>
<p>I could have just used an ordinary grid node. But to make it
general purpose I created another subnetwork called make_grid.
Make_grid takes in the table (in order to count the rows) and a
number (labeled "columns") that controls the number of columns you
want. It then figures out the number of rows, the overall height
needed to space the rows evenly, and then slices the grid to return
just the positions you need. In my example I set columns to 4, so
you get two rows of 4 and third row of 2. Change the value of
columns to see how the layout changes.</p>
<p>Solution network and screenshot attached.</p>
<p>Hope this helps!</p>
<p>John</p></div>john