Class RainbowScale

java.lang.Object
org.jfree.chart3d.renderer.AbstractColorScale
org.jfree.chart3d.renderer.RainbowScale
All Implemented Interfaces:
Serializable, ColorScale

public class RainbowScale extends AbstractColorScale implements ColorScale
A color scale that returns all the colors of the rainbow. Instances of this class are immutable and serializable.

NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
Since:
1.1
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Range
    A range to include all hues.
    static final Range
    A hue subrange that restricts colors to the blue to red range.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new rainbow scale for the specified value range, with 256 color samples in the blue to red range.
    RainbowScale(Range range, int samples, Range hueSubrange)
    Creates a new rainbow scale for the specified value range, with the given number of samples and hues restricted to the specified range.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Tests this color scale for equality with an arbitrary object.
    Returns the sub-range of hues used in this scale.
    int
    Returns the number of samples used by this color scale.
    valueToColor(double value)
    Converts a value to a color on the scale.

    Methods inherited from class org.jfree.chart3d.renderer.AbstractColorScale

    getRange

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.jfree.chart3d.renderer.ColorScale

    getRange
  • Field Details

    • ALL_HUES

      public static final Range ALL_HUES
      A range to include all hues. This can be used for the hueSubrange argument in the constructor.
    • BLUE_TO_RED_RANGE

      public static final Range BLUE_TO_RED_RANGE
      A hue subrange that restricts colors to the blue to red range. This can be used for the hueSubrange argument in the constructor.
  • Constructor Details

    • RainbowScale

      public RainbowScale(Range range)
      Creates a new rainbow scale for the specified value range, with 256 color samples in the blue to red range.
      Parameters:
      range - the range (null not permitted).
    • RainbowScale

      public RainbowScale(Range range, int samples, Range hueSubrange)
      Creates a new rainbow scale for the specified value range, with the given number of samples and hues restricted to the specified range.
      Parameters:
      range - the range (null not permitted).
      samples - the number of samples.
      hueSubrange - the hue sub-range.
  • Method Details

    • getSampleCount

      public int getSampleCount()
      Returns the number of samples used by this color scale.
      Returns:
      The number of samples.
    • getHueSubrange

      Returns the sub-range of hues used in this scale.
      Returns:
      The sub-range of hues.
    • valueToColor

      public Color valueToColor(double value)
      Converts a value to a color on the scale.
      Specified by:
      valueToColor in interface ColorScale
      Parameters:
      value - the value.
      Returns:
      A color (never null).
    • equals

      public boolean equals(Object obj)
      Tests this color scale for equality with an arbitrary object.
      Overrides:
      equals in class AbstractColorScale
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.