Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Data preparation
- $query = "SELECT * FROM (SELECT UNIX_TIMESTAMP(time) AS time, sell AS sell, buy AS buy, id AS id FROM BTCUSD_MTG ORDER BY id DESC LIMIT 1440) AS t ORDER BY id ASC";
- $rawdata = mysql_query($query, $db);
- $data = array(
- array(1,2,3,4,5),
- array(1.2,2.3,3.1,4.1,5.3));
- // content="text/plain; charset=utf-8"
- require_once ('/home/mrx/jpgraph/src/jpgraph.php');
- require_once ('/home/mrx/jpgraph/src/jpgraph_line.php');
- // Some (random) data
- $ydata = array(11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
- $ydata2 = array(1, 19, 15, 7, 22, 14, 5, 9, 21, 13 );
- // Size of the overall graph
- $width=900;
- $height=600;
- // Create the graph and set a scale.
- // These two calls are always required
- $graph = new Graph($width,$height);
- $graph->SetScale('linlin');
- //$graph->SetShadow();
- // Setup margin and titles
- //$graph->SetMargin(40,20,20,40);
- $graph->title->Set('BTCUSD on Mt.Gox');
- $graph->subtitle->Set('last day');
- $graph->xaxis->title->Set('Time');
- $graph->yaxis->title->Set('Price');
- //$graph->yaxis->title->SetFont( FF_FONT1 , FS_BOLD );
- //$graph->xaxis->title->SetFont( FF_FONT1 , FS_BOLD );
- // Create the first data series
- $lineplot=new LinePlot($ydata);
- //$lineplot->SetWeight( 2 ); // Two pixel wide
- // Add the plot to the graph
- $graph->Add($lineplot);
- // Create the second data series
- $lineplot2=new LinePlot($ydata2);
- //$lineplot2->SetWeight( 2 ); // Two pixel wide
- // Add the second plot to the graph
- $graph->Add($lineplot2);
- $graph->img->SetImgFormat('png');
- // Display the graph
- $graph->Stroke();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment