pchart change the color of percentage/values of pie chart

831 views Asked by At

I cannot change the color of the percentage of the pie chart. I want the color to be black but it does not work.

This is where I am setting the default font settings. The RGB values are already 0.

$myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>15,"R"=>0,"G"=>0,"B"=>0));

this is the pie chart

$PieChart->draw2DPie(320,350,array("Radius"=>250,"LabelColor"=>PIE_LABEL_COLOR_MANUAL,"WriteValues"=>PIE_VALUE_PERCENTAGE,"DataGapAngle"=>10,"DataGapRadius"=>6,"Border"=>TRUE,"BorderR"=>255,"BorderG"=>255,"BorderB"=>255));

How can I fix this? Thank you.

1

There are 1 answers

0
MackieeE On

It's not the most obvious documentation for this on pChart website:

The color of the labels can be defined statically or dynamically setting LabelColor to:

  • PIE_LABEL_COLOR_MANUAL to manually provide a single color (LabelR,...)

  • PIE_LABEL_COLOR_AUTO to re-use the color of the data series.

Notice the LabelR, so whereas it's normally the:

array( "R" => 32, "G" => 42, "B" => 56 );

In this instance you must prefix them with 'Label'

array( "LabelR" => 32, "LabelG" => 42, "LabelB" => 56 );