<?php
require_once("jpgraph/jpgraph.php");
require_once("jpgraph/jpgraph_line.php");
require_once("jpgraph/jpgraph_date.php");
DEFINE('INTERVAL', 5*60);
$m = 5;
$n = 4;
$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 ) {
$times[$i] = $times[$i-1]+INTERVAL;
}
$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);
$graph->img->SetAntiAliasing();
$graph->yaxis->SetLabelFormatCallback('number_format');
$graph->yaxis->SetLabelFormat('$%s');
$graph->xaxis->scale->SetDateFormat('H:i');
$graph->xaxis->scale->ticks->Set(INTERVAL);
$graph->xaxis->scale->SetTimeAlign(MINADJ_5);
$line = array();
for( $i=0; $i < $m; ++$i ) {
$line[$i] = new LinePlot($bids[$i],$times);
$line[$i]->mark->SetType(MARK_SQUARE);
}
$graph->Add($line);
$graph->Stroke();
?> |