我用 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
我没有看到问题...
如果我删除调试,并取消注释 $graph->Stroke(); 线。我有这个 :
你能帮助我吗 ?
先感谢您。