phpUserTrack
[ class tree: phpUserTrack ] [ index: phpUserTrack ] [ all elements ]

Source for file graphUserAgents.php

Documentation is available at graphUserAgents.php

  1. <?php
  2.  
  3. require_once './../include/version.php';
  4. require_once './../lib/core.php';
  5.  
  6. include ('jpgraph/jpgraph.php');
  7. include ('jpgraph/jpgraph_pie.php');
  8.  
  9. $db new phpusertrack_db();
  10. $sql 'select browser, count(id)*100/(select count(*) from phpusertrack_ip) as percent from phpusertrack_ip group by browser order by percent desc limit 10';
  11. $avgs $db->_query($sql);
  12.  
  13. // Create the graph. These two calls are always required
  14. $graph new Graph(500,233);   
  15. //$graph->img->SetAntiAliasing(); 
  16. $graph->SetScale("textlin");
  17.  
  18. $data array();
  19. $xdata array();
  20.  
  21. foreach ($avgs as $avg{
  22.     array_push($data(int)$avg['percent']);
  23.     array_push($xdata(int)$avg['browser']);
  24. }
  25.  
  26. // Create a bar pot
  27. $plot new PiePlot($data$xdata);
  28. $graph->Add($plot);
  29.  
  30. // Display the graph
  31. $graph->Stroke();
  32.  
  33. ?>

Documentation generated on Tue, 06 Nov 2007 09:21:51 -0800 by phpDocumentor 1.4.0a2