Chapter 7. Color handling

Table of Contents

7.1. Specifying colors by name
7.2. Specifying colors by RGB triples
7.3. Using HTML color specifications
7.4. Fine tuning the color
7.4.1. Specifying the alpha channel (color transparency)
7.4.2. Adjusting the brightness
7.4.3. Combining brightness and transparency adjustment
7.5. Additional color handling

An important part of creating visually clear graphs is the use of appropriate colors. In order to simplify color handling JpGraph supports several ways to adjust and manipulate color both by value and by name.

Almost all color setting methods (with basically only one exception) for all objects in the graph has one of two names

Both variants of methods take one argument which identifies the color by one of the available color specification methods as described below.

7.1. Specifying colors by name

There are a number of "standard colors" known by (more or less) illustrative names. A list of all color names that can be used as well as actual color can be found in Appendix D.

For example:

  • SetColor('white');

  • SetFillColor('orange');

Tip

Always use single quotes for strings when you do not need variable substitution since this is faster.