SVGGraph currently contains these classes for drawing line
graphs: LineGraph; MultiLineGraph; StackedLineGraph.
An example of each type is shown below.

LineGraph

MultiLineGraph

The LineGraph class displays a single set of data as a joined
line. The example above uses the fill_under option to fill the
area between the data line and the X-axis.

The MultiLineGraph displays multiple data sets as lines drawn
one on top of another, starting with the first data set as the bottom layer.

StackedLineGraph

The StackedLineGraph displays multiple data sets with their
values added together. The fill_under option is enabled by default,
though the filled area is between the data lines instead of between the data
line and the X-axis.

BarAndLineGraph

StackedBarAndLineGraph

The BarAndLineGraph is a GroupedBarGraph and a
MultiLineGraph on the same graph, with an option specifying which
datasets are bars and which are lines. The StackedBarAndLineGraph
is a StackedBarGraph and MultiLineGraph in one
graph using the same line_dataset option for specifying the lines.

This is not the actual code used - I have adapted it to make it easier to copy
and paste it into a new file to try for yourself. To change the type of graph
generated, change 'LineGraph' in the final call to $graph->Render
to one of the other types.

MultiLineGraph and StackedLineGraph options

To specify different styling for each line on these types of graph, several
of the options support using arrays of values. The options that support arrays
are:

line_stroke_width

line_dash

fill_under

fill_opacity

marker_size

marker_type

marker_colour

marker_stroke_colour

marker_stroke_width

These work in a similar way to the colours array - for example,
if you have three data sets and your marker_size is set to
array(3, 6) then the first line markers will be 3 pixels in
size, the second 6 pixels in size, and the markers on the third line will loop
back to 3 pixels in size.

For more details and examples of the marker options, see the
markers page.

BarAndLineGraph

The BarAndLineGraph must be provided with the line_dataset option
to specify which of the datasets should be drawn as a line instead of bars. The
default is “1” to show the first dataset as bars, the second dataset
as a line and any other dataset as bars. To configure the appearance of the
bars, refer to the options on the Bar graphs
page.

Line dash pattern

SVGGraph version 2.5 added the line_dash option, which specifies
a pattern of dashes to use for the graph data lines.

In the example below, the MultiLineGraph has two datasets, so I have used
an array for line_dash containing two pattern strings. The first
pattern is just the number "10" - this means 10 pixels of line, then 10 pixels
of gap.

line_dash = array('10', '8,2,5')

The second line uses a pattern of '8,2,5'. SVG dash patterns that have an
odd number of members are doubled-up, so this becomes '8,2,5,8,2,5' ('10' in
the example above becomes '10,10') - an 8 pixel line, 2 pixel gap, 5 pixel
line, then the doubled part gives an 8 pixel gap, 2 pixel line, 5 pixel gap,
before the pattern repeats.

Note: the line dash patterns are strings that look like arrays, and not
actual arrays!

The dotted red and blue lines are best fit or trend lines, described in detail
on the scatter graphs page.

Drawing shapes

From version 2.27 SVGGraph has an option that allows you to draw shapes
using line graphs, “line_figure”.

line_figure = trueline_figure_closed = array(false, true)

Setting the line_figure option to true makes
SVGGraph's line graphs behave differently - repeated keys are allowed, and the
data values are not sorted. This means you can draw lines between points that
share the same X value, and also draw lines from right to left.

Each dataset defines the points of one shape, and the fill_under
option can be used to fill the shape with all the usual colours, patterns and
gradients. The last segment of the line can be closed automatically using the
line_figure_closed option, which is enabled for the ball drawn by
the second dataset in the example above.

To get shape data into the graph, I recommend using
structured data. It is possible to draw
some shapes without using structured data, but it makes things a lot harder.

This section of code shows how you can use structured data to draw two
shapes, a rectangle in dataset 0 (data with key 0 and value 1) and another
shape in dataset 1 (data with key 0 and value 2). Even in this simple example
the key 20 is repeated, which would not be possible without using structured
data.

Name of callback function for formatting tooltip text. The function will be called with three arguments: callback($dataset, $key, $value). The function should return a text string to display or NULL for no tooltip. Takes precedence over structured data tooltip values.

Sets the minimum space required for a label to be shown. For vertical bars this is the height of the bar, for horizontal bars it is the width and for pie slices it is the angle in degrees. Has no effect on line and scatter graphs.

Name of callback function for formatting data label text. The function will be called with three arguments: callback($dataset, $key, $value). The function should return a text string to display or NULL for no label. Takes precedence over structured data label values.