Advertisement
Guest User

Untitled

a guest
Jun 13th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. function barChart($filename, $ydata, $xdata){
  2.  
  3. // Create the graph. These two calls are always required
  4. $graph = new Graph(900,500);
  5. $graph->SetScale('textlin');
  6.  
  7. //(bunch of styling stuff)
  8.  
  9. // Create the bar plot
  10. $bplot=new BarPlot($ydata);
  11.  
  12. // Add the plot to the graph
  13. $graph->Add($bplot);
  14.  
  15. //(more styling stuff)
  16.  
  17.  
  18. // Display the graph
  19. $graph->Stroke($filename);
  20.  
  21. $graph = null;
  22. $bplot = null;
  23.  
  24. unset($graph);
  25. unset($bplot);
  26.  
  27. echo "<br><br>".(memory_get_peak_usage(true)/1048576)."<br><br>";
  28. }
  29.  
  30. // load fonts only once, and define a constant for them
  31. define("GD_FF_FONT0", imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT0.gdf"));
  32. define("GD_FF_FONT1", imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT1.gdf"));
  33. define("GD_FF_FONT2", imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT2.gdf"));
  34. define("GD_FF_FONT1_BOLD", imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT1-Bold.gdf"));
  35. define("GD_FF_FONT2_BOLD", imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT2-Bold.gdf"));
  36.  
  37. $this->ff_font0 = imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT0.gdf");
  38. $this->ff_font1 = imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT1.gdf");
  39. $this->ff_font2 = imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT2.gdf");
  40. $this->ff_font1_bold = imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT1-Bold.gdf");
  41. $this->ff_font2_bold = imageloadfont(dirname(__FILE__) . "/fonts/FF_FONT2-Bold.gdf");
  42.  
  43. $this->ff_font0 = GD_FF_FONT0;
  44. $this->ff_font1 = GD_FF_FONT1;
  45. $this->ff_font2 = GD_FF_FONT2;
  46. $this->ff_font1_bold = GD_FF_FONT1_BOLD;
  47. $this->ff_font2_bold = GD_FF_FONT2_BOLD;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement