Here's a link to a previous question answered that I think has a great deal to do with mine. I just need some additional clarification on it.
I am creating a periodic table and what I'd like to do is set up a color gradient and then have the individual squares have a color in that gradient based on a certain property. For example, if my color gradient was to go from light red to dark red (actual colors unimportant right now), and I'm displaying the melting points of the elements in the table, I'd like those with the lower bp's to be lighter red and those with the higher bp's to be darker red; in other words, I need to map my bp range (approx -400 to +1500) to the values ot the colors in the gradient range. I don't want the colors equally distributed...if two elements have close to the same melting points, I'd like for them to be nearly identical. It's a one-to-one correspondence.
In the question referenced, I understand how the gradient is created, but what I don't understand is how I get the values I have for the melting points and use the function to generate where that value falls on the gradient. I don't understand where that's done or how I link my array of values to the color array.
Currently, I'm using the function provided in the link and then trying to take the output and use it to generate the background color of my div. The input I'm using is the same as defines the "$Variable" in the last line.
<div id="Helium" style="background-color:<?php echo $color; ?>;" class="element group18 period1">
<span class="number"> <?php echo $row[2]['atomicNumber']; ?> </span><br>
<span class="symbol"><?php echo $row[2]['symbol']; ?></span><br>
<span class="name"><?php echo $row[2]["$NameLanguage"]; ?></span><br>
<span class="molmass"><?php echo $row[2]["$Variable"]; ?></span></div>
Thank you for all the help. I do appreciate the time.
` is WAY deprecated. Use CSS for that. – m59 Dec 14 '13 at 04:33