ff19

Troubleshooting

Dec 22nd, 2011
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.56 KB | None | 0 0
  1. <?php
  2.  
  3. // Data preparation
  4. $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";
  5. $rawdata = mysql_query($query, $db);
  6.  
  7. $data = array(
  8.     array(1,2,3,4,5),
  9.     array(1.2,2.3,3.1,4.1,5.3));
  10.  
  11.  
  12. // content="text/plain; charset=utf-8"
  13. require_once ('/home/mrx/jpgraph/src/jpgraph.php');
  14. require_once ('/home/mrx/jpgraph/src/jpgraph_line.php');
  15.  
  16.  // Some (random) data
  17. $ydata   = array(11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
  18. $ydata2  = array(1, 19, 15, 7, 22, 14, 5, 9, 21, 13 );
  19.  
  20. // Size of the overall graph
  21. $width=900;
  22. $height=600;
  23.  
  24. // Create the graph and set a scale.
  25. // These two calls are always required
  26. $graph = new Graph($width,$height);
  27. $graph->SetScale('linlin');
  28. //$graph->SetShadow();
  29.  
  30. // Setup margin and titles
  31. //$graph->SetMargin(40,20,20,40);
  32. $graph->title->Set('BTCUSD on Mt.Gox');
  33. $graph->subtitle->Set('last day');
  34. $graph->xaxis->title->Set('Time');
  35. $graph->yaxis->title->Set('Price');
  36.  
  37. //$graph->yaxis->title->SetFont( FF_FONT1 , FS_BOLD );
  38. //$graph->xaxis->title->SetFont( FF_FONT1 , FS_BOLD );
  39.  
  40. // Create the first data series
  41. $lineplot=new LinePlot($ydata);
  42. //$lineplot->SetWeight( 2 );   // Two pixel wide
  43.  
  44. // Add the plot to the graph
  45. $graph->Add($lineplot);
  46.  
  47. // Create the second data series
  48. $lineplot2=new LinePlot($ydata2);
  49. //$lineplot2->SetWeight( 2 );   // Two pixel wide
  50.  
  51. // Add the second plot to the graph
  52. $graph->Add($lineplot2);
  53. $graph->img->SetImgFormat('png');
  54. // Display the graph
  55. $graph->Stroke();
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment