I have a problem with my pie chart when I have 0 values $MyData->addPoints(array(10,20,20,15,23),"Data");
This works fine and converts to percentages across a pie chart however if any of these values are 0 which could happen as I'm dealing with counts and these are really variables in my script) then everything screws up and the color of the legend don't correlate with the data values. Basically in the pie chart the color palette only assigns a value to non 0 points
10 $PieChart->setSliceColor(0,array("R"=>48,"G"=>199,"B"=>13));
20 $PieChart->setSliceColor(1,array("R"=>246,"G"=>2,"B"=>8));
20 $PieChart->setSliceColor(2,array("R"=>233,"G"=>215,"B"=>59));
15 $PieChart->setSliceColor(3,array("R"=>38,"G"=>42,"B"=>191));
23 $PieChart->setSliceColor(3,array("R"=>38,"G"=>42,"B"=>191));
10 $PieChart->setSliceColor(0,array("R"=>48,"G"=>199,"B"=>13));
0
20 $PieChart->setSliceColor(1,array("R"=>246,"G"=>2,"B"=>8));
15 $PieChart->setSliceColor(2,array("R"=>233,"G"=>215,"B"=>59));
23 $PieChart->setSliceColor(3,array("R"=>38,"G"=>42,"B"=>191));
$PieChart->setSliceColor(3,array("R"=>38,"G"=>42,"B"=>191));
Is this a common problem?
I used a quick hack to bypass this bug, try to replace your zero values by -0.0001.
I ended up simply removing all zero values from my array (as suggested here: pchart pie chart legend and graph not correlating)
Seems about time they fix this rather serious bug though.
This issue has been fixed in the latest version of pChart.