<?php
/*mysql_select_db($database_moneydb, $moneydb);
$query_sum = "SELECT sum(payamount) as sumpay,paydate FROM dailypay WHERE 1 $paycond and createby = '1' GROUP BY paydate";
//echo $query_sum;
$sum = mysql_query($query_sum, $moneydb) or die(mysql_error());
while ($row_sum = mysql_fetch_assoc($sum)){
$datay[substr($row_sum['paydate'],8)-1] = $row_sum['sumpay'] ;
}
*/
$datay = array(12,8,19,3,10,5);//
/*$query_sum = "SELECT sum(payamount) as sumpay,paydate FROM dailypay WHERE 1 $paycond and createby = '2' GROUP BY paydate";
$sum = mysql_query($query_sum, $moneydb) or die(mysql_error());
while ($row_sum = mysql_fetch_assoc($sum)){
$datay2[substr($row_sum['paydate'],8)-1] = $row_sum['sumpay'] ;
}
*/
$datay2 = array(8,2,11,7,14,4);//
$graphtitle = "กราฟแสดง รายจ่ายประจำเดือน ".$monthname[intval($currentmonth)];
?>
<?php
include ("graph/jpgraph.php");
include ("graph/jpgraph_bar.php");
$data1y=$datay;//
$data2y=$datay2;//
//print_r($data2y);
// Create the graph. These two calls are always required
$graph = new Graph(1048,550); // กำหนดขนาด
$graph->SetScale("textlin");
$graph->legend->SetFont(FF_ANGSA,FS_BOLD,16); //SetFont(FF_FONT1,FS_BOLD);//
$graph->SetShadow();
$graph->img->SetMargin(40,30,20,40);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$b1plot->value->Show();
$b1plot->SetLegend('รายการที่ 1 ');
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
$b2plot->value->Show();
$b2plot->SetLegend('รายการที่ 2');
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$graph->title->SetFont(FF_ANGSA,FS_BOLD,20); // กำหนด font ไทย
$graph->title->Set("$graphtitle");
//$graph->title->Set("CSIM with popup windows");
$graph->xaxis->title->SetFont(FF_ANGSA,FS_NORMAL,12); // กำหนด font ไทย
$graph->xaxis->title->Set("วันที่");
$graph->yaxis->title->SetFont(FF_ANGSA,FS_NORMAL,12); // กำหนด font ไทย
$graph->yaxis->title->Set("จำนวน (บาท)");
//$graph->title->SetFont(FF_FONT1,FS_BOLD);
//$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
//$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
// Display the graph
$graph->Stroke(); /**/
?>