Folder reorganize 1
This commit is contained in:
107
OLD/OLD Trends/trends/allmills.php
Normal file
107
OLD/OLD Trends/trends/allmills.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
// content="text/plain; charset=utf-8"
|
||||
|
||||
require_once ('src/jpgraph.php');
|
||||
require_once ('src/jpgraph_line.php');
|
||||
|
||||
// FOR DB CONNECTION
|
||||
$link = mysql_connect('rachet', 'corey', '41945549')
|
||||
or die('Could not connect: ' . mysql_error());
|
||||
|
||||
mysql_select_db('controls') or die('Could not select database');
|
||||
|
||||
$dataArray=array();
|
||||
|
||||
//get data from database
|
||||
$sql="SELECT timestamp, mill1spd, MILL2SPD, MILL3SPD, MILL4SPD, MILL5SPD, MILL6SPD FROM trending where trending.id mod 16 = 0 GROUP BY timestamp DESC LIMIT 96";
|
||||
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
|
||||
if ($result) {
|
||||
while ($row = mysql_fetch_assoc($result)) {
|
||||
$datay[] = $row["timestamp"];
|
||||
$datax1[] = $row["mill1spd"];
|
||||
$datax2[] = $row["MILL2SPD"];
|
||||
$datax3[] = $row["MILL3SPD"];
|
||||
$datax4[] = $row["MILL4SPD"];
|
||||
$datax5[] = $row["MILL5SPD"];
|
||||
$datax6[] = $row["MILL6SPD"];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Setup the graph
|
||||
$graph = new Graph(1600,520);
|
||||
$graph->SetScale('linlin',0,5000,0,96);
|
||||
$graph->yaxis->scale->ticks->Set(5,10);
|
||||
$graph->xaxis->scale->ticks->Set(5);
|
||||
|
||||
$theme_class=new UniversalTheme;
|
||||
|
||||
$graph->SetTheme($theme_class);
|
||||
$graph->img->SetAntiAliasing(false);
|
||||
$graph->title->Set('Graph');
|
||||
$graph->img->SetMargin(70,15,30,100); // Sets the margin. L, R, T, B
|
||||
$graph->title->Set('All Mill Speeds Past 24 Hours');
|
||||
$graph->subtitle->Set('(15 Minute Intervals)');
|
||||
$graph->xaxis->title->Set();
|
||||
$graph->yaxis->title->Set('RPM');
|
||||
$graph->SetBox(false);
|
||||
$graph->legend->SetPos($aX,$aY,$aHAlign='right',$aVAlign='top');
|
||||
|
||||
$graph->img->SetAntiAliasing();
|
||||
|
||||
$graph->yaxis->HideZeroLabel();
|
||||
$graph->yaxis->HideLine(false);
|
||||
$graph->yaxis->HideTicks(false,false);
|
||||
$graph->yaxis->title->Set('Mill Speed');
|
||||
$graph->yaxis->SetTitleMargin(50);
|
||||
|
||||
$graph->xgrid->Show();
|
||||
$graph->xgrid->SetLineStyle("solid");
|
||||
$graph->xaxis->SetTickLabels($datay);
|
||||
$graph->xaxis->SetLabelAngle(65);
|
||||
$graph->xgrid->SetColor('#E3E3E3');
|
||||
|
||||
|
||||
// Create line 1
|
||||
$p1=new LinePlot($datax1);
|
||||
$graph->Add($p1);
|
||||
$p1->SetColor("#6495ED");
|
||||
$p1->SetLegend('Mill 1');
|
||||
|
||||
// Create line 2
|
||||
$p2=new LinePlot($datax2);
|
||||
$graph->Add($p2);
|
||||
$p2->SetColor("#B22222");
|
||||
$p2->SetLegend('Mill 2');
|
||||
|
||||
// Create line 3
|
||||
$p3=new LinePlot($datax3);
|
||||
$graph->Add($p3);
|
||||
$p3->SetColor("orange");
|
||||
$p3->SetLegend('Mill 3');
|
||||
|
||||
// Create line 4
|
||||
$p4=new LinePlot($datax4);
|
||||
$graph->Add($p4);
|
||||
$p4->SetColor("blue");
|
||||
$p4->SetLegend('Mill 4');
|
||||
|
||||
// Create line 5
|
||||
$p5=new LinePlot($datax5);
|
||||
$graph->Add($p5);
|
||||
$p5->SetColor("red");
|
||||
$p5->SetLegend('Mill 5');
|
||||
|
||||
// Create line 5
|
||||
$p6=new LinePlot($datax6);
|
||||
$graph->Add($p6);
|
||||
$p6->SetColor("green");
|
||||
$p6->SetLegend('Mill 6');
|
||||
|
||||
$graph->legend->SetFrameWeight(1);
|
||||
|
||||
// Output line
|
||||
$graph->Stroke();
|
||||
?>
|
||||
Reference in New Issue
Block a user