Setting Color for Pie Slices?
I'm making several pie charts from a database and I would like to set the color of each slice based off the color supplied within the database.
The colors are stored in hex since I used them for coloring my tables and text on the page. I have a function that converts them to an rgb array.
The number of categories in my pie chart are dynamic, depending on what activity has taken place in the set time period.
I pull everything together in different arrays.
Here's some sample code I have been playing with, so far I have managed only to ensure that all the categories are black.
Code:
/* Create and populate the pData object */
$DataSet = new pData();
$DataSet->addPoints($spendingArray,"Spending");
/* Define the absissa serie */
$DataSet->addPoints($categoryArray,"Labels");
$DataSet->setAbscissa("Labels");
foreach($categoryArray as $cat){
//eventually this will have a different color for each category, but I can't even change one right now.
$DataSet->setPalette($cat, array("R"=>20,"G"=>200,"B"=>20,"Alpha"=>100));
}