php JP图形页面全部为白色

php JP图形页面全部为白色,php,jpgraph,Php,Jpgraph,我正在尝试从站点加载条形图示例: 这是我的代码: error_reporting(E_ALL); ini_set('display_errors', '1'); chdir("/path/lib/jpgraph-4.0.1"); include ("jpgraph.php"); include ("jpgraph_bar.php"); $data1y=array(47,80,40,116); $data2y=array(61,30,82,105); $data3y=array(115,50

我正在尝试从站点加载条形图示例:

这是我的代码:

error_reporting(E_ALL); ini_set('display_errors', '1');

chdir("/path/lib/jpgraph-4.0.1");
include ("jpgraph.php");
include ("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();
如果我对行“
$graph->Stroke();
”进行注释,则会显示页面(没有图形),但这一行的页面为白色,没有错误,不会显示其他字符串

在php错误日志或apache日志上,我没有错误

编辑:问题已解决。

我将图表代码放在了其他页面上(例如chart.php),而不是主页上:

<img src="chart.php" />
然后在主页上

<img src="<?php echo $filename" />

在要更改的路径末尾添加斜杠:

chdir("/path/lib/jpgraph-4.0.1/");

必须删除图形文件中php第1行之前的任何空格,因为任何空行都被视为echo“”;并且图形文件应该没有回声或打印..等等。。然后使用其他文件中的img标记显示图形。。对于我来说,我将文件命名为graph.php,将另一个命名为stat.php,并在我编写的lats中。。您可以将mysql数据库中的数据导入到同一个图形文件中,但不能在其中^print。仅使用数据库中的数组作为图表的收入数据。抱歉,我使用英语,因为我的法语不太好

问题不在路径上,但我如何调用图表库您知道为什么echo语句会使图表不显示吗?
chdir("/path/lib/jpgraph-4.0.1/");