SVGGraph 2.25


“Improve the 3D pie slices” has been on the top of my SVGGraph to-do list for quite a long time. Version 2.25 of SVGGraph improves the 3D pie slices.

Version 2.24 added the ability to draw partial pie graphs by setting the end_angle option, but it didn't look at all right for the 3D pie graphs. If the example below had been drawn using version 2.24 the flat inside faces would be missing and the gradient over the curved sides would continue through the gap. Not good.

Better 3D pie slices

The improvements to the 3D pie slice drawing code means that some of the other pie graph types can be drawn in 3D now as well, so there are these two new graph types available:


The PolarArea3DGraph is just the PolarAreaGraph with the 3D code added, but I have made some changes to the existing ExplodedPieGraph as well as adding the ExplodedPie3DGraph. The code for calculating the explosion for both is in a separate file now, with the direction calculated better (because I could see from the 3D version of the exploded pie graph that the slices could sometimes end up overlapping.) There isn't a 3D version of the DonutGraph yet, but it is on the to-do list (the internal curves make it a bit more tricky).

Getting away from the pie graphs, this version also improves support for datetime keys in shapes and labels. You can now draw a box 5 hours long starting at 3:20pm if you like - I'll have to add a page describing how to use it properly, but the support is there. There are two more datetime options for formatting text as well, data_label_datetime_format and tooltip_datetime_format for when datetime keys are displayed in the labels and tooltips.

Some minor improvements in this version are the guidelines code being split out into its own file, and some Javascript functions removed from the main Graph class. I've cleaned up some warnings caused by changed behaviour and deprecated functions in PHP7.1 and PHP7.2, and spent quite a while testing the legend_show_empty option to make it more consistent.

Bugs fixed in this version include the semi-donut graph drawing a complete circle when there is just one value, multi-line text being incorrectly positioned on horizontal bar graphs, multi-line text being misaligned when minifying is disabled, bar tops missing from stacked grouped 3D bar graphs when there are 0 values and the legend being drawn the wrong width when entries contain numeric strings.

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

« Previous: SVGGraph 2.24.1 Next: JPEG Saver 4.19.3 »