In-depth explanation of PHP statistical charts. You can use GoogleChartAPI to create various statistical charts. Currently, linear charts, column charts, pie charts, scatter plots, and graphs are supported. The GoogleChartsAPICode page is correct.
The Google Chart API can generate various statistical charts. Currently, linear charts, column charts, pie charts, scatter charts, and graphs are supported. The Google Charts API Code page provides detailed instructions on the use of this API, but it is still a little tedious. Today, I found that someone has developed a PHP statistical chart class in this area. There are also three examples. I will pick an example and explain how to use it in combination with my own project:
- <? Php
- Include ('googchart. class. php ');
- // Import the Google Chart API class
- $ Chart = new GoogChart ();
- // Instantiate a GoogChart object
- $ Servers = get_max_servers ();
- // Obtain the ranking of the 17fav.com favorites service
- $ Data = array (); // initialize data
- Foreach ($ servers as $ server ){
- $ Data ["$ server->Server_name "] = $ server->
Server _number/100;
- // Except 100, it is found during the test.
Chart API not supported>= A value of 100.
- }
- $ Color = array (
- '# FF6600 ′,
- '# Ffb380 ′,
- '# FFD9BF ',
- '# DFBEA7 ′,
- '# Bf8660 ′,
- '# Aa6639 ′,
- ); // Set the image color
- $ Chart->SetChartAttrs (array (
- 'Type' =>'Pie', // pie chart
- 'Title' =>'Favorites & Sharing ', // image name
- 'Data' =>$ Data, // image data
- 'Size' =>Array (468,300), // Image size
- 'Color' =>$ Color // image color
- ));
- Echo $ chart; // output image
- ?>
The above is the specific implementation method of the PHP statistical chart class.
Google Chart API can generate various statistical charts. Currently, linear charts, column charts, pie charts, scatter charts, and graphs are supported. Google Charts API Code page has this...