※PHP側
foreach($summary as $y => $monthly_data)
{
$summary1[$y][0] = ""; // なぜか、要素が0からないと怒られる
for($m=1; $m<=12; $m++)
{
if(!empty($monthly_data[$m]))
{
$summary1[$y][($m-1)] = $monthly_data[$m];
} else {
$summary1[$y][($m-1)] = "";
}
}
} // foreach
$graph = new Graph(820, 300, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin(70, 5, 20, 40); // Left,Right,Top,Bottom
$graph->legend->SetLayout(LEGEND_HOR); // LEGEND_VERT/LEGEND_HOR
$graph->setFrame(true, "#e0e0e0", 1);
$graph->SetMarginColor("#949292"); // 外枠背景色
$graph->SetColor("#c2c0c0"); // 背景色
$graph->yaxis->SetColor("#e0e0e0"); // Y軸色
$graph->xaxis->SetColor("#e0e0e0"); // X軸色
$colors = array("#dde6b8", "#b8e6ca", "#b7ccbf", "#ebcbb9", "#e2c7ed", "#dcf0f5", "#ebe8cd");
$i=0;
foreach($summary1 as $y => $monthly_data)
{
$b= new BarPlot($monthly_data);
$b->setFillColor($colors[$i]);
$b->setColor("#b8b8b8");
$b->value->setFormat("%d");
$b->value->setColor("#736b6b");
$b->value->show();
$b->setLegend($y);
$arr[] = $b;
$i++;
}
$gb = new AccBarPlot($arr);
$graph->add($gb);
$graph->Stroke(DOC_DIR."/operation/jpgraph/jpgraph.png");
※HTML側
img src="./jpgraph/jpgraph.png">