SetDataColors

SetDataColors — Set the colors for plotting data sets

Synopsis

$plot->SetDataColors($data_colors, [$border])
    

Description

SetDataColors sets the colors used for plotting the data.

Parameters

$data_colors

An array of color values, one for each data set. For other possibilities, see Notes. See Section 3.5, “Colors” for more on color values.

$border

Argument provided for backward compatibility. Use SetDataBorderColors instead.

Notes

If an array is used for $data_colors, it must use zero based sequential integer indexes. This is what the PHP manual calls 'the usual integer indices (starting from zero, increasing by one)'.

Usually the $data_colors argument is an array of colors, one for each data set to be plotted. For example:

$plot->SetDataColors(array('red', 'green', 'blue'));
$plot->SetDataType('data-data');
$plot->SetDataValues(array( array('', 1, 4, 10, 5),
                            array('', 2, 6, 20, 3)));

This will plot a red line from (1,4) to (2,6), a green line from (1,10) to (2,20), and a blue line from (1,5) to (2,3).

If $data_colors is not an array, but a single color value, then that color will be used for all data sets. However, the array(r,g,b) notation is not allowed in this case (because it looks like an array of 3 separate color values).

If $data_colors is an empty string, the following 4 colors are used: blue red green orange.

If SetDataColors is never called, the default colors in order are: SkyBlue, green, orange, blue, orange, red, violet, and azure1. Note that for some reason orange appears twice. If you are plotting more than 4 data sets, you should call SetDataColors to set distinctive colors.