pChart drawStackedBarChart setting the bar size property

197 views Asked by At

I am using pChart drawStackedBarChart to generate a series of charts. I can't seem to find the setting that sets the height of the bar. As shown below the bar with the single bar chart is very thin. Any ideas how to set this property? The chart below shows the bar height that I am aiming for.

enter image description here

$chartHeight = 50 + (the number of bars * 100) + 50; 
$myPicture = new pImage(2000, $chartHeight, $MyData);
$myPicture->setFontProperties(array("FontName"=>$chartFont,"FontSize"=>$axisFontSize));
$myPicture->setGraphArea(360 + $sizeAdjustment, 60, 1800 - $sizeAdjustment, $chartHeight);

$AxisBoundaries = array(0=>array("Min"=>0,"Max"=>100));
$scaleSettings  = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,"Mode"=>SCALE_MODE_MANUAL, "ManualScale"=>$AxisBoundaries, "Pos"=>SCALE_POS_TOPBOTTOM, "MinDivHeight"=>50);
$myPicture->drawScale($scaleSettings);

$myPicture->setFontProperties(array("FontName"=>$chartFont,"FontSize"=>20));
$myPicture->drawLegend(360, $chartHeight, array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_VERTICAL, "BoxWidth"=>20, "BoxHeight"=>20, "Margin"=>10));

$myPicture->drawStackedBarChart(array("DisplayPos"=>LABEL_POS_INSIDE,"DisplayValues"=>TRUE));
1

There are 1 answers

0
Dan On

Can you share your full code? It should not look like that because it is resizing to graph area. You could try updating your package to latest. Link is here. Have a look similar example below.

enter image description here