 |
|
ต้องแก้ยังไงครับ
หน้า jpgraph
Code (PHP)
<?php // content="text/plain; charset=utf-8"
// Example for use of JpGraph,
include "conn.inc.php";
//$adate=$_GET['$adat']
$yy=$_GET["yyy"];
$mm=$_GET["mmm"];
//var_dump($_GET);
//echo $today;
if ($mm == ""){
$mm=date('m');
$yy=date('Y');
}
$months = array(1=>'มกราคม','กุมภาพันธ์','มีนาคม',
'เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม',
'กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม');
$mn_lp=(iconv('TIS-620','UTF-8','ประจำเดือน '.$months[(int)$mm].' พ.ศ.'));
$strSQL =
"SELECT
`tb_province`.`name_prov`,
`tb_temperature`.`areas`,
`tb_areas`.`name_areas`,
MAX(temp_hight),
`tb_temperature`.`date_temp`
FROM
`tb_areas`
Inner Join `tb_province` ON `tb_province`.`id_prov` = `tb_areas`.`prov`
Inner Join `tb_temperature` ON `tb_areas`.`id_areas` = `tb_temperature`.`areas`
WHERE
MONTH(tb_temperature.date_temp)='$mm' AND YEAR(tb_temperature.date_temp)='$yy'
GROUP BY tb_temperature.date_temp
ORDER BY
`tb_temperature`.`date_temp` ASC";
//echo $strSQL;
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$name = array();
$temph = array();
$targ = array();
$alt = array();
while($objResult = mysql_fetch_array($objQuery))
{
$d_temp= $objResult["date_temp"];
$tem_h= $objResult["MAX(temp_hight)"];
//echo $tem_h;
$sqlx= "SELECT name_areas,temp_hight FROM tb_areas
Inner Join `tb_temperature` ON `tb_areas`.`id_areas` = `tb_temperature`.`areas`
WHERE temp_hight='$tem_h' && date_temp='$d_temp' ";
$x1 = mysql_query($sqlx);
$area= mysql_result($x1,0);
$name[]=$area;
$temph[]=$tem_h;
$targ[] = '#'.$tem_h;
$alt[] = $area.' = '.$tem_h;
}
//echo $datay1;
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
//$arr[1][$tem_p];
$data1y = $temph;
$datax=$name;
$tar=$targ;
$alt=$alt;
//$tt1=iconv('TIS-620','UTF-8',$where1);
// A nice graph with anti-aliasing
$graph = new Graph(900,300);
$graph->img->SetMargin(40,40,"auto",40);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
$graph->img->SetAntiAliasing();
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->Set($mn_lp.' '.($yy+543));
// Use built in font
$graph->title->SetFont(FF_CORDIA,FS_BOLD,18);
$graph->legend->SetFont(FF_CORDIA,FS_NORMAL,14);
// Slightly adjust the legend from it's default position in the
// top right corner.
$graph->legend->Pos(0.05,0.5,"right","top");
$graph->xaxis->title->Set(iconv('TIS-620','UTF-8','วันที่'));
$graph->xaxis->title->SetFont(FF_CORDIA,FS_BOLD,18);
$graph->xgrid->show(true,true);
// Create the first line
$p1 = new LinePlot($data1y);
$p1->mark->SetType(MARK_IMG_STAR,'blue',.8);
$p1->mark->SetFillColor("red");
$p1->mark->SetWidth(4);
$p1->SetColor("blue");
$p1->SetCSIMTargets($tar,$alt);
$p1->value->show();
$p1->value->SetColor("darkred");
$p1->value->SetFont(FF_CORDIA);
$p1->SetCenter();
$graph->Add($p1);
// Output line
$graph->Stroke();
?>
เพจเว็บ
Code (PHP)
<img src='graph_max_month.php?<?echo $_SERVER['QUERY_STRING'];?>'>
|
 |
 |
 |
 |
Date :
2010-05-24 14:22:00 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |