【发布时间】:2016-11-05 01:58:04
【问题描述】:
这是我的 PHP 代码:
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$data1y=array(47,80,40,116);
$data2y=array(61,30,82,105);
$data3y=array(115,50,70,93);
// Create the graph. These two calls are always required
$graph = new Graph(350,200,'auto');
$graph->SetScale("textlin");
$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->yaxis->SetTickPositions(array(0,30,60,90,120,150), array(15,45,75,105,135));
$graph->SetBox(false);
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('A','B','C','D'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b2plot = new BarPlot($data2y);
$b3plot = new BarPlot($data3y);
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot,$b3plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$b1plot->SetColor("white");
$b1plot->SetFillColor("#cc1111");
$b2plot->SetColor("white");
$b2plot->SetFillColor("#11cccc");
$b3plot->SetColor("white");
$b3plot->SetFillColor("#1111cc");
$graph->title->Set("Bar Plots");
// Display the graph
$graph->Stroke();
这是我的 HTML:
屏幕上没有错误消息。浏览器的控制台也是空的。
可能出了什么问题?我需要设置什么吗?
我试过这个链接:jpgraph doesn't work,但没有成功。
【问题讨论】:
-
你试过检查错误日志吗?你确定命令的顺序吗?在文档中,它说要添加新的 BarPlot,然后是 setFillColor,完成后,使用新的 GroupBarPlot 并添加
-
刚刚尝试了您的代码,工作正常.. 也许您缺少一些依赖项?喜欢
jpg-config.inc.php? -
嗨轻便摩托车。错误日志在哪里?
jpg-config.inc.php文件存在于文件夹中。