Class Axis

java.lang.Object
smile.plot.swing.Axis

public class Axis extends Object
This class describes an axis of a coordinate system.
  • Constructor Details

    • Axis

      public Axis(Base base, int index)
      Constructor.
      Parameters:
      base - The base coordinate space.
      index - The index of coordinate associated with this axis.
  • Method Details

    • reset

      public void reset()
      Resets the base coordinate space.
    • setRotation

      public Axis setRotation(double rotation)
      Sets the rotation degree of tick strings.
      Parameters:
      rotation - rotation degree.
      Returns:
      this object.
    • setTicks

      public Axis setTicks(String[] ticks, double[] location)
      Adds a label to the axis at given location.
      Parameters:
      ticks - the tick labels.
      location - the tick location.
      Returns:
      this object.
    • slices

      public int slices()
      Returns the number of slices in linear scale.
      Returns:
      the number of slices in linear scale.
    • setGridVisible

      public Axis setGridVisible(boolean visible)
      Sets the visibility of the grid lines and their labels.
      Parameters:
      visible - the flag if the grid is visible.
      Returns:
      this object.
    • isGridVisible

      public boolean isGridVisible()
      Returns the visibility of the grid lines and their labels.
      Returns:
      true if the grid is visible.
    • setFrameVisible

      public Axis setFrameVisible(boolean visible)
      Set the visibility of the frame grid lines and their labels.
      Parameters:
      visible - the flag if the frame is visible.
      Returns:
      this object.
    • isFrameVisible

      public boolean isFrameVisible()
      Returns the visibility of the frame grid lines and their labels.
      Returns:
      true if the frame is visible.
    • setTickVisible

      public Axis setTickVisible(boolean visible)
      Sets the visibility of the tick labels.
      Parameters:
      visible - the flag if the ticks are visible.
      Returns:
      this object.
    • isTickVisible

      public boolean isTickVisible()
      Returns the visibility of the tick labels.
      Returns:
      true if the ticks are visible.
    • setLabel

      public void setLabel(String label)
      Sets the label.
      Parameters:
      label - the label of the axis.
    • getLabel

      public String getLabel()
      Returns the label of the axis.
      Returns:
      the label of the axis.
    • paint

      public void paint(Renderer g)
      Draws the axis.
      Parameters:
      g - the renderer.