com.approximatrix.charting.render.colorscale
Class SimpleColorScale

java.lang.Object
  extended by com.approximatrix.charting.render.colorscale.AbstractColorScale
      extended by com.approximatrix.charting.render.colorscale.SimpleColorScale
All Implemented Interfaces:
ColorScale

public class SimpleColorScale
extends AbstractColorScale

Implements a simple color scale based on explicit maximum and minimum values specified. Red at low end, green at the center, and blue at the high end.

Author:
armstrong

Field Summary
protected static java.awt.Color FAILED_CALC
          Returns this color whenever the max and min values are identical
private  double maxV
          The highest value in the scale range
private  double minV
          The lowest value in the scale range
 
Constructor Summary
SimpleColorScale()
          Default constructor
SimpleColorScale(double min, double max)
          Constructor excepting min and max range values as doubles
SimpleColorScale(int min, int max)
          Constructor excepting min and max range values as integers
 
Method Summary
 java.awt.Color getColor(double value)
          Returns a color based on a double
 java.awt.Color getColor(int value)
          Returns a color based on an integer
 
Methods inherited from class com.approximatrix.charting.render.colorscale.AbstractColorScale
getColors, getColors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FAILED_CALC

protected static final java.awt.Color FAILED_CALC
Returns this color whenever the max and min values are identical


minV

private double minV
The lowest value in the scale range


maxV

private double maxV
The highest value in the scale range

Constructor Detail

SimpleColorScale

public SimpleColorScale()
Default constructor


SimpleColorScale

public SimpleColorScale(double min,
                        double max)
Constructor excepting min and max range values as doubles

Parameters:
min - the lowest expected value
max - the highest expected value

SimpleColorScale

public SimpleColorScale(int min,
                        int max)
Constructor excepting min and max range values as integers

Parameters:
min - the lowest expected value
max - the highest expected value
Method Detail

getColor

public java.awt.Color getColor(double value)
Returns a color based on a double

Parameters:
value - the data space value
Returns:
a valid Color object

getColor

public java.awt.Color getColor(int value)
Returns a color based on an integer

Parameters:
value - the data space value
Returns:
a valid Color object