In-depth interpretation of PHP statistical chart class_PHP tutorial

WBOY
Release: 2016-07-15 13:35:11
Original
1526 people have browsed it

Using our Google Chart API to create various statistical charts, we currently support line charts, column charts, pie charts, scatter charts, Graph. The Google Charts API Code page has detailed instructions for using this API, but it is still a bit cumbersome. Today I found that someone has developed a PHP statistical chart class in this area, and it also includes three examples. I will choose an example and combine it with one of my own projects to explain how to use it:

  1. < ?php include( 'GoogChart.class.php' ) ;
  2. // Import Google Chart API class
  3. $
  4. chart = new GoogChart(); //Instantiate a GoogChart object
  5. $
  6. servers = get_max_servers(); //Get 17fav.com collection service ranking
  7. $
  8. data = array(); // Initialization data foreach ($servers as $server) {
  9. $data["$server-
  10. >server_name"] = $server->
    server_number/100;
    // The reason for excluding 100 here is that during testing, it was found that the Chart API does not support the value of

  11. >
    =100. }
  12. $
  13. color = array( '#FF6600′,
  14. '#FFB380′,
  15. '#FFD9BF', 
  16. '#DFBEA7′, 
  17. '#BF8660′ ,
  18. '#AA6639′,
  19. ); //Set the color of the image
  20. $chart-
  21. >setChartAttrs( array( 'type' =
  22. > 'pie', // Pie chart 'title' =
  23. > 'Collect & Share', // Image name 'data ' =
  24. > $data, // Image data 'size' =
  25. > array(468, 300), // Image size 'color' =
  26. > $color // Image color )) ;
  27. echo $chart; // Output image
  28. ?>
  29. The above is the specific implementation method of the PHP statistical chart class.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445920.htmlTechArticleWe can use the Google Chart API to create various statistical charts. Currently, we support line charts, column charts, Pie charts, scatter plots, line graphs. The Google Charts API Code page has this...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!