Class AuxLegend

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class AuxLegend extends JComponent
Displays a legend for an auxiliary (colour) axis.
Since:
14 Jun 2007
Author:
Mark Taylor
See Also:
  • Constructor Details

    • AuxLegend

      public AuxLegend(boolean horizontal, int iconDepth)
      Constructor.
      Parameters:
      horizontal - true for a bar that runs horizontally, false for a bar that runs vertically
      iconDepth - preferred transverse size of the legend colour band
  • Method Details

    • setLengthPadding

      public void setLengthPadding(int preLength, int postLength)
      Configures the amount of padding left before and after the bar which can be used to carry half-labels etc.
      Parameters:
      preLength - number of padding pixels blank before the bar run
      postLength - number of padding pixels blank after the bar run
    • configure

      public void configure(PlotState state, int iaux)
      Configures this legend according to a given plot state.
      Parameters:
      state - plot state
      iaux - index of auxiliary axis to use
    • isHorizontal

      public boolean isHorizontal()
      Indicates the orientation of this legend.
      Returns:
      true if the bar runs horizontally, false if it runs vertically
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getMaximumSize

      public Dimension getMaximumSize()
      Overrides:
      getMaximumSize in class JComponent
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • fractionToData

      public double fractionToData(double frac)
      Converts a fractional value (where zero corresponds to current lower bound and 1 corresponds to current upper bound) into a corresponding data value.
      Parameters:
      frac - input fractional value
      Returns:
      corresponding data value
    • getDataBounds

      public Rectangle getDataBounds()
      Returns the bounds of the region of this component containing the legend. The ends of the region will be aligned with the ends of the data part of the painted bar. Currently the transverse bounds of this region include space for the numeric labels as well as the bar itself.
      Returns:
      data region bounds