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:

FormatDescription
text-dataEach data array entry is an array with a label, followed by one or more Y values.
data-dataEach data array entry is an array with a label, an X value, then one or more Y values.
data-data-errorEach data array entry is an array with a label, an X value, then one or more triplets of Y value, error in the positive directory, and error in the negative direction.
text-data-singleThis is used only for pie charts. Each data array entry is an array with a label and a single data value.

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 plots with 4 points on each, and a month name as label for each point.

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 plot).

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 (they aren't used with a pie chart anyway), and 3 slices with relative weights of 10, 40, and 50 are defined.