php使用Jpgraph绘制3D饼状图的方法

yipeiwu_com6年前PHP代码库

本文实例讲述了php使用Jpgraph绘制3D饼状图的方法。分享给大家供大家参考。具体实现方法如下:

<?php 
include ("src/jpgraph.php"); 
include ("src/jpgraph_pie.php"); 
include ("src/jpgraph_pie3d.php"); 
$data = array(19,23,34,38,45,67,71,78,85,87,90,96); 
$graph = new PieGraph(400,300); 
$graph->SetShadow(); 
$graph->title->Set("年度收支表"); 
$graph->title->SetFont(FF_SIMSUN,FS_BOLD); 
$pieplot = new PiePlot3D($data); //创建PiePlot3D对象 
$pieplot->SetCenter(0.4); //设置饼图中心的位置 
$pieplot->SetLegends($gDateLocale->GetShortMonth()); //设置图例 
$graph->Add($pieplot); 
$graph->Stroke(); 
?> 

运行效果图如下:

希望本文所述对大家的php程序设计有所帮助。

相关文章

剖析 PHP 中的输出缓冲

我们先来看一段代码:     〈?php     for ($i=10; $i〉0;&...

PHP 实现代码复用的一个方法 traits新特性

在阅读yii2源码的时候接触到了trait,就学习了一下,写下博客记录一下。 自 PHP 5.4.0 起,PHP 实现了代码复用的一个方法,称为 traits。 Traits 是一种为类...

php判断访问IP的方法

本文实例讲述了php判断访问IP的方法。分享给大家供大家参考。具体如下: <?php function getIP() { if (! empty ( $_SE...

PHP实现加强版加密解密类实例

本文实例讲述了PHP实现加强版加密解密类。分享给大家供大家参考。具体如下: <?php class Ender{ private $enkey;//加密解密用的密钥...

php中file_get_contents()函数用法实例

我们先来看一下php中的 file_get_contents()函数的语法 string file_get_contents(string $ filename,bool $ inc...