File: C:/xampp/htdocs/FograPlate/trendchartF.php
<?php
//extract($_REQUEST);
//session_start();
//error_reporting(E_ALL ^ E_NOTICE);
$date_s=$_GET['date_s'];
$date_e=$_GET['date_e'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5"><title>�L�����i--</title>
</head>
<?php
$host="127.0.0.1";
$user="root";
$pass="fredsql";
$db="tvicheck-st";
error_reporting(0);
$plate= $_GET['plate'];
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
//$link = mssql_connect("MACBOOK7", "sa", "fred5697");
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT * from plate where plate='$plate' and ddate between '$date_s' and '$date_e' order by id";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if records present
$i=0;
// iterate iii through resultset
// print title with links to edit and delete scripts
$timear= array();
$a50ar = array();
$a25ar = array();
$b50ar = array();
$b25ar = array();
$timear = array();
while($row = mysql_fetch_object($result))
{
$i=$i+1;
$tm=$row->dDate;
array_push($timear, $tm);
$a50=$row->a50;
array_push($a50ar, $a50);
$a25=$row->a25;
array_push($a25ar, $a25);
$b50=$row->b50;
array_push($b50ar, $b50);
$b25=$row->b25;
array_push($b25ar, $b25);
}
$max=$i;
//echo "maxi:".$i."-__";
date_default_timezone_set('Asia/Taipei');
?>
<p>
<table width="200" border="1" align="center"> <font color="green">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php');
unlink('CMYSID.png');
$datay1 = $a50ar;
$datay2 = $a25ar;
$datay3 = $b50ar;
$datay4 = $b25ar;
// Setup the graph
$graph = new Graph(550,430);
//$graph->SetScale("textint",0,6,0,0);
$graph->SetScale("textint");
$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->title->Set('Plate'.$plate);
$graph->SetBox(false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p2 = new LinePlot($datay2);
$graph->Add($p2);
//$ADR=92.04-5.9;
//$BDR=91.12-6.32;
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p4 = new LinePlot($datay4);
$graph->Add($p4);
$p1->SetColor("#55bbdd");
$p1->SetLegend('50% Left');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();
$p2->SetColor("#fcbffb");
$p2->SetLegend('25% Left');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#fcbffb');
$p2->mark->SetFillColor('#fcbffb');
$p2->value->SetMargin(14);
$p2->SetCenter();
$p3->SetColor("#dce72a");
$p3->SetLegend('50% Right');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#dce72a');
$p3->mark->SetFillColor('#dce72a');
$p3->value->SetMargin(14);
$p3->SetCenter();
$p4->SetColor("#cccccc");
$p4->SetLegend('25% Right');
$p4->mark->SetType(MARK_DIAMOND,'',1.0);
$p4->mark->SetColor('#cccccc');
$p4->mark->SetFillColor('#cccccc');
$p4->value->SetMargin(14);
$p4->SetCenter();
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('CMYSID.png');
?>
<img src="CMYSID.png">
</div></td></tr>
</table>
<p><p> <p><p> <p><p>
<p><p> <p><p> <p><p>
<p> </p>
<!-- graph code ends here-->