Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php JpGraph:没有错误,但图片已损坏_Php_Jpgraph - Fatal编程技术网

Php JpGraph:没有错误,但图片已损坏

Php JpGraph:没有错误,但图片已损坏,php,jpgraph,Php,Jpgraph,我用JPGraph做了一个图,但我有一个小问题 未显示任何错误,但图片为“断开图片” 这是我的密码: $graph = new Graph(1000,300); $graph->img->SetMargin(40,30,50,40); $graph->SetScale("textlin"); $graph->title->Set("Graph"); $graph->ygrid->Show(); $graph->ygrid->SetC

我用JPGraph做了一个图,但我有一个小问题

未显示任何错误,但图片为“断开图片”

这是我的密码:

$graph = new Graph(1000,300);
$graph->img->SetMargin(40,30,50,40);    
$graph->SetScale("textlin");
$graph->title->Set("Graph");

$graph->ygrid->Show();
$graph->ygrid->SetColor('blue@0.7');
$graph->ygrid->SetLineStyle('dashed');

$graph->xgrid->Show();
$graph->xgrid->SetColor('red@0.7');
$graph->xgrid->SetLineStyle('dashed');

$graph->title->SetFont(FF_ARIAL,FS_BOLD,11);

$bigCourbe = array();
$i = 0;
foreach($bigData as $data)
{
    var_dump($data);

    $courbe = new LinePlot($data);
    $courbe->value->Show();

    $courbe->value->SetFont(FF_ARIAL,FS_NORMAL,9);
    $courbe->value->SetFormat('%d');

    $courbe->mark->SetType(MARK_FILLEDCIRCLE);
    $courbe->mark->SetFillColor("green");
    $courbe->mark->SetWidth(2);

    $courbe->SetWeight(10);         

    echo $function[$i];
    $courbe->SetLegend($function[$i++]);

    $bigCourbe[] = $courbe;
}

$graph->xaxis->title->Set("Heures");
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);

foreach ($bigCourbe as $elem) {
        $graph->Add($elem);
}

//$graph->Stroke();
因此,结果似乎不错:

array (size=24)
0 => string '0.000' (length=5)
1 => string '0.000' (length=5)
2 => string '0.000' (length=5)
3 => string '0.000' (length=5)
4 => string '0.000' (length=5)
5 => string '0.000' (length=5)
....
Index HC <- it's the $function[$i] var

array (size=24)
0 => string '0.200' (length=5)
1 => string '0.200' (length=5)
2 => string '0.100' (length=5)
3 => string '0.200' (length=5)
4 => string '0.200' (length=5)
5 => string '0.200' (length=5)
....
Index HP

array (size=24)
0 => string '0.000' (length=5)
1 => string '0.000' (length=5)
2 => string '0.000' (length=5)
3 => string '0.000' (length=5)
4 => string '0.000' (length=5)
5 => string '0.000' (length=5)
Index HPTE

array (size=24)
0 => string '0.200' (length=5)
1 => string '0.200' (length=5)
2 => string '0.100' (length=5)
3 => string '0.200' (length=5)
4 => string '0.200' (length=5)
5 => string '0.200' (length=5)
....
Total Heure
数组(大小=24)
0=>字符串“0.000”(长度=5)
1=>字符串“0.000”(长度=5)
2=>字符串“0.000”(长度=5)
3=>字符串“0.000”(长度=5)
4=>字符串“0.000”(长度=5)
5=>字符串“0.000”(长度=5)
....

索引HC如何显示图表?你有HTML页面吗?请显示HTML代码。 我有一个类似的问题,我没有错误消息,但得到了破碎的图像图标

我建议的一件事是添加行

//save to file
$fileName = "/tmp/imagefile.png";
$graph->img->Stream($fileName);

如果文件中的图像是正确的,那么您可以排除图形生成代码。

我知道这是一个老问题,但我也遇到了同样的问题,并通过删除
之前的所有内容来修复它。在我的案例(PHP7.1.0)中,它是不推荐使用的消息

ini_set('display_errors', 0);
在脚本的顶部,然后重试


注释掉
$graph->Stroke()并查看出现的错误(或警告)

确保所有字体都可用。所有字体都可用。不是这样的:(如果您将PHP设置为打印所有错误怎么办?PHP已经打印了所有错误:(