SetDataType

SetDataType — Indicate the format of the data array

Synopsis

$plot->SetDataType($dt)

Description

SetDataType tells PHPlot how to interpret the data array set with SetDataValues. More information on data types can be found in Section 3.3, “PHPlot Data Types”.

Parameters

$dt

The data array format type, which must be one of the following values:

Data TypeDescription
text-data Plot with implied X: (Label, Y1, [Y2, ...])
data-data Plot with explicit X: (Label, X, Y1, [Y2, ...])
data-data-error Error plot: (Label, X, Y1, Y1err+, Y1err-, [Y2, ...])
text-data-single Simple pie chart data: (Label, Value)
text-data-yx Horizontal plot with implied Y: (Label, X1, [X2, ...])
data-data-yx Horizontal plot with explicit Y: (Label, Y, X1, [X2, ...])
data-data-yx-error Horizontal error plot: (Label, Y, X1, X1err+, X1err-, [X2, ...])
data-data-xyz Plot with X, Y, Z data: (Label, X, Y1, Z1, [Y2, Z2, ...])

Note: The descriptions above show one row of the data array.

Notes

The default data type is text-data.

An example of a text-data data array is:

$data = array(  array('Jan', 100, 150, 200),
                array('Feb', 110, 140, 210),
                array('Mar', 120, 145, 200),
                array('Apr', 110, 160, 220) );

This defines the data for 3 data sets with 4 points on each, and a month name as label for each point. This is also a valid data array for data type text-data-yx.

An example of a data-data data array is:

$data = array(  array('', 2, 15),
                array('', 4, 14),
                array('', 6, 10),
                array('', 8, 20) );

Here the labels are empty strings, next are the X values, then a single set of Y values (1 data set, 1 plot line). This is also a valid data array for data type data-data-yx, with each row containing a Y value, followed by a single X value.

An example of a data-data-error data array is:

$data = array(  array('1999', 1, 23.5, 5, 3),
                array('2000', 2, 20.1, 4, 4),
                array('2001', 3, 19.1, 3, 4),
                array('2002', 4, 16.8, 4, 3) );

Here the labels are years, next are the X values 1-4, then a single set of Y values with error ranges between 3 and 5 for each point.

An example of a text-data-single data array, used only for pie charts, is:

$data = array(  array('', 10),
                array('', 40),
                array('', 50) );

Here the labels are empty, and 3 segments with relative weights of 10, 40, and 50 are defined.

Data type alias data-data-error-yx can be used in place of data-data-yx-error. There are other data type aliases, such as text-linear, which exist for compatibility with very old versions of PHPlot, but they are not documented.

History

Data type data-data-yx-error was added in PHPlot-6.1.0 for horizontal error plots. Data type data-data-xyz was added in PHPlot-5.5.0 for the bubbles plot type. Data type data-data-yx for horizontal plots was added in PHPlot-5.1.3. Data type text-data-yx for horizontal bar charts was added in PHPlot-5.1.2.

SourceForge.net Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.