net.sourceforge.chart2d
Class ChartColors
java.lang.Object
|
+--net.sourceforge.chart2d.ChartColors
- public class ChartColors
- extends java.lang.Object
Automates the choosing of colors for charts.
You tell it how many colors you need, and it will give you an array of
appropriate colors for charting.
There are two types of colors, NATURAL and PASTEL, that you can ask for.
NATURAL colors are more pure than PASTEL colors.
The number of unique colors it can create is 18.
The maximum number of colors you can ask from it is, 32000.
After 18, it will simply repeat the original 18 back to you,
up until the number that you asked for. The returned array of colors
will always have exactly the number of colors that you ask for.
The primary colors are blue, green, red, yellow, cyan, and magenta.
The colors are three sets of these, varying among brightness.
|
Field Summary |
static int |
NATURAL
NATURAL colors are more pure than PASTEL colors. |
static int |
PASTEL
PASTEL colors have other colors besides their primary ones added to them. |
|
Constructor Summary |
ChartColors()
Creates Automate Colors class with default values. |
|
Method Summary |
java.awt.Color[] |
getColorsArray()
Returns an array of Colors of the length requested in the
setNumColors command. |
int |
getColorsType()
Gets the type of colors. |
void |
setColorsType(int type)
Sets the type of colors. |
void |
setNumColors(int num)
Sets the number of colors to return in an array. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NATURAL
public static final int NATURAL
- NATURAL colors are more pure than PASTEL colors.
For example, a red color will be pure red, no green or blue will be added.
PASTEL
public static final int PASTEL
- PASTEL colors have other colors besides their primary ones added to them.
For example, a red color may appear pink or orange instead of red.
ChartColors
public ChartColors()
- Creates Automate Colors class with default values.
Default color type is NATURAL.
Default number of colors is 0.
setColorsType
public void setColorsType(int type)
- Sets the type of colors.
Possible values are NATURAL and PASTEL.
- Parameters:
type - The type of colors in the array.
setNumColors
public void setNumColors(int num)
- Sets the number of colors to return in an array.
Minimum value is 0.
Maximum value is 32,000.
Only 18 colors will be unique. After the first 18, the original 18 will
simple be repeated back up until the number requested.
- Parameters:
num - How many colors in the array.
getColorsType
public int getColorsType()
- Gets the type of colors.
Possible values are NATURAL and PASTEL.
- Returns:
- The type of colors in the array.
getColorsArray
public java.awt.Color[] getColorsArray()
- Returns an array of Colors of the length requested in the
setNumColors command.
- Returns:
- The color array.