SVGGraph 2.20

Published

There are two major new features in version 2.20 of SVGGraph, both of which are demonstrated in this example:

BarGraph with shapes and labels

The example is a simple BarGraph with the vertical axis maximum increased a bit so I can fit in some extra stuff. The extra stuff in this case is made up of shapes and custom labels - configured using the new shape and label options. All of the graph types support shapes and custom labels, but the grid-based graphs also support positioning and sizing them on the grid and in grid units.

These new options each have a new page to explain how to use them in detail: shapes and custom labels.

The example above also demonstrates the updated grid_back_stripe_colour option, which now supports an array of colours to display in turn. It now supports using gradients and patterns for the colours as well. There are also new grid_back_opacity and grid_back_stripe_opacity options for more control over the grid background appearance.

While I'm talking about gradients, this version adds support for specifying the gradient stops explicitly. This means you can now have a gradient that starts off one colour, changes to another over 10%, then changes again over the next 10% and the last change is the remaining 80%. That would look something like this:

$gradient = array("red", "10:blue", "20:green", "yellow");

You can also use the same stop value twice to change colour abruptly:

$gradient = array("red", "10:blue", "10:green", "yellow");

This one will start off red, transition to blue after 10%, immediately change to green, then blend from green to yellow over the remaining 90%. This also works with opacity values in the string, which you can see in the example on the colours, gradients and patterns page.

Not shown on the graph above are the two new graph types in this version: StackedGroupedBar3DGraph and StackedGroupedCylinderGraph, the 3D bar and cylinder versions of the existing StackedGroupedBarGraph. They work in exactly the same way, requiring the stack_group option to be set to specify which datasets are stacked or grouped.

There are a few bugs fixed in this version: using spl_autoload would cause problems with SVGGraph's class loader; patterns were being redefined instead of reused in the <defs> section; the Javascript crosshair coordinates were jumping around when they should have been switching sides of the crosshair lines.

The new version is available from the downloads page, or from GitHub, or using Composer.

« Previous: JPEG Saver 4.15a Next: SVGGraph 2.20.1 »

This site uses cookies - details here.