| Server IP : 172.67.187.206 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/myschool/triamudom/check/webadmin/S_Graph/jpgraph/Examples/ |
Upload File : |
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph.php');
require_once ('../jpgraph_line.php');
require_once ('../jpgraph_date.php');
DEFINE('INTERVAL', 5*60);
// First create some "dummy" data
$m = 5; // Number of data sets
$n = 4; // Number of bids to show
$startbid = 8000;
for( $i=0; $i < $m; ++$i ) {
$bids[$i] = array($startbid + rand(100,500)*10 );
for( $j=1; $j < $n; ++$j ) {
$bids[$i][$j] = $bids[$i][$j-1] + rand(20,500)*10;
}
}
$start = floor(time()/INTERVAL)*INTERVAL;
$times = array($start);
for( $i=1; $i < $n; ++$i ) {
// Create a timestamp for every 5 minutes
$times[$i] = $times[$i-1]+INTERVAL;
}
// Setup the bid graph
$graph = new Graph(600,250);
$graph->SetMargin(80,30,50,40);
$graph->SetMarginColor('white');
$graph->SetScale('dateint');
$graph->title->Set('Current Bids');
$graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
$graph->subtitle->Set('(Updated every 5 minutes)');
$graph->subtitle->SetFont(FF_ARIAL,FS_ITALIC,10);
// Enable antialias
$graph->img->SetAntiAliasing();
// Setup the y-axis to show currency values
$graph->yaxis->SetLabelFormatCallback('number_format');
$graph->yaxis->SetLabelFormat('$%s');
//Use hour:minute format for the labels
$graph->xaxis->scale->SetDateFormat('H:i');
// Force labels to only be displayed every 5 minutes
$graph->xaxis->scale->ticks->Set(INTERVAL);
// Adjust the start time for an "even" 5 minute, i.e. 5,10,15,20,25, ...
$graph->xaxis->scale->SetTimeAlign(MINADJ_5);
// Create the plots using the dummy data created at the beginning
$line = array();
for( $i=0; $i < $m; ++$i ) {
$line[$i] = new LinePlot($bids[$i],$times);
$line[$i]->mark->SetType(MARK_SQUARE);
}
$graph->Add($line);
// Send the graph back to the client
$graph->Stroke();
?>