File: C:/xampp/htdocs/FograPC4/trendchart.php
<?php
$company='ecolor';
echo "Welcome! ".$company;
error_reporting(0);?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5"><title>Plate Report--</title>
</head>
<?php
//error_reporting(0);
$plate= $_GET['plate'];
$connection = mysql_connect("127.0.0.1", "root", "fredsql") or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
$db = "tvicheck-st";
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT * from plate where plate='$plate' and company='$company' order by id";
//echo $query;
$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('graph/'.$company.$plate.'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();
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('graph/'.$company.$plate.'CMYSID.png');
?>
<img src="graph/<?php echo $company.$plate;?>CMYSID.png">
</div></td></tr>
</table>
<p><p> <p><p> <p><p>
<p><p> <p><p> <p><p>
<p> </p>
<!-- graph code ends here-->