Subversion Repositories cheapmusic

Rev

Blame | Last modification | View Log | RSS feed

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>SetDataColors</title><link rel="stylesheet" type="text/css" href="phplotdoc.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="PHPlot Reference Manual" /><link rel="up" href="reference.html" title="PHPlot Function Reference" /><link rel="prev" href="SetDataBorderColors.html" title="SetDataBorderColors" /><link rel="next" href="SetDataLabelColor.html" title="SetDataLabelColor" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">SetDataColors</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="SetDataBorderColors.html">Prev</a> </td><th width="60%" align="center">PHPlot Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="SetDataLabelColor.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="SetDataColors"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">SetDataColors</span></h2><p>SetDataColors &#8212; Set the colors for plotting data sets</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">$plot-&gt;SetDataColors(<em class="parameter"><code>$data_colors</code></em>, [<span class="optional"><em class="parameter"><code>$border</code></em></span>], [<span class="optional"><em class="parameter"><code>$default_alpha</code></em></span>])</pre></div><div class="refsect1"><a id="idp1377854556"></a><h2>Description</h2><p>
<code class="function">SetDataColors</code> sets the colors used for plotting the
data.
    </p></div><div class="refsect1"><a id="idp1377855556"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>$data_colors</code></em></span></dt><dd><p>
An array of color values, one for each data set.
Or, a single color value (not an array) to use for all data sets.
For other possibilities, see Notes.
See <a class="xref" href="conc-colors.html" title="3.5. Colors">Section 3.5, &#8220;Colors&#8221;</a> for more on color values.
          </p></dd><dt><span class="term"><em class="replaceable"><code>$border</code></em></span></dt><dd><p>
Argument provided for backward compatibility.
Use <a class="xref" href="SetDataBorderColors.html" title="SetDataBorderColors"><span class="refentrytitle">SetDataBorderColors</span></a> instead.
          </p></dd><dt><span class="term"><em class="replaceable"><code>$default_alpha</code></em></span></dt><dd><p>
A default alpha value to apply to all data colors which do not have an alpha
value. This is generally useful only with Truecolor images.
A value of zero means opaque, and 127 means fully transparent.
See <a class="xref" href="adv-truecolor.html" title="4.3. Truecolor Images">Section 4.3, &#8220;Truecolor Images&#8221;</a> for more information.
          </p></dd></dl></div></div><div class="refsect1"><a id="idp1377860284"></a><h2>Notes</h2><p>
If an array is used for <em class="parameter"><code>$data_colors</code></em>, it
must use zero-based sequential integer indexes.
    </p><p>
Usually the <em class="parameter"><code>$data_colors</code></em> argument is an array of colors,
one for each data set to be plotted. For example:
      </p><pre class="programlisting">$plot-&gt;SetDataColors(array('red', 'green', 'blue'));
$plot-&gt;SetDataType('data-data');
$plot-&gt;SetDataValues(array( array('', 1, 4, 10, 5),
                            array('', 2, 6, 20, 3)));
</pre><p>
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).
    </p><p>
If <em class="parameter"><code>$data_colors</code></em> 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).
You can get around this restriction if you want to specify a single color 
as an R, G, B array by wrapping the array in another array, for example:
<code class="literal">array(array(102, 0, 192))</code>.
    </p><p>
Two special uses of the <em class="parameter"><code>$data_colors</code></em> argument
are available.
If the argument is an empty string, or boolean False, the color map is reset
to the defaults. This can be used to restore the default color map.
If the argument is NULL or missing from the function call, the color map is
reset to the defaults, but only if it has not already been set.
This is used internal to PHPlot for one-time initialization.
    </p><p>
If SetDataColors is never called, a default color map is used which
contains 16 colors starting with SkyBlue, green, orange, and blue.
For the full list, see <a class="xref" href="conc-colors.html#conc-colors-datacolors" title="3.5.3. Plotting Colors">Section 3.5.3, &#8220;Plotting Colors&#8221;</a>.
By default, all colors are opaque (alpha=0).
    </p><p>
You can keep the default color map but set all colors in it to use a
transparency (alpha) value like this:
</p><pre class="programlisting">$plot-&gt;SetDataColors(NULL, NULL, 60);
</pre><p>
This applies alpha=60 (meaning 60/127 transparency) to all the default
data colors.
    </p><p>
You can control how the data colors array is used with a data colors callback.
See <a class="xref" href="adv-datacolor-callback.html" title="4.5. Custom Data Color Selection">Section 4.5, &#8220;Custom Data Color Selection&#8221;</a> for more information.
    </p><p>
Some plot types which only support a single data set still use multiple
data colors, but in a way that is specific to that plot type.  This is
described for each applicable plot type in <a class="xref" href="conc-plottypes.html" title="3.4. PHPlot Plot Types">Section 3.4, &#8220;PHPlot Plot Types&#8221;</a>.
    </p></div><div class="refsect1"><a id="idp1377868012"></a><h2>History</h2><p>
The optional <em class="parameter"><code>$default_alpha</code></em> argument was added in
PHPlot-5.1.1 when truecolor images were implemented.
    </p><p>
Through PHPlot-5.0.7, the default color map contained these 8 colors:
SkyBlue, green, orange, blue, orange, red, violet, and azure1.
These were used if SetDataColors was never called.
Unfortunately, orange is used twice, and azure1 is so close to the white
background that it is invisible. Also, through PHPlot-5.0.7, if
SetDataColors was called with an empty string argument, the color map was
set to these 4 colors: blue red green orange.
Starting with PHPlot-5.1.0, a new default color map with 16 colors was
defined. Given an empty string (or False), SetDataColors now restores the
default color map.
    </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="SetDataBorderColors.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="SetDataLabelColor.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SetDataBorderColors </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> SetDataLabelColor</td></tr></table></div></body></html>