2013-05-06 123 views
1

我想用php創建圖形。我已經測試過jpgraph的例子。但它顯示錯誤 像如何使用php顯示來自數據庫值的圖形?

> The image 「http://localhost/test/jpgraphtest.php」 cannot be displayed 
> because it contains errors. 

<?php 
include('phpgraphlib.php'); 
$graph = new PHPGraphLib(500,350); 
$data = array(12124, 5535, 43373, 22223, 90432, 23332, 15544, 24523, 
32778, 38878, 28787, 33243, 34832, 32302); 
$graph->addData($data); 
$graph->setTitle('Widgets Produced'); 
$graph->setGradient('red', 'maroon'); 
$graph->createGraph(); 
?> 
+1

什麼問題?該文件有錯誤解決這些錯誤我的意思是這個問題是模糊的顯示相關的錯誤和源代碼 – 2013-05-06 05:10:47

+0

隱藏的代碼... – matzone 2013-05-06 05:19:47

回答

2

檢查此鏈接我認爲它的完美。

http://pchart.sourceforge.net/

(也應該配置PHP來實現意象的創造)。
在Windows中,您將在php.ini中包含GD2 DLL php_gd2.dll作爲擴展。在PHP 4.3.2中刪除了GD1 DLL php_gd.dll。另請注意,首選的truecolor圖像函數(如imagecreatetruecolor())需要GD2。

檢查這些鏈接。 http://www.php.net/manual/en/image.requirements.php
http://www.php.net/manual/en/image.installation.php
http://www.php.net/manual/en/image.configuration.php 例子:

ex01

ex02

+0

,爲什麼它是完美的? – swapnesh 2013-05-06 05:11:32

+0

@swapnesh我聽說過很多,現在清楚爲什麼它的完美? – ncm 2013-05-06 05:16:24

+0

我也在上面的鏈接中試過例子,但它也有同樣的錯誤。 – 2013-05-06 05:27:09

相關問題