SVGGraph 2.6

Published

The new version of SVGGraph adds a number of features that have been requested several times - graph titles, axis labels and a legend for showing what the items on the graph mean.

I've resisted adding these for a long time, mainly because doing anything with text in SVG is quite awkward. As the text is rendered in the browser using the fonts and settings that the end user has available, SVG does not provide any text measuring functions - so knowing how much space a line of text is going to take up is a bit tricky. The new graph_title_*, label_* and legend_* options are available now anyway, and I've provided several extra options for adjusting how the text looks. In total, there are around 40 new options in this version.

The other major change in this version is mostly internal. The zip or tar file now contains a new svggraph.ini file, which must be installed with the class files. This file contains all the default values for the options used by all SVGGraph classes. Before this version the default values were set as class member properties, which was fine when there were just a few options but it was now beginning to make things cumbersome.

With the defaults moved out to the ini file only member variables used by the classes remain present in the class files, which makes the code easier to maintain. It also makes it easier to pass the class settings to other classes, which meant I could more easily split the Javascript functions out into a separate class file, SVGGraphJavascript.php.

As a side-effect, the use of an ini file also makes it easier to configure the default values for use with all graphs. The ini file uses the standard PHP ini file syntax, as it is loaded using the standard parse_ini_file PHP function. I haven't extensively tested changing the defaults in the ini file, so if you try it and experience any problems, please email me.

The new version of SVGGraph is available from the downloads page and you can see some more information about the new options on the titles, labels and legends page.

« Previous: TagCanvas 1.14 Next: TagCanvas 1.15 »

This site uses cookies - details here.