Placing pie charts in a list/ in order.

Kuba's Avatar

Kuba

29 Sep, 2016 02:09 PM

Hi,

I started with this amazing software 3-4 weeks ago - I'm more designer than programmer/coder.

 I'have found on this forum really nice example of generating pie chart. Modified this a bit using my CSV file - that works fine.

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...

Any idea how to place them like problem-description.jpg ? or where should I start looking for solution?

All files and description attached.

  1. Support Staff 1 Posted by john on 29 Sep, 2016 09:18 PM

    john's Avatar

    Hi Kuba,

    Welcome to the Nodebox community!

    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.

    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.

    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.

    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.

    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.

    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.

    Solution network and screenshot attached.

    Hope this helps!

    John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • PieCharts.zip 227 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

18 Oct, 2019 01:06 AM
10 Oct, 2019 01:11 AM
02 Oct, 2019 09:51 PM
30 Sep, 2019 08:21 AM
29 Sep, 2019 02:02 PM

 

03 Sep, 2019 01:35 AM
24 Aug, 2019 03:14 AM
08 Aug, 2019 04:13 AM
02 Aug, 2019 09:27 PM
18 Jul, 2019 10:05 AM
12 Jul, 2019 10:39 PM