0

I generate stacked bar chart using PChart, but Y Axis does not start from 0. Is there manual parameter that I should set? Here the chart

enter image description here

2 Answers2

1
$graph->drawScale(array("Mode" => SCALE_MODE_START0));

This works for standard bar charts, I assume it would work for stacked. Give it a try.

1

There are actually a couple of ways to solve this issue. According to the documentation you should be able to use:

$graph->drawScale(array("Mode"=> SCALE_MODE_ADDALL_START0));

however, when I was generating stacked charts, it kept adding an additional mark at 110%, to solve this I decided to use:

$scaleProperties = array(0=>("Min"=>0, "Max"=>100));
$graph->drawScale(array("Mode" => SCALE_MODE_MANUAL, "ManualScale"=>$scaleProperties));

You would simply change the "Max" value to whatever your top end is, this forces the scale to stay between 0 and the maximum value.

Chris
  • 439
  • 7
  • 16