Contents Previous Next

2 Introduction

2.1 Version

This manual covers version 1.15 of JpGraph. A 2D graph plotting library for PHP 4.2 and above.

Even though the library is known to work with version of PHP prior to 4.2 the library is not tested nor is it recommended to run with any older versions of PHP.

2.2 Software License

JpGraph 1.x is released under a dual license QPL 1.0 (Qt-License) for non-commercial (including educational) use of the library and the JpGraph Professional License for commercial use.

2.3 JpGraph Features

This is a truly OO graph library which makes it easy to both draw a "quick and dirty" graph with a minimum of code and quite complex graphs which requires a very fine grain of control. The library tries to assign sensible default values for most parameters hence making the learning curve quite flat since for most of the time very few commands is required to draw graphs with a pleasing esthetic look.

Some highlights of available features are

In addition to these high level features the library has been designed to be orthogonal and very coherent in its' naming convention. For example, to specify color each object (i.e. axis, grids, texts, titles etc) within the graph implements the method SetColor() with the same signature.

2.4 Getting the latest version

The latest version of jpgraph can always be found on http://www.aditus.nu/jpgraph/

The current version as of this writing is 1.15

Note. I keep a strait-forward version scheme to avoid the version number inflation. This means

2.5 Planned future addition

All the following features, which have not been marked as tentatively, will be added. The time frame for these versions are: For the latest update on planned future version see the web-site for JpGraph at http://www.aditus.nu/jpgraph/

2.6 Known bugs and omissions

2.7 Acknowledgments

The idea for writing this library grew out of my own needs for a high quality graph drawing library for PHP4. Before reinventing the wheel I searched the net to see if there where anything already available that would meet my needs. When searching I found three other PHP graph plotting libraries:
  1. "chart 0.3" http://quimby.gnus.org/circus/chart/chart-0.3.tar.gz, by Lars Magne Ingebrigtsen
  2. "ykcee.php", http://ykcee.sourceforge.net
  3. "phplot.php", http://www.phplot.com
All these libraries implements some fine graphic features but unfortunately none of those completely fulfilled our needs either for available functionality (for example none of these supported both two Y-scales, auto-scaling, and logarithmic scales), or general flexibility, I especially needed the option of two Y-scales, which none of the above packages supported. My own preference for design was closest to "chart 0.3" so I started by fixing some small bugs in that package and adding some new features. However I soon realized that to add all the features and flexibility I wanted to "chart 0.3" it would require a complete rewrite since the original design wasn't flexible enough, especially adding a second Y-scale would require a more flexible OO architecture. Since at the time I was also interested in giving PHP a try to see how well it would support a fully object oriented design so I started designing this library. The library is completely written from scratch but I have taken some ideas, especially the caching feature from "chart 0.3" and implemented this. I'm therefore thankful for those ideas. Any bugs and faults within the code are completely my own.

2.8 A note on Implementing an OO library in PHP4

In terms of OO support PHP is still at loss to Java, Eiffel or C++ but since it always been my view that OO design is more a state of mind then of implementation details it is still possible to arrive with a decent OO design even in PHP. One of the big obstacles is probably the very different assigning semantics used by PHP as compared to other OO languages since it is always copies of the object that is passed around by default and not references. This took some time for me personally to get used to (giving my own background in OO design in Java, Eiffel and C++). There is also a bug (present in all versions <=4.04pl1) that makes it impossible to use a reference to the '$this' pointer in the constructor. This has an easy workaround by adding an extra method, say Init(), which is called immediately after the constructor and may safely use a reference to '$this' pointer. As an example of JpGraph's OO features this is, to my knowledge, the only piece of PHP code to fully implement the Observer pattern.

2.9 Reporting bugs and suggesting improvements

Bug reports and suggestions are always welcome. We only ask you to make sure that you read the requirements and the FAQ before submitting bugs and making sure you have an up to date version of PHP4, the necessary graphic libraries etc. We will unfortunately not be able to answer standard OO or PHP4 questions. Neither do we have the time to give PHP/GD/TTF/Apache installation support. Please see the corresponding documentation and relevant FAQ. We simply don't have the bandwidth to help with these kinds of installations.

Please note that this library will not work with versions prior to PHP 4.1

Bug reports and suggestions should be sent to jpgraph@aditus.nu


Contents Previous Next