Name

add_series -- Add a series of values to the chart.

Synopsis

bool chart->add_series ( string name, array points[, string color[, float width[, string type]]] )

Description

This method adds a series of points to the chart that will be connected by a line.

Each seperate call to chart->add_series() will result in another line being drawn on the chart.

name is the name of the series, and will be used to represent it in the legend. Each series must have a unique name, even if no legend is drawn.

points is an array of points to be drawn on the chart.

color is a color for the series to be drawn in. It must be a symbolic reference to a color as describe for get_color().

width is the width of the line in PDF units

type is the type of line to draw, only 'line' type is supported at this time.

Examples

// set the background to dark green
$pdf->chart->setcolor('background', 0, .5, 0);
// Add a series
$p[] = 5;
$p[] = 10;
$p[] = 7;
$p[] = 3.2;
$pdf->chart->add_series('series 1', $p);
$pdf->chart->place_chart($page, 10, 10, 300, 200, 'line');

See Also

History

This function was added in version 2.1.

Bugs

A lot of functionality described in this document simply doesn't exist yet.