Mar 08 2008
JpGraph
4.3 JpGraph
I use JpGraph for some websites I run. It's a PHP package that produces good-looking graphs.
4.3.1 Installing JpGraph
You have to do a fun bunch of setup to get JpGraph all the stuff it needs to work with. We're going to need to be able to extract some stuff from some CAB files for starters. Re-enable the yum Dag repository by setting enabled=1 in /etc/yum.repos.d/Dag.repo (see the Postgrey section where I set this repository up).
Once that's done, continue on. First we need to install cabextract, then get some Microsoft TT fonts. See http://corefonts.sourceforge.net/ for updated instructions on that, otherwise:
- yum install cabextract
- mkdir /usr/src/msttcorefonts
- cd /usr/src/msttcorefonts
- wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
- rpmbuild -bb msttcorefonts-2.0-1.spec
The fonts should be downloaded from SourceForge and compiled into an RPM. The new RPM will reside under the standard RPM build architecture. Install it:
- rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
Now for Jpgraph. Go to http://www.aditus.nu/jpgraph/jpdownload.php and get the download link for the latest version.
- cd /srv/www
- wget [link]
- tar zxvf jpgraph-[version].tar.gz
- ln -s jpgraph-[version]/ jpgraph
- rm jpgraph-[version].tar.gz
The JpGraph code sits above any website document roots I might have set up. I can include Jpgraph into my web code and use it there, but the code itself is not directly accessible from the web.
Disable the Dag repository again by setting enabled=0 in /etc/yum.repos.d/Dag.repo
4.3.2 Configure JpGraph
Edit /srv/www/jpgraph/src/jpg-config.inc.php and set the following line:
Note: If fonts aren't appearing in your graphs, make sure that you compiled PHP with the "-dir" options pointing to the right lib*.so files (/usr/lib)




