// Create the bar plots
//$b1plot = new BarPlot($databary1);
//$b1plot->SetFillColor($gcolor1);
$b2plot = new BarPlot($databary2);
$b2plot->SetFillColor($gcolor2);
if ($useLabels == "on"){
//$b1plot->value->SetFormat('%d');
//$b1plot->value->Show();
$b2plot->value->SetFormat('%d');
$b2plot->value->Show();
// set y-grace
$graph->yaxis->scale->SetGrace(6,auto);
}else{
$graph->yaxis->scale->SetGrace(3,auto);
}
// add the credit line if graph is big enough
if($xdim > 300){
$txt =new Text("SomeSite.com");
$pos1 = ($xdim - 120);
$pos2 = ($ydim - 22);
$txt->Pos( $pos1,$pos2);
$txt->SetColor( "black");
$graph->AddText( $txt);
}
// use a bar shadow if set
if ($shadow == "on"){
// $b1plot->SetShadow($aShadowColor,$aShadowWidth);
$b2plot->SetShadow($aShadowColor,$aShadowWidth);
}
// Setup month on X-scale
$graph->xaxis->SetTickLabels($datax);
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);
// Set title and subtitle
$graph->title->Set("$statYear - Legend For Sample Graph");
$graph->xaxis->title->Set("Month");
$graph->yaxis->title->Set("Days with Contact");
Just a quick modifcation of End User's code, but receiving data from within the URL, this should work. (I only modified how the array is being populated).
// Create the bar plots
//$b1plot = new BarPlot($databary1);
//$b1plot->SetFillColor($gcolor1);
$b2plot = new BarPlot($databary2);
$b2plot->SetFillColor($gcolor2);
if ($useLabels == "on"){
//$b1plot->value->SetFormat('%d');
//$b1plot->value->Show();
$b2plot->value->SetFormat('%d');
$b2plot->value->Show();
// set y-grace
$graph->yaxis->scale->SetGrace(6,auto);
}else{
$graph->yaxis->scale->SetGrace(3,auto);
}
// add the credit line if graph is big enough
if($xdim > 300){
$txt =new Text("SomeSite.com");
$pos1 = ($xdim - 120);
$pos2 = ($ydim - 22);
$txt->Pos( $pos1,$pos2);
$txt->SetColor( "black");
$graph->AddText( $txt);
}
// use a bar shadow if set
if ($shadow == "on"){
// $b1plot->SetShadow($aShadowColor,$aShadowWidth);
$b2plot->SetShadow($aShadowColor,$aShadowWidth);
}
// Setup month on X-scale
$graph->xaxis->SetTickLabels($datax);
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);
// Set title and subtitle
$graph->title->Set("$statYear - Legend For Sample Graph");
$graph->xaxis->title->Set("Month");
$graph->yaxis->title->Set("Days with Contact");