Fatal error: Call to undefined method Text::Pos() in D:\phpstudy\WWW\mr\06\303\index.php on line 37
慕容st 发表于2017-06-03 12:51
读者您好,请将相关代码粘贴,便于我们帮您分析和解决问题。
代码如下:
<?php
header ( "Content-type: text/html; charset=UTF-8" ); //设置文件编码格式
include ("../src/jpgraph.php");
include ("../src/jpgraph_pie.php");
$data = array(50,28,25,27,31,20);
$graph = new PieGraph(400,400); //创建图像
$graph->title->Set(iconv("utf-8","gb2312",'2009年图书销售分析')); //设置标题文字
$graph->title->SetFont(FF_SIMSUN, FS_BOLD,18); //设置字体
$graph->title->SetMargin(8); //设置边距
$p1 = new PiePlotC($data); //创建图像
$p1->SetSize(0.32); //设置图像大小
$p1->SetCenter(0.5,0.45); //定义图像存储位置
$p1->value->SetFont(FF_ARIAL,FS_BOLD,12); //设置数据的字体
$p1->value->SetColor('white'); //设置字体颜色
$p1->midtitle->Set(iconv("utf-8","gb2312","明日科技")); //输出中心内容
$p1->midtitle->SetFont(FF_SIMSUN, FS_BOLD,14); //设置字体
$p1->SetMidColor('yellow'); //设置中心图像颜色
$lbl = array("ASP.NET\n%.1f%%","C#\n%.1f%%","JAVA\n%.1f%%",
"PHP\n%.1f%%","VB\n%.1f%%","VC\n%.1f%%"); //定义数据内容
$p1->SetLabels($lbl);
$p1->SetShadow(); //生成阴影
$p1->ExplodeAll(20); //定义图像大小
$txt = new Text(iconv("utf-8","gb2312","2009年各语言出版图书所占市场份额")); //创建文本,并添加数据
$txt->SetFont(FF_SIMSUN, FS_BOLD,12);
$txt->Pos(0.5,0.97,'center','bottom'); //设置存储位置
$txt->SetBox('yellow','black'); //设置颜色
$txt->SetShadow(); //设置图像阴影
$graph->AddText($txt); //添加数据
$graph->Add($p1); //向图像中添加数据
$graph->StrokeCSIM(); //生成图像
?>