In general the only thing you need to do is to make sure your PHP files can include the required library files (as described below) and that your PHP installation supports at least one graphic format, i.e. it supports the “image” extension to PHP. This means that you must have a working GD-library together with PHP before even thinking of running JpGraph. Please make sure you have verion 4.02 or above of PHP since JpGraph will not work with versions prior to that.
If you want to use TTF fonts you must also make sure that your PHP installation supports TTF fonts (either through FreeType 1 or FreeType 2 libraries). In additions to this you need at least a couple of TTF fonts. In preparation of using TTF fonts with JpGRaph you must specify, in jpgraph.php , where those font files can be found.
1.1 Customizing the installation
In order for JpGraph to work you must adjust the cache and TTF directory to suit your installation. By default the TTF directory is “/local/fonts/ttf/” and the cache “/tmp/jpgraph_cache/”. These are defined as PHP defines at the top of jpgraph.php
These are base library files, which you must have
· Jpgraph.php, base library, always needed
To add plots to the graph you will need one or more of the following files
· Jpgraph_log.php, Plot extension to support logarithmic X and Y scales
· Jpgraph_line.php, Plot extension. Needed to draw various line plots
· Jpgraph_bar.php, Plot extension. Needed to draw various bar plots
· Jpgraph_error.php, Plot extension. Needed to draw various error plots
· Jpgraph_scatter.php, Plot extension. Needed to draw scatter and impuls plots.
· Jpgraph_spider.php, Plot extension. Needed to draw spider plots.
· Jpgraph_pie.php, Plot extension. Needed to draw Pie plots
· Jpgraph_canvas.php, “Dumy” plot extension to make it possible to draw arbitrary graphic on a canvas.
1.4 Graphic libraries requirements for PHP 4.02 and above
Per default the standard GD image library supports PNG graphic formats. You will need to have that installed together with your PHP module for this library to work at all. Please refer to PHP documentation on specifics. Note that the newer versions of GD does not support the GIF format due to copyright problems. Hence by default only PNG is supported. If you want JPEG support you will also need an additional library for PHP, again please see PHP documentation for specifics. For most practical purposes PNG is a better format since it normally achieves better compression then GIF (typically by a factor of 2 for the types of images generated by JpGraph). In comparison with JPEG format PNG is also better for the type of images generated by this library. So, the bottom line is, you should have a very good cause to use any other format then PNG.
By default the image format is set to “auto”. This means that JpGraph automatically chooses the best available graphic using the preferred order “PNG”, “GIF”, “JPG”.
Note: The reason that my site (www.aditus.nu) only displays GIF images is that my Web hotell doesn’t support a newer version of GD which allows PNG format. One of lifes small pains…This is the reason that I in most places just displays the PNG images directly in the img tag on my site without going through Jpgraph since the GIF format gives much bigger files and would make my site slower.