prefuse.util
Class ColorMap

java.lang.Object
  extended by prefuse.util.ColorMap

public class ColorMap
extends java.lang.Object

A color map provides a mapping from numeric values to specific colors. This useful for assigning colors to visualized items. The numeric values may represent different categories (i.e. nominal variables) or run along a spectrum of values (i.e. quantitative variables).

Author:
jeffrey heer

Constructor Summary
ColorMap(int[] map, double min, double max)
          Creates a new ColorMap instance using the given internal color map array and minimum and maximum index values.
 
Method Summary
 int getColor(double val)
          Returns the color associated with the given value.
 int[] getColorPalette()
          Gets the internal color palette, an int array of color values.
 double getMaxValue()
          Gets the maximum value that corresponds to the last color in the color map.
 double getMinValue()
          Gets the minimum value that corresponds to the first color in the color map.
 void setColorPalette(int[] palette)
          Sets the internal color palette, an int array of color values.
 void setMaxValue(double maxValue)
          Sets the maximum value that corresponds to the last color in the color map.
 void setMinValue(double minValue)
          Sets the minimum value that corresponds to the first color in the color map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorMap

public ColorMap(int[] map,
                double min,
                double max)
Creates a new ColorMap instance using the given internal color map array and minimum and maximum index values.

Parameters:
map - the color palette, an int array of color values
min - the minimum value in the color map
max - the maximum value in the color map
Method Detail

getColor

public int getColor(double val)
Returns the color associated with the given value. If the value is outside the range defined by this map's minimum or maximum values, a endpoint value is returned (i.e. the first entry in the color map for values below the minimum, the last enty for value above the maximum).

Parameters:
val - the value for which to retrieve the color
Returns:
the color corresponding the given value

getColorPalette

public int[] getColorPalette()
Gets the internal color palette, an int array of color values.

Returns:
returns the color palette.

setColorPalette

public void setColorPalette(int[] palette)
Sets the internal color palette, an int array of color values.

Parameters:
palette - the new palette.

getMaxValue

public double getMaxValue()
Gets the maximum value that corresponds to the last color in the color map.

Returns:
returns the max index value into the color map.

setMaxValue

public void setMaxValue(double maxValue)
Sets the maximum value that corresponds to the last color in the color map.

Parameters:
maxValue - the new max index value.

getMinValue

public double getMinValue()
Gets the minimum value that corresponds to the first color in the color map.

Returns:
Returns the min index value.

setMinValue

public void setMinValue(double minValue)
Sets the minimum value that corresponds to the first color in the color map.

Parameters:
minValue - the new min index value.


Copyright © 2007 Regents of the University of California