File: C:/xampp/htdocs/FograCT94/lineGraph - 複製.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5"><title>�L��d��--</title>
</head>
<?php
$host="127.0.0.1";
$user="root";
$pass="fredsql";
$db="tvicheck-st";
$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 fogra123 where PO='$po' 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();
$k100ar = array();
$k40ar = array();
$c100ar = array();
$c40ar = array();
$m100ar = array();
$m40ar = array();
$y100ar = array();
$y40ar = array();
$filear = array();
$stripar = array();
while($row = mysql_fetch_object($result))
{
$i=$i+1;
if ($row->setOK==1) {$ok=$i;}
$tm=$row->ddate;
//echo $i."-".$tm."__";
array_push($timear, $tm);
$file=$row->filename;
array_push($filear, $file);
$strip=$row->strip;
array_push($stripar, $strip);
$k100=$row->k100;
//echo $i."-".$k100."__";
array_push($k100ar, $k100);
$k40=$row->k40;
//echo $i."-".$k40."__";
array_push($k40ar, $k40);
$c100=$row->c100;
//echo $i."-".$c100."__";
array_push($c100ar, $c100);
$c40=$row->c40;
//echo $i."-".$c40."__";
array_push($c40ar, $c40);
$m100=$row->m100;
//echo $i."-".$c100."__";
array_push($m100ar, $m100);
$m40=$row->m40;
//echo $i."-".$c40."__";
array_push($m40ar, $m40);
$y100=$row->y100;
//echo $i."-".$y100."__";
array_push($y100ar, $y100);
$y40=$row->y40;
//echo $i."-".$y40."__";
array_push($y40ar, $y40);
}
$max=$i;
date_default_timezone_set('Asia/Taipei');
function timeDiff($firstTime,$lastTime)
{
// convert to unix timestamps
$firstTime=strtotime($firstTime);
$lastTime=strtotime($lastTime);
// perform subtraction to get the difference (in seconds) between times
$timeDiff=$lastTime-$firstTime;
// return the difference
return $timeDiff;
}
//echo "max=".$max;
//print_r ($timear[0]);
//print_r ($k40ar);
//print_r ($c100ar);
//print_r ($c40ar);
// print_r ($m100ar);
//print_r ($m40ar);
// print_r ($y100ar);
//print_r ($y40ar);
//$interval = timeDiff($timear[0], end($timear));
//echo $interval->format('%R%a days');
echo "�u�渹�X: ".$po."<br>";
echo "�}�l�ɶ�: ".$timear[0]."<br>";
echo "OK sheet �ɶ�: "."[".$ok."]- ".$timear[$ok-1]." **OK sheet �u��:".gmdate("H:i:s", timeDiff($timear[0],$timear[$ok-1]))."<br>";
echo "����ɶ�: ".end($timear)." ********�Ͳ��u��:".gmdate("H:i:s", timeDiff($timear[$ok-1],end($timear)))."<br>";
echo "�`�u�@�ɶ�: ";
echo gmdate("H:i:s", timeDiff($timear[0],end($timear)));
?>
<p>
<table width="200" border="1" align="center"> <font color="green">
<tr>
<td><div align="center">
<?php
for ( $j = 1; $j <= $i; $j += 1) {
?><a href="http://127.0.0.1/fogra<?php echo $strip;?>/tvireport.php?tvifile=<?php print $filear[$j-1]."&okfile=";
if ($j>$ok){
echo $filear[$ok-1];}
?>"><?php if ($j>$ok){?><font color="green"><?php } echo $j." ";?></font></a>
<?php
//echo print_r ($filear);
///http://127.0.0.1/fogra627/tvireport.php?tvifile=H3_627TT_627_2013-11-28_163409_18.csv
}
?>
</td></tr>
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
unlink('CMYKSID.png');
$datay1 = $k100ar;
$datay2 = $c100ar;
$datay3 = $m100ar;
$datay4 = $y100ar;
// Setup the graph
$graph = new Graph(550,430);
$graph->SetScale("textlin");
$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->title->Set('CMYK 100');
$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("#aaaaaa");
$p1->SetLegend('K100');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();
$p2->SetColor("#55bbdd");
$p2->SetLegend('C100');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#55bbdd');
$p2->mark->SetFillColor('#55bbdd');
$p2->value->SetMargin(14);
$p2->SetCenter();
$p3->SetColor("#fcbffb");
$p3->SetLegend('M100');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#fcbffb');
$p3->mark->SetFillColor('#fcbffb');
$p3->value->SetMargin(14);
$p3->SetCenter();
$p4->SetColor("#dce72a");
$p4->SetLegend('Y100');
$p4->mark->SetType(MARK_STAR,'',1.0);
$p4->mark->SetColor('#dce72a');
$p4->mark->SetFillColor('#dce72a');
$p4->value->SetMargin(14);
$p4->SetCenter();
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('CMYKSID.png');
?>
<img src="CMYKSID.png">
</div></td></tr>
</table>
<p><p> <p><p> <p><p>
<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
unlink('CMYK40.png');
$datay1 = $k40ar;
$datay2 = $c40ar;
$datay3 = $m40ar;
$datay4 = $y40ar;
// Setup the graph
$graph = new Graph(550,430);
$graph->SetScale("textlin");
$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->title->Set('CMYK40');
$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("#aaaaaa");
$p1->SetLegend('K40');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();
$p2->SetColor("#55bbdd");
$p2->SetLegend('C40');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#55bbdd');
$p2->mark->SetFillColor('#55bbdd');
$p2->value->SetMargin(14);
$p2->SetCenter();
$p3->SetColor("#fcbffb");
$p3->SetLegend('M40');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#fcbffb');
$p3->mark->SetFillColor('#fcbffb');
$p3->value->SetMargin(14);
$p3->SetCenter();
$p4->SetColor("#dce72a");
$p4->SetLegend('Y40');
$p4->mark->SetType(MARK_STAR,'',1.0);
$p4->mark->SetColor('#dce72a');
$p4->mark->SetFillColor('#dce72a');
$p4->value->SetMargin(14);
$p4->SetCenter();
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('CMYK40.png');
?>
<img src="CMYK40.png">
</div></td></tr>
</table>
<!-- graph code ends here-->