Login Register Wishes Forum About
Language Reference » Settings functions » setPalette
Help topics
Latest updates
4699d  replaceImageMapTitle
4699d  replaceImageMapValues
4699d  createFunctionSerie
4699d  setAbsicssaPosition
4699d  negateValues
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
setPalette - Associate color to your Data series

This function allows you to modify the series color schemes by associating a color to one serie. Parameters are given trough a $Format array. To learn more about this please read the Format array guide.

Calling this function
Where :

Series is the name of the serie that you want to customize. (or an array of series)
Format is an array containing the description of what you want to achieve.

Customisation array - Choose your color!

It is possible to specify the colors and alpha transparency of the given serie with this array. If nothing is specified, the serie will be drawn black with no transparency.

The font color can be set with R, G, B.
The alpha transparency factor can be set with Alpha.

A lot of sites are providing nice looking color schemes on internet. It is important to keep in mind that the color must be visible on the background you‘ve choosen and that all series must be visually different.

Sample script #1

 /* Create the pData object */
 $MyData = new pData(); 

 /* Populate some data */
 $MyData->addPoints(array(24,25,26,25,25),"My Serie 1");
 $MyData->addPoints(array(1,7,5,6,8),"My Serie 2");
 $MyData->addPoints(array(6,7,8,0,6),"My Serie 3");

 /* Draw serie 1 in red with a 80% opacity */
 $serieSettings = array("R"=>229,"G"=>11,"B"=>11,"Alpha"=>80);
 $MyData->setPalette("My Serie 1",$serieSettings);

 /* Affect the same palette on different series */
 $serieSettings = array("R"=>255,"G"=>0,"B"=>0);
 $MyData->setPalette(array("My Serie 2","My Serie 3"),$serieSettings);

Sample script #2

 /* pChart library inclusions */

 /* Create and populate the pData object */
 $MyData = new pData();  
 $MyData->setAxisName(0,"$ Incomes");

 /* Create the pChart object */
 $myPicture = new pImage(700,230,$MyData);
 /* Write the picture title */ 
 $myPicture->drawText(60,35,"2k9 Average Incomes",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMLEFT));

 /* Do some cosmetic and draw the chart */

 /* Write the chart legend */ 

 /* Render the picture (choose the best way) */
Last updated on 12/25/2010 
by Jean-Damien 
Linked resources
Community comments
  No comments have been posted yet.
© Copyrights
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 415 users have registered. This page has been rendered in 0,02 seconds. Wiki revision 1.37.