I am developing php statistic part of my app with pChart, but I met a difficulty trying to set the colors of my bars with the pChart librairy. I want to change color of each bar. Is it possible to change the color ? Like for slices ?
My chart just has 1 serie, I have 4 bars.
With Pie chart I can use this
$PieChart = $this->pchart->pPie($myPicture,$MyData);
$PieChart->setSliceColor(0,array("R"=>255,"G"=>128,"B"=>0));
$PieChart->setSliceColor(1,array("R"=>255,"G"=>255,"B"=>255));
$PieChart->setSliceColor(2,array("R"=>25,"G"=>128,"B"=>0));
$PieChart->setSliceColor(4,array("R"=>55,"G"=>255,"B"=>25));
How will I manage it with bars ? I have no indication on documentation.
Yes you can do that, but you have to use custom palette for that.
$Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100),
"1"=>array("R"=>224,"G"=>100,"B"=>46,"Alpha"=>100),
"2"=>array("R"=>224,"G"=>214,"B"=>46,"Alpha"=>100),
"3"=>array("R"=>46,"G"=>151,"B"=>224,"Alpha"=>100),
"4"=>array("R"=>176,"G"=>46,"B"=>224,"Alpha"=>100),
"5"=>array("R"=>224,"G"=>46,"B"=>117,"Alpha"=>100),
"6"=>array("R"=>92,"G"=>224,"B"=>46,"Alpha"=>100),
"7"=>array("R"=>224,"G"=>176,"B"=>46,"Alpha"=>100));
$myPicture->drawBarChart(array("OverrideColors"=>$Palette));
If you want more info you can find it here. http://wiki.pchart.net/doc.chart.drawbarchart.html