com.orsoncharts.legend

## Class ColorScaleLegendBuilder

- java.lang.Object
- - com.orsoncharts.legend.ColorScaleLegendBuilder

- All Implemented Interfaces:
    LegendBuilder, java.io.Serializable

      public class ColorScaleLegendBuilder
      extends java.lang.Object
      implements LegendBuilder, java.io.Serializable

  A legend builder that creates a legend representing a `ColorScale`. This builder will only create a legend if the plot uses a renderer that implements the `ColorScaleRenderer` interface.
  The orientation and anchor point for the legend are properties of the `Chart3D` class.
  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:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColorScaleLegendBuilder()` Creates a new instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TableElement` | `createLegend(Plot3D plot, Anchor2D anchor, Orientation orientation, ChartStyle style)` Creates a new color scale legend with the specified orientation.
    `boolean` | `equals(java.lang.Object obj)` Tests this builder for equality with an arbitrary object.
    `double` | `getBarLength()` Returns the length of the bar displaying the color scale.
    `double` | `getBarWidth()` Returns the width of the bar displaying the color scale.
    `boolean` | `getIgnoreFixedColorScale()` Returns the flag that controls whether or not a `FixedColorScale` will be ignored for the purposes of generating a legend.
    `void` | `setBarLength(double length)` Sets the length of the bar displaying the color scale.
    `void` | `setBarWidth(double width)` Sets the width of the bar displaying the color scale.
    `void` | `setIgnoreFixedColorScale(boolean ignore)` Sets the flag that controls whether or not a `FixedColorScale` will be ignored for the purposes of generating a legend.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### ColorScaleLegendBuilder

          public ColorScaleLegendBuilder()

      Creates a new instance.

  - ### Method Detail

    - #### getBarWidth

          public double getBarWidth()

      Returns the width of the bar displaying the color scale.
      Returns:
        The width (in Java2D units).

    - #### setBarWidth

          public void setBarWidth(double width)

      Sets the width of the bar displaying the color scale.
      Parameters:
        `width` - the width (in Java2D units).

    - #### getBarLength

          public double getBarLength()

      Returns the length of the bar displaying the color scale.
      Returns:
        The length (in Java2D units).

    - #### setBarLength

          public void setBarLength(double length)

      Sets the length of the bar displaying the color scale.
      Parameters:
        `length` - the length (in Java2D units).

    - #### getIgnoreFixedColorScale

          public boolean getIgnoreFixedColorScale()

      Returns the flag that controls whether or not a `FixedColorScale` will be ignored for the purposes of generating a legend.
      Returns:
        A boolean.

    - #### setIgnoreFixedColorScale

          public void setIgnoreFixedColorScale(boolean ignore)

      Sets the flag that controls whether or not a `FixedColorScale` will be ignored for the purposes of generating a legend.
      Parameters:
        `ignore` - the new flag value.

    - #### createLegend

          public TableElement createLegend(Plot3D plot,
                                           Anchor2D anchor,
                                           Orientation orientation,
                                           ChartStyle style)

      Creates a new color scale legend with the specified orientation. If the plot does not use a renderer that implements `ColorScaleRenderer` then this method will return `null` and no legend will be drawn on the chart.
      Specified by:
        `createLegend` in interface `LegendBuilder`
      Parameters:
        `plot` - the plot (`null` not permitted).
        `anchor` - the anchor (`null` not permitted).
        `orientation` - the orientation (`null` not permitted).
        `style` - the chart style (`null` not permitted).
      Returns:
        A color scale legend (possibly `null`).

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this builder for equality with an arbitrary object.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object (`null` permitted).
      Returns:
        A boolean.