By using us to
Google Chart API can produce a variety of statistical charts, currently support line chart, column chart, pie chart, scatter chart, graph. The Google Charts API Code page has detailed instructions for using this API, but it's also a bit cumbersome. Today, I found someone who developed a PHP statistical chart class for this area, and also included three examples, and I'll pick an example to show you how to use it with one of my projects:
- < ? PHP
- Include (' GoogChart.class.php ');
- Import Google Chart API classes
- $ Chart = New Googchart ();
- Instantiate a Googchart object
- $ Servers = get_max_servers ();
- Get 17fav.com Favorite Service rankings
- $ Data = Array ();//Initialize Data
- foreach ($servers as $server) {
- $data ["$server->server_name"] = $server- >
server_number/100;
- Here, except for 100, it was discovered when the test was
The Chart API does not support >=100 values.
- }
- $ Color = Array (
- ' #FF6600,
- ' #FFB380,
- ' #FFD9BF ',
- ' #DFBEA7,
- ' #BF8660,
- ' #AA6639,
- ); Set the color of an image
- $chart- > setchartattrs (Array (
- ' type ' = > ' pie ',//pie chart
- ' title ' = > ' Favorites & Shares ',//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 of the PHP statistical chart class.
http://www.bkjia.com/PHPjc/445920.html www.bkjia.com true http://www.bkjia.com/PHPjc/445920.html techarticle with us through the Google chart API can produce a variety of statistical charts, currently support line chart, column chart, pie chart, scatter chart, graph. Google Charts API Code page has to this ...