pchart
Created and maintained by Jean-Damien Pogolotti, a systems engineer based in Toulouse, France, pChart is a library that creates anti-aliased charts and graphs using PHP. It’s object-oriented code has been recently redesigned and makes it easy to add beautiful, eye-catching data. The library is free for non-profit use and for inclusion in GPL distributed software; licensing plans for other uses start at just 50€. In this article I’ll take you through installing pChart and using it to generate a basic chart, line chart and plot graph.
pChart由法国图卢兹的系统工程师Jean-Damien Pogolotti创建和维护,pChart是一个使用PHP创建抗锯齿图和图形的库。 它的面向对象代码最近经过了重新设计,可以轻松添加漂亮的,引人注目的数据。 该库可免费用于非营利用途,也可以包含在GPL分布式软件中; 其他用途的许可计划起价仅为50欧元。 在本文中,我将指导您安装pChart并使用它生成基本的图表,折线图和绘图图。
安装 (Installation)
pChart likes PHP 5+ and requires the GD and FreeType extensions. These should be installed and enabled by default with version 5, but it’s a good idea to double check using the phpinfo()
function. The function generates a full description of your PHP installation. If you see a “gd” section which reports both GD and Free Type support are enabled in its output, you should be able to use pChart.
pChart喜欢PHP 5+,并且需要GD和FreeType扩展。 默认情况下,应在版本5中安装并启用这些功能,但是最好使用phpinfo()
函数进行仔细检查。 该函数生成您PHP安装的完整描述。 如果看到“ gd”部分报告在其输出中启用了GD和自由类型支持,则您应该能够使用pChart。
If you are working on a local development system, don’t forget to check your hosting server before deploying your application. A shared hosting scheme shouldn’t pose any problems, but if you are using a VPS then you may have to ask the administrator to recompile PHP with GD and FreeType support if it’s lacking.
如果您在本地开发系统上工作,请不要忘记在部署应用程序之前检查托管服务器。 共享托管方案应该不会造成任何问题,但是,如果您使用的是VPS,则可能需要让管理员重新使用缺少GD和FreeType支持PHP。
pChart can be download from www.pchart.net/download. As of this writing, the latest version of the library is 2.1.3. Download the library and make note of the MD5 checksum listed alongside it on the webpage; it’s a good idea to verify the checksum of the file you download to make sure they match. On unix systems you can verify the checksum like this:
可以从www.pchart.net/download下载pChart 。 在撰写本文时,该库的最新版本是2.1.3。 下载库并记下网页上列出的MD5校验和; 最好验证下载文件的校验和,以确保它们匹配。 在Unix系统上,您可以像这样验证校验和:
jajeronymo@web1:~$ md5sum pChart2.1.3.zip
7895f71126638cbfb73b69c987418107 pChart2.1.3.zip
Then unzip the package. In my case the contents are automatically put into a folder pChart2.1.3
. Read the readme.txt
file which explains what pChart is, what it’s requirements are, and perhaps most importantly what the various files in code base are. Then either move the folder or create a symbolic link to it (or both), depending on the needs of your application.
然后解压缩包。 在我的情况下,内容自动放入文件夹pChart2.1.3
。 阅读readme.txt
文件,该文件说明什么是pChart,它的要求是什么,也许最重要的是,代码库中的各种文件是什么。 然后,根据应用程序的需要,移动文件夹或创建指向该文件夹的符号链接(或两者)。
jajeronymo@web1:~$ unzip pChart2.1.3.zip
jajeronymo@web1:~$ sudo -i
[sudo] password for jajeronymo: ********
root@web1:~# mv /home/jajeronymo/pChart2.1.3 /srv/www/lib/
root@web1:~# cd /srv/www/lib
root@web1:/srv/www/lib# ln -s pChart2.1.3 pChart
Did you read the readme.txt
file yet? No!? Do it now, please. It’s a healthy habit.
您