 |
|
เซทไปหมดแล้วค่ะ อันนี้ตัวโค้ดของมันนะคะ
Code (PHP)
<?php
require("../jpgraph/jpgraph.php"); //this is path of tool
require("../jpgraph/jpgraph_bar.php");
require("../jpgraph/jpgraph_flags.php");
include ("connect.php") ;
$sql1 = "select *from member order by username";
$result = mysql_query($sql1)
or die("query error 1 ".mysql_error());
$sumtotal = 0;
while ($rs = mysql_fetch_array($result)){
$xdata[] = $rs["username"];
$ydata[] = $rs["buy_totalprice"];
}
$graph = new Graph(350,450);
$graph->SetScale("textlin");
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient("white","whitesmoke",GRAD_HOR, BGRAD_MARGIN);
$graph->SetShadow();
$graph->SetMargin(40,30,20,40);
$graph->title->SetFont(FF_TAHOMA, FS_BOLD,12);
$graph->title->Set(iconv('TIS-620','UTF-8',"รายงาน"));
$graph->subtitle->SetFont(FF_TAHOMA, FS_BOLD,12);
$graph->subtitle->Set(iconv('TIS-620','UTF-8',"รายงานลูกค้า"));
$graph->xaxis->title->Set("Username");
$graph->yaxis->title->Set("Bath");
$graph->xaxis->SetTickLabels($xdata);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient("white","whitesmoke",GRAD_HOR, BGRAD_MARGIN);
$bplot = new BarPlot($ydata);
$bplot->SetFillGradient('white','pink',GRAD_VERT);
$bplot->SetColor('gainsboro');
$bplot->SetWeight(1);
$bplot->value->Show();
$bplot->value->SetFont(FF_TAHOMA, FS_BOLD,8);
$bplot->value->SetAngle(45);
$graph->Add($bplot);
$graph->Stroke();
?>
|
 |
 |
 |
 |
Date :
2010-02-01 22:46:33 |
By :
Mintiiz |
|
 |
 |
 |
 |
|
|
 |