Skip to content
Snippets Groups Projects
Commit 5bc30d2f authored by Philip's avatar Philip
Browse files

web code

parent f5511c95
Branches
No related tags found
No related merge requests found
Showing
with 94 additions and 0 deletions
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
<?php
class SQL{
private $link;
private $dbHost = "localhost";
private $dbUser = "root";
private $dbPass = "";
private $dbName = "iot";
function __construct(){
$this->link = new mysqli($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
$this->link->set_charset("utf8");
}
public function getLink(){
return $this->link;
}
}
?>
\ No newline at end of file
<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$data1y=array(-8,8,9,3,5,6);
$data2y=array(18,2,1,7,5,4);
// Create the graph. These two calls are always required
$graph = new Graph(500,400);
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40,30,20,40);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$b1plot->value->Show();
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
$b2plot->value->Show();
// Create the grouped bar plot
$gbplot = new AccBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$graph->title->Set("Accumulated bar plots");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
// Display the graph
$graph->Stroke();
?>
<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$datay1=array(13,8,19,7,17,6);
$datay2=array(4,5,2,7,5,25);
// Create the graph.
$graph = new Graph(350,250);
$graph->SetScale('textlin');
$graph->SetMarginColor('white');
// Setup title
$graph->title->Set('Acc bar with gradient');
// Create the first bar
$bplot = new BarPlot($datay1);
$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT);
$bplot->SetColor('darkred');
// Create the second bar
$bplot2 = new BarPlot($datay2);
$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT);
$bplot2->SetColor('darkgreen');
// And join them in an accumulated bar
$accbplot = new AccBarPlot(array($bplot,$bplot2));
$graph->Add($accbplot);
$graph->Stroke();
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment