<?php // content="text/plain; charset=utf-8"
// Example for use of JpGraph,
include "conn.inc.php";
//$adate=$_GET['$adat']
$yy=$_GET["dll_y"];
$mm=$_GET["dll_m"];
//var_dump($_GET);
//echo $today;
$strSQL = "SELECT
`tb_province`.`name_prov`,
`tb_areas`.`name_areas`,
`tb_temperature`.`temp`,
`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
`tb_province`.`id_prov` = '8' AND
MONTH(tb_temperature.date_temp)='$mm' AND YEAR(tb_temperature.date_temp)='$yy'
ORDER BY
`tb_province`.`name_prov` ASC,
`tb_temperature`.`date_temp` ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
//`tb_areas`.`id_areas` = '1'
$name = array();
$temp = array();
while($objResult = mysql_fetch_array($objQuery))
{
$tem_p= $objResult["temp"];
$area= $objResult["name_areas"];
$name[] = (iconv('TIS-620','UTF-8',$area));
$temp[] = $tem_p;
}
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
$datay = $temp;
$data2y = array(14,18,33,29,39,55);
// A nice graph with anti-aliasing
$graph = new Graph(400,300);
$graph->img->SetMargin(40,180,40,40);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
$graph->img->SetAntiAliasing();
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->Set("Background image");
// Use built in font
$graph->title->SetFont(FF_CORDIA,FS_BOLD);
// Slightly adjust the legend from it's default position in the
// top right corner.
$graph->legend->Pos(0.05,0.5,"right","center");
// Create the first line
$p1 = new LinePlot($datay);
$p1->mark->SetType(MARK_IMG_STAR,'red',0.45);
$p1->mark->SetFillColor("red");
$p1->mark->SetWidth(4);
$p1->SetColor("blue");
$p1->SetCenter();
$p1->SetLegend($mm);
//$p1->SetLegend(iconv('TIS-620','UTF-8','ลำปาง'));
$graph->Add($p1);
// ... and the second
$p2 = new LinePlot($data2y);
$p2->mark->SetType(MARK_STAR);
$p2->mark->SetFillColor("red");
$p2->mark->SetWidth(4);
$p2->SetColor("red");
$p2->SetCenter();
$p2->SetLegend("New tiger -99");
$graph->Add($p2);
// Output line
$graph->Stroke();
?>