EspressReport 6.6

quadbase.util
Class ColorSpectrum

java.lang.Object
  extended by quadbase.util.ColorSpectrum

public class ColorSpectrum
extends java.lang.Object

This class is used for defining the color of data based on the vertical value. Currently only 3D surface chart can support this feature. The following diagram shows the meaning of the color array and the value array.

Color Spectrum:
+-------+ highest value
| |
| red | color[2] = red
| |
+-------+ value[1] = 60.0
| |
| |
| yellow| color[1] = yellow
| |
| |
+-------+ value[0] = 30.0
| |
| green | color[0] = green
| |
+-------+ lowest value

If the color spectrum only has one value, the value array is null and the color array always has one element. Otherwise, the color array always has one more element than the value array. Since a color spectrum object is not mutable, another object has to be created when it need to be changed. Generally speaking, if there are n values in the color spectrum,
value[0] < value[1] < .... < value[n-1] < value[n]

then the order of the array elements is as follows:
color[0], value[0], color[1], value[1], ... , color[n], value[n], color[n+1]

See Also:
I3DPropertySet.setColorSpectrum(quadbase.util.ColorSpectrum), I3DPropertySet.getColorSpectrum()

Constructor Summary
ColorSpectrum(java.awt.Color[] color, double[] value)
          Creates a color spectrum object.
 
Method Summary
 java.awt.Color[] getColor()
          This function returns the color array
 java.awt.Color getColor(double target)
          This function returns the color corresponding to a target value
 double[] getValue()
          This function returns the value array
 int getValueCount()
          This function returns the number of value in the value array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorSpectrum

public ColorSpectrum(java.awt.Color[] color,
                     double[] value)
              throws java.lang.IllegalArgumentException
Creates a color spectrum object. Generally speaking, if there are n values in the color spectrum,
value[0] < value[1] < .... < value[n-1] < value[n]

then the order of the array elements is as follows:
color[0], value[0], color[1], value[1], ... , color[n], value[n], color[n+1]

Parameters:
color - The color array
value - The value array
Throws:
java.lang.IllegalArgumentException
Method Detail

getColor

public java.awt.Color[] getColor()
This function returns the color array

Returns:
The color array

getValue

public double[] getValue()
This function returns the value array

Returns:
The value array

getValueCount

public int getValueCount()
This function returns the number of value in the value array

Returns:
The count

getColor

public java.awt.Color getColor(double target)
This function returns the color corresponding to a target value

Returns:
The color

EspressReport 6.6