OFC Charts 3.1


com.oxymel.ofc.charts
Class ColorPalette

java.lang.Object
  |
  +--com.oxymel.ofc.charts.ColorPalette

public class ColorPalette
extends java.lang.Object

ColorPalette class allows to customize the colors used in a given graphic. It contains a set of colors, and it provides methods to manage the colors. The colors belonging to the Palette are ordered, and the first one is at the position 0.


Constructor Summary
ColorPalette()
          Constructor The Color palette is initialized with default colors
 
Method Summary
 void addColor(java.awt.Color color)
          Adds a new color to the palette.
 void clear()
          Reset the color palette so that it becomes empty.
static java.awt.Color getColor(int R, int G, int B)
          Builds a Color instance from its RGB representation
 java.awt.Color getColorAt(int colorPosition)
          Gets the color located at the given position;
 void initPalette()
          Initializes the ColorPalette with the defaults values, it contains 12 different colors
 void initPaletteAsBlueGradient()
          Initializes the ColorPalette as blue gradient, it contains 5 colors
 void initPaletteAsExcelColor()
          Initializes the ColorPaletteSets as an excel color palette, it contains 8 colors
 void initPaletteAsHotToColdEffect()
          Initializes the ColorPalette as cold to hot effect, it contains 22 colors
 void initPaletteHotToColdFromData(int nbOfData)
          Initializes the ColorPalette as cold to hot effect with the given number of data
 void initPaletteWith42Colors()
          Initializes the ColorPalette with 42 differents colors
 void setColorAt(java.awt.Color color, int colorPosition)
          Sets or replaces the color at the given position by the one passed as argument (color).
 void setColorAt(int R, int G, int B, int colorPosition)
          Sets or replaces the color at the given position by the one passed as argument as a RGB color.
 int size()
          Gets the number of colors contained in palette.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorPalette

public ColorPalette()
Constructor The Color palette is initialized with default colors
Method Detail

size

public int size()
Gets the number of colors contained in palette.
Returns:
number The color's count

clear

public void clear()
Reset the color palette so that it becomes empty.

addColor

public void addColor(java.awt.Color color)
Adds a new color to the palette. The color is given as an instance of the Color class. It is stored at the last position in the palette.
Parameters:
color - new color to add

getColorAt

public java.awt.Color getColorAt(int colorPosition)
Gets the color located at the given position;
Parameters:
colorPosition - The color position in the palette
Returns:
Color asked, if position is greater than the number of existing colors the last color is returned.

setColorAt

public void setColorAt(java.awt.Color color,
                       int colorPosition)
Sets or replaces the color at the given position by the one passed as argument (color). If the given position does not exists in the palette, nothing is done.
Parameters:
color - New color to set at the colorPosition in the palette
colorPosition - color position in palette, it must corresponds to an existing position

setColorAt

public void setColorAt(int R,
                       int G,
                       int B,
                       int colorPosition)
Sets or replaces the color at the given position by the one passed as argument as a RGB color. If the given position does not exists in the palette, nothing is done.
Parameters:
R - Red part of color
G - Green part of color
B - Blue part of color
colorPosition - The color position in the palette, it must corresponds to an existing position

getColor

public static java.awt.Color getColor(int R,
                                      int G,
                                      int B)
Builds a Color instance from its RGB representation
Parameters:
R - Red part of color
G - Green part of color
B - Blue part of color
Returns:
Color The Color instance corresponding to the RGB color definition

initPalette

public void initPalette()
Initializes the ColorPalette with the defaults values, it contains 12 different colors

initPaletteAsBlueGradient

public void initPaletteAsBlueGradient()
Initializes the ColorPalette as blue gradient, it contains 5 colors

initPaletteAsHotToColdEffect

public void initPaletteAsHotToColdEffect()
Initializes the ColorPalette as cold to hot effect, it contains 22 colors

initPaletteAsExcelColor

public void initPaletteAsExcelColor()
Initializes the ColorPaletteSets as an excel color palette, it contains 8 colors

initPaletteHotToColdFromData

public void initPaletteHotToColdFromData(int nbOfData)
Initializes the ColorPalette as cold to hot effect with the given number of data
Parameters:
nbOfData - int

initPaletteWith42Colors

public void initPaletteWith42Colors()
Initializes the ColorPalette with 42 differents colors

OFC Charts 3.1


Copyright © 2005 Oxymel SA All Rights Reserved.