SVGGraph 3.1


SVGGraph 3.1 adds a few new things, the most significant being support for subgraphs, something that should make the EmptyGraph a bit more useful.


PieGraph subgraphs on a GroupedBarGraph

Subgraphs are basically entire graphs drawn on top of a parent graph. They can inherit the parent graph's settings, or have their own settings. Likewise, they can inherit the colours or have their own colour set. They don't inherit data values or lists of links though, because each graph can deal with its data in very different ways.

For the example above, the main graph is a GroupedBarGraph, and each PieGraph is a separate subgraph. I tried to come up with a vaguely useful-looking example, so here the pie graphs show the proportions of each of the bars underneath, something that is less obvious from looking at the bars.

Using subgraphs is not too difficult, but I have created a new web page to explain how to do it: the subgraphs page.


The next new feature that you probably noticed if you moved your cursor over the graph is magnification. There are two new options for this: magnify turns on magnification and sets the magnification factor (the example is magnified × 1.5) and magnify_pan specifies how sensitive the magnified area is to mouse movement.

Figure patterns

SVGGraph already had support for user-defined patterns, but it meant writing your own SVG code and pasting it in. Version 3.1 adds support for using SVGGraph figures as patterns, which should hopefully be easier than rolling your own SVG.

Tweaks and things

SVGGraph 3.1 has a new algorithm for choosing the Y-axis divisions, which should provide a more friendly-looking graph by default. Before, it could pick values like 1.9 for its divisions, and really had trouble with prime numbers and graphs that were more negative than positive, but now it should cope with these a lot more cleanly.

The Javascript code has been tidied away into a function so it should not interfere with any other code on the page, and the way it initializes handlers has been simplified. I also fixed a bug in the crosshairs text display and added a few optimisations where numbers were being converted to strings a lot.

The new version of SVGGraph is available from the downloads page, or from GitHub / Packagist with Composer.

« Previous: JPEG Saver 5.3 Next: JPEG Saver 5.4 »