HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/Xerox/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 Xdata 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();
	$klar=array();
	$kaar=array();
	$kbar=array();
		$clar=array();
	$caar=array();
	$cbar=array();
		$mlar=array();
	$maar=array();
	$mbar=array();
		$ylar=array();
	$yaar=array();
	$ybar=array();
	$aar=array();
	$bar=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);
	

	
	$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;
	array_push($y40ar, $y40);
	
	$kl=$row->kl;
	array_push($klar, $kl);
		$ka=$row->ka;
	array_push($aar, $ka);
		$kb=$row->kb;
	array_push($bar, $kb);
	
		$cl=$row->cl;
	array_push($clar, $cl);
		$ca=$row->ca;
	array_push($aar, $ca);
		$cb=$row->cb;
	array_push($bar, $cb);
	
		$ml=$row->ml;
	array_push($mlar, $ml);
		$ma=$row->ma;
	array_push($aar, $ma);
		$mb=$row->mb;
	array_push($bar, $mb);
	
		$yl=$row->yl;
	array_push($ylar, $yl);
		$ya=$row->ya;
	array_push($aar, $ya);
		$yb=$row->yb;
	array_push($bar, $yb);
	
	}
	$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 "�����Ǹ�:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$po."<br>";	
	echo "�}�l�ɶ�:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$timear[0]."<br>";
	echo "OK sheet �ɶ�:&nbsp;"."[".$ok."]-&nbsp;".$timear[$ok-1]."&nbsp;&nbsp;**OK sheet �u��:".gmdate("H:i:s", timeDiff($timear[0],$timear[$ok-1]))."<br>";
	echo "����ɶ�:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".end($timear)."&nbsp;&nbsp;********�Ͳ��u��:".gmdate("H:i:s", timeDiff($timear[$ok-1],end($timear)))."<br>";
	echo "�`�u�@�ɶ�:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	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">

</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>

<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_scatter.php');


unlink('ab.png');



$datax = $aar;
$datay = $bar;



$graph = new Graph(550,430);
$graph->SetScale("linlin");
 
$graph->img->SetMargin(40,40,40,40);        
$graph->SetShadow();
 
$graph->title->Set("A simple scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
$sp1 = new ScatterPlot($datay,$datax);
 
$graph->Add($sp1);
//$graph->Stroke();
 /////////////////////////////////////////

// Setup the graph


// Output line
$graph->Stroke('ab.png');
?>
<img src="ab.png">
</div></td></tr>
</table>

<!-- graph code ends here-->