The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

NodeBox 3From the old forum

Number to color

4 replies Last reply

  1. Hello,

    I am new to nodebox and I am experimenting with it. I remade my own data visualization with a tutorial I found. I wanna add colors to the rectangles if a certain number is lower than one another. So I am calculating BMI and I want the rectangle to go a certain color.

    When the number is:

    Between 16 - 18,5 Red
    Between 18,5 - 25 Orange
    Between 25 - 30 Green
    Between 30-40 Orange
    Bigger than 40 Red

    I just cannot seem to figure it out since my coding is kinda bad.

    Appreciating all help!

  2. Hi rioch,

    I gave it a shot with the nodebox file you gave me. Sadly I get punched again because I just cannot seem to get it working. I tried multiple things to get it working but the rectangles mostly just disappear.

  3. I may have done something like this. I am interested in using Nodebox as a tool for designing narrow woven bands and braids (rather than writing large probrams in jython as I have in the past!)

    I created a palette of 5 colours (5 colour nodes merged into a list using a combine node). [Thought - it would be an interesting idea to be able to import a palette like this from the Adobe Kuler app].

    I then needed to colour a series of rectangles according to a pattern template string. The string was converted to a list of numbers, and these numbers then serve as an index into the colour list. There does not seem to be an "nth element" node to do this (only a first, second and last) - but the slice node does the job well enough if the slice length is set to 1.

    So make a decision tree to convert your BMI to a number in the range 0 to 4, and use this to index a palette and the output from the palette can colorize your shape.

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply