SVGGraph 3.2
Published
SVGGraph 3.2 is a fairly minor update, adding a few new options but mostly fixing things. The first thing on the list uses a new option to fix a problem that has been around for a long time.
Zero length axis
The most important new option is axis_fallback_max
, which
defaults to 1 and sets the value for the end of the axis when SVGGraph can't
figure it out from the data. Up until now passing in data with all the values
being 0 resulted in an unhelpful “Zero length axis” error message,
since I didn't want to choose an arbitrary value to put at the end of the axis
in case it didn't make sense for the intended use of the graph.
Now the Y-axis will end at the value of the axis_fallback_max
option if there are no non-zero values and the axis_max_v
option
(or axis_max_h
option for horizontal graphs) is not set. So this
means I have finally chosen an arbitrary value, and it is 1*.
Legend order
The second new option is legend_order
, which allows you to
override the order of entries that SVGGraph would usually pick for the legend.
The legend can keep the normal order of the entries, or it can be reversed,
sorted alphabetically, or given a specific order using an array.
More new options
The axis_label_position
option and its per-axis variants
axis_label_position_h
and axis_label_position_v
were
contributed via GitHub. They
allow you to shift the position of the axis description labels along the axis
one way or the other.
The other new option is dataset
, which is supported by all the
pie-type graphs to choose which dataset from a multi-dataset array of values
will be used to display the graph. This might not sound very useful, but it
should make it easier to display multiple pie graphs as subgraphs.
Fixes
Here's the list of fixes, in no particular order:
- The default order of the legend on multi-dataset graphs could be wrong when the first dataset starts with zero values.
- The legend was not appearing at all for the stacked bar and line graph and population pyramid.
- The tooltips for 3D polar area graphs were sometimes coming from the value of the obscured slice edge underneath another slice.
- The crosshairs were appearing in the wrong place when the magnifier is enabled.
- The axis was not labelling 0 when the data contains a 0 key and
force_assoc
is enabled. - With magnification enabled, the tooltips over subgraphs were being magnified.
Where to get it
SVGGraph 3.2 is available from the downloads page, or from GitHub and via Composer / Packagist.
* If I had a brain the size of a planet I would probably have picked 42.