|
|
|
ช่วยดูโค๊ดออกรายงานกราฟโดยดึงข้อมูลจาก Mysql แล้วไม่เป็นภาษาไทย ให้หน่อยจ้าหาที่แก้ไม่เจอเลย |
|
|
|
|
|
|
|
แก้ไม่ได้สักทีค่ะ ลองศึกษาในกระทู้นี้มาหลายกระทู้แล้ว แต่หาไม่เจอสะทีค่ะ ช่วยด้วยนะคะ
Code (PHP)
<?php
require("../jpgraph/src/jpgraph.php"); //this is path of tool
require("../jpgraph/src/jpgraph_bar.php");
require("../jpgraph/src/jpgraph_flags.php");
include ("../dbconnect.php");
$sql1 ="SELECT personnel.per_name, paymentextra_load.net, paymentextra_load.per_id
FROM paymentextra_load INNER JOIN personnel ON paymentextra_load.per_id=personnel.per_id ";
$result = mysql_query($sql1)
or die("query error 1 ".mysql_error());
while ($rs = mysql_fetch_array($result)){
$xdata[] = $rs["per_name"];
$ydata[] = $rs["net"];
}
$graph = new Graph(650,550);
$graph->SetScale("textlin");
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient("white","whitesmoke",GRAD_HOR, BGRAD_MARGIN);
$graph->SetShadow();
$graph->SetMargin(60,50,40,60);
$graph->title->SetFont(FF_ANGSA,FS_BOLD,20);
$graph->title->Set(iconv('TIS-620','UTF-8',"รายงานยอดเงินรวม"));
$graph->subtitle->SetFont(FF_ANGSA,FS_BOLD,20);
$graph->subtitle->Set(iconv('TIS-620','UTF-8',"ค่าสอนพิเศษ"));
$graph->xaxis->title->Set(iconv('TIS-620','UTF-8',"ชื่อ"));
$graph->xaxis->title->SetFont(FF_ANGSA,FS_BOLD,18);
$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','orchid',GRAD_VERT);
$bplot->SetColor('gainsboro');
$bplot->SetWeight(1);
$bplot->value->Show();
$bplot->value->SetFont(FF_ANGSA,FS_BOLD,15);
$bplot->value->SetAngle(45);
$graph->Add($bplot);
$graph->Stroke();
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2013-03-31 20:33:03 |
By :
totopam |
View :
1325 |
Reply :
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยด้วยค๊าาาาาาา
|
|
|
|
|
Date :
2013-03-31 21:38:46 |
By :
totopam |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลอง Save ไฟล์ให้เป็นแบบ UTF-8 แล้วใช่ไหม๊ครับ
|
|
|
|
|
Date :
2013-03-31 22:28:53 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เซฟยังไงอ่ะค่ะ ทำกะ dream อ่ะค่ะ
|
|
|
|
|
Date :
2013-03-31 22:36:23 |
By :
totopam |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วค่ะ ขอบคุณค่ะ
Code (PHP)
<?php
include_once("../jpgraph/src/jpgraph.php");
include_once("../jpgraph/src/jpgraph_bar.php");
include_once("../jpgraph/src/jpgraph_flags.php");
include_once ("../dbconnect.php");
$sql1 ="SELECT per_name , per_code FROM personnel where per_code<4000 ";
$result = mysql_query($sql1) or die("query error 1 ".mysql_error());
while ($rs = mysql_fetch_array($result)){
$ydata[] = $rs["per_code"];
$xdata[] = iconv('TIS-620', 'UTF-8', $rs["per_name"]);
}
$graph = new Graph(650,550);
$graph->SetScale("textlin");
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient("white","whitesmoke",GRAD_HOR, BGRAD_MARGIN);
$graph->SetShadow();
$graph->SetMargin(60,50,40,60);
$graph->title->Set("รายงานยอดเงิน");
$graph->title->SetFont(FF_ANGSA,FS_BOLD,20);
$graph->subtitle->Set("ค่าสอนพิเศษ");
$graph->subtitle->SetFont(FF_ANGSA,FS_BOLD,20);
$graph->xaxis->title->Set("ชื่อ");
$graph->xaxis->title->SetFont(FF_ANGSA,FS_BOLD,18);
$graph->yaxis->title->Set("บาท");
$graph->yaxis->title->SetFont(FF_ANGSA,FS_BOLD,18);
$graph->xaxis->SetTickLabels($xdata);
$graph->xaxis->SetFont(FF_ANGSA,FS_NORMAL,16);
$graph->SetMarginColor('white');
$graph->SetBackgroundGradient("white","whitesmoke",GRAD_HOR, BGRAD_MARGIN);
$bplot = new BarPlot($ydata);
$bplot->SetFillGradient('white','orchid',GRAD_VERT);
$bplot->SetColor('gainsboro');
$bplot->SetWeight(1);
$bplot->value->Show();
$bplot->value->SetFont(FF_ANGSA,FS_BOLD,15);
$bplot->value->SetAngle(45);
$graph->Add($bplot);
$graph->Stroke();
?>
|
|
|
|
|
Date :
2013-04-01 01:27:58 |
By :
totopam |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยินดีด้วยครับ
|
|
|
|
|
Date :
2013-04-01 07:22:00 |
By :
poomloom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตกลงแก้ไขยังไงครับ
|
|
|
|
|
Date :
2013-04-01 08:41:17 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ต้องใช้ iconv
|
|
|
|
|
Date :
2013-04-01 09:22:27 |
By :
Krungsri |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|