已有40人关注
运行本章例12.4和例12.5的代码提示有错误
发表在PHP图书答疑 2021-11-11 《PHP从入门到精通(第4版)》第12章 图形图像处理技术 213页-224页
是否精华
版块置顶:

运行本书例12.4和例12.5时,都有同样的错误提示信息,如何解决:

Catchable fatal error:  Argument 1 passed to JpGraphException::defaultHandler() must be an instance of Throwable, instance of JpGraphExceptionL given in C:\AppServ\www\jpgraph\src\jpgraph_errhandler.inc.php on line 158

例12.5代码如下:


<?php

include ("jpgraph/src/jpgraph.php");

include ("jpgraph/src/jpgraph_line.php");

$datay = array(8320,9360,14956,17028,13060,15376,25428,16216,28548,18632,22724,28460);

$graph = new Graph(600,300,"auto");

$graph->img->SetMargin(50,40,30,40);   

$graph->img->SetAntiAliasing();

$graph->SetScale("textlin");

$graph->SetShadow();

$graph->title->Set("2009年《PHP从入门到精通》图书月销售额折线图");

$graph->title->SetFont(FF_SIMSUN,FS_BOLD);

$graph->SetMarginColor("lightblue");

$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);

$graph->xaxis->SetPos("min");

$graph->yaxis->HideZeroLabel();

$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');

$a=array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");

$graph->xaxis->SetTickLabels($a);

$graph->xaxis->SetFont(FF_SIMSUN);

$graph->yscale->SetGrace(20); 


$p1 = new LinePlot($datay);

$p1->mark->SetType(MARK_FILLEDCIRCLE);

$p1->mark->SetFillColor("red");

$p1->mark->SetWidth(4);

$p1->SetColor("blue");

$p1->SetCenter();

$graph->Add($p1);

$graph->Stroke();

?>


2021-11-11 16:20:41编辑
分享到:
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照