lt.monarch.chart.mapper
Class ColorMapper

java.lang.Object
  extended by lt.monarch.chart.mapper.ColorMapper
All Implemented Interfaces:
java.io.Serializable

public class ColorMapper
extends java.lang.Object
implements java.io.Serializable

Maps colors to axis values. Interpolates between given colors according to axis range minimum and maximum values.

See Also:
Serialized Form

Constructor Summary
Constructor and Description
ColorMapper(DataColumnType valueType)
          Constructs a new ColorMapper.
 
Method Summary
Modifier and Type Method and Description
 java.awt.Color getColor(java.lang.Object o)
          Gets color for given object.
 java.awt.Color[] getColorPalette()
          Gets color palette.
 AxisMapper getMapper()
          Returns the axis mapper for color mapping.
 DataColumnType getValueType()
          Gets value type to which colors a mapped.
 void setColorPalette(java.awt.Color[] palette)
          Sets mapping color palette.
 void setColors(java.awt.Color first, java.awt.Color last)
          Sets color range which is used in mapping axis values.
 void setMapper(AxisMapper mapper)
          Sets axis mapper for color mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorMapper

public ColorMapper(DataColumnType valueType)
Constructs a new ColorMapper.

Parameters:
valueType - value type to which colors are mapped
Method Detail

setMapper

public void setMapper(AxisMapper mapper)
Sets axis mapper for color mapping.

Parameters:
mapper - axis mapper.

getMapper

public AxisMapper getMapper()
Returns the axis mapper for color mapping.

Returns:
mapper axis mapper.

setColors

public void setColors(java.awt.Color first,
                      java.awt.Color last)
Sets color range which is used in mapping axis values.

Parameters:
first - starting color
last - ending color

getColor

public java.awt.Color getColor(java.lang.Object o)
Gets color for given object.

Parameters:
o - object to map
Returns:
new color, which was mapped using color mapper

setColorPalette

public void setColorPalette(java.awt.Color[] palette)
Sets mapping color palette.

Parameters:
palette - color palette

getColorPalette

public java.awt.Color[] getColorPalette()
Gets color palette. Default is null if not set.

Returns:
Color palette array.

getValueType

public DataColumnType getValueType()
Gets value type to which colors a mapped.

Returns:
the valueType to which colors are mapped