SVGGraph 2.17

Published

Quite often changes happen to SVGGraph, or any of the software I release, due to requests from users. Sometimes users send me code that they have used to improve the software themselves - version 2.17 of SVGGraph includes both of these types of update.

The most obvious change in this version is the addition of a load of new functions for setting the colours used to draw the different bars or pie slices. I've been unhappy with the way SVGGraph deals with colour selection for quite a long time, but I haven't done anything about it until now because it worked well enough. Recently someone sent me through some code that added support for using a range of colours, and I liked it enough to incorporate it into the system. It meant overhauling the way that colours are picked, and it also gave me the chance to add a function for setting different colours for each dataset on a multi-dataset graph. This example shows two different colour ranges on one stacked bar graph.

The old $graph->Colours() function still works the same way, and setting $graph->colours directly still works too. Setting individual bar colours using structured data will still override any colour settings as well. The new colour functions are listed on the functions page, and are demonstrated on the colours, gradients and patterns page.

The second significant change in this version is also demonstrated by the example graph above, but you will have to resize the page to see it in action. Several people have asked me about allowing the graph to resize to fit inside some scalable elements, but it has been a bit tricky. I nearly had it working, but shelved my work when I was getting different results in different browsers. Another helpful user came to the rescue with some code that made it all work, and fixed the Javascript to work in the scaled SVG graph too. I've added a page to show how this works but it is fairly simple to set up using the new auto_fit option: responsive design page.

Also in this version are some new options that set the edges of the grid area to fixed positions, which is useful when you have multiple graphs on a page and you want their contents to line up. The new options are grid_left, grid_top, grid_right and grid_bottom, and they all override SVGGraph's automatic calculations for where the grid should go based on the spacing and text size. This means you have to leave enough space for the text or it won't fit on the graph. To make things a bit easier, the grid_right and grid_bottom options support negative values to specify a distance from the right or bottom of the SVG document instead of having to specify the absolute positions. (grid_left and grid_top support negative values too, but the left and top absolute positions are the same as the relative distances so it isn't very useful.)

There are a couple of bugs with the crosshairs Javascript code fixed in this version too. The new files are available from the downloads page.

« Previous: JPEG Saver 4.13.1 Next: TagCanvas 2.6 »

This site uses cookies - details here.