SVGGraph 2.26
Published
Version 2.26 of SVGGraph is really just an update to the data and custom labels - there's not much else in it. Having said that, there are quite a few changes to the labels, as demonstrated by the example below.
The first update is the addition of new label types for use with the
data_label_type
option. The new types are “circle”,
“square”, “linecircle”, “linebox”,
“linesquare” and “line2”. The “circle” and
“square” types are similar to the “box” style from
earlier versions, just an enclosing shape around the text label. The other
types have some more options to play with.
The “linecircle”, “linebox” and
“linesquare” styles are all shapes with filled line tails sticking
out of them. The “line2” style is more similar to the
“line” style - the text is out in the open with a tail line drawn
from it, but this time the tail is a filled shape. What happens at the end of
the tail is controlled by several new options,
data_label_tail_end
, data_label_tail_end_width
and
data_label_tail_end_angle
.
The data_label_tail_end
option specifies which type of line
ending to use from this list: “flat”, “taper”,
“point”, “filled”, “diamond”,
“arrow”, “tee”, “round”. The size of the
ending is adjusted using the data_label_tail_end_width
option,
though SVGGraph will adjust the width or fallback to a simpler shape if there
is not enough space available. The data_label_tail_end_angle
specifies the angle of the pointed tail endings.
The example also uses a new setting for the
data_label_tail_length
option - when it is set to
“auto” instead of a length in pixels the graph returns a set of
coordinates for the label to point at. For the bar graphs this is in the centre
of the bar, but for pie-type graphs it is either the centre of the slice or the
outside of the slice, depending on whether the label is inside or outside the
pie slice.
All the new label style options are available for use globally, or in
structured data, or in custom labels with the "data_label_"
bit
removed.
Another new option for the labels is data_label_same_size
,
which makes all the labels the same size when enabled. The size of all the
labels is calculated first, then the size of the largest label is used for all
the labels. This can be used for all the labels on the graph, or using an array
to set it per-dataset.
Finally, there is one non-label option added in this version:
no_tspan
. When enabled it makes SVGGraph draw multi-line text
using separate <text>
elements instead of
<tspan>
elements. This is for improved compatibility with
software that doesn't render <tspan>
elements very well.
The new version is available from the downloads page, or from GitHub, etc.