如何使用PHP从数据库值显示图形?

时间:2013-05-06 05:08:15

标签: php graph

我想用php创建图形。我测试了jpgraph的例子。但它显示错误 像

> 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 个答案:

答案 0 :(得分:2)

检查此链接我认为它是完美的。

http://pchart.sourceforge.net/

(你也应该配置php来启用图像创建) 在Windows中,您将包含GD2 DLL php_gd2.dll作为php.ini中的扩展。在PHP 4.3.2中删除了GD1 DLL php_gd.dll。另请注意,首选的真彩色图像函数,例如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

相关问题