Class XYAxis

java.lang.Object
org.opensourcephysics.display.axes.XYAxis
All Implemented Interfaces:
Drawable, Interactive, Measurable
Direct Known Subclasses:
XAxis, YAxis

public abstract class XYAxis extends Object implements Interactive
A superclass for the x axis and y axis.
Version:
1.0
Author:
Wolfgang Christian
  • Field Details

    • DRAW_IN_DISPLAY

      public static final int DRAW_IN_DISPLAY
      Field DRAW_IN_DISPLAY
      See Also:
    • DRAW_IN_GUTTER

      public static final int DRAW_IN_GUTTER
      Field DRAW_IN_GUTTER
      See Also:
    • DRAW_AT_LOCATION

      public static final int DRAW_AT_LOCATION
      Field DRAW_AT_LOCATION
      See Also:
    • LINEAR

      public static final int LINEAR
      Field LINEAR
      See Also:
    • x

      protected double x
    • y

      protected double y
    • LOG10

      public static final int LOG10
      Field LOG10
      See Also:
  • Constructor Details

    • XYAxis

      public XYAxis()
      Constructor XYAxis
  • Method Details

    • draw

      public abstract void draw(DrawingPanel panel, Graphics g)
      Draws the axis in a drawing panel.
      Specified by:
      draw in interface Drawable
      Parameters:
      panel -
      g -
    • setLabelFormat

      public void setLabelFormat(DecimalFormat format)
      Method setLabelFormat
      Parameters:
      format -
    • setLabelFormat

      public void setLabelFormat(String formatString)
      Method setLabelFormat
      Parameters:
      formatString -
    • setLocationType

      public void setLocationType(int _locationType)
      Sets the location type.
      Parameters:
      _locationType -
    • setLocation

      public void setLocation(double _location)
      Sets the location type.
      Parameters:
      _location -
    • setAxisType

      public void setAxisType(int type)
      Method setAxisType
      Parameters:
      type -
    • setTitle

      public void setTitle(String title, String font_name)
      Sets the title. The font names understood are those understood by java.awt.Font.decode(). If the font name is null, the font remains unchanged.
      Parameters:
      title -
      font_name - an optional font name
    • setTitle

      public void setTitle(String title)
      Sets the title.
      Parameters:
      title -
    • setTitleFont

      public void setTitleFont(String name)
      Set the title font. The font names understood are those understood by java.awt.Font.decode().
      Parameters:
      name - A font name.
    • setShowMajorGrid

      public void setShowMajorGrid(boolean show)
    • drawMultiplier

      protected void drawMultiplier(int xpix, int ypix, int exponent, Graphics2D g2)
    • calculateLabels

      public void calculateLabels(double minimum, double maximum, int numTicks)
      Calculates the axis labels.
      Parameters:
      minimum -
      maximum -
      numTicks -
    • getXMin

      public double getXMin()
      Gets the minimum x needed to draw this object.
      Specified by:
      getXMin in interface Measurable
      Returns:
      minimum
    • getXMax

      public double getXMax()
      Gets the maximum x needed to draw this object.
      Specified by:
      getXMax in interface Measurable
      Returns:
      maximum
    • getYMin

      public double getYMin()
      Gets the minimum y needed to draw this object.
      Specified by:
      getYMin in interface Measurable
      Returns:
      minimum
    • getYMax

      public double getYMax()
      Gets the maximum y needed to draw this object.
      Specified by:
      getYMax in interface Measurable
      Returns:
      minimum
    • isMeasured

      public boolean isMeasured()
      Determines if information is available to set min/max values. Objects that store data, Datasets for example, usually return zero if data is null.
      Specified by:
      isMeasured in interface Measurable
      Returns:
      true if min/max values are valid
    • findInteractive

      public Interactive findInteractive(DrawingPanel panel, int _xpix, int _ypix)
      Specified by:
      findInteractive in interface Interactive
    • setEnabled

      public void setEnabled(boolean _enabled)
      Specified by:
      setEnabled in interface Interactive
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface Interactive
    • setXY

      public void setXY(double x, double y)
      Specified by:
      setXY in interface Interactive
    • setX

      public void setX(double x)
      Specified by:
      setX in interface Interactive
    • setY

      public void setY(double y)
      Specified by:
      setY in interface Interactive
    • getX

      public double getX()
      Specified by:
      getX in interface Interactive
    • getY

      public double getY()
      Specified by:
      getY in interface Interactive
    • log10

      public static double log10(double x) throws ArithmeticException
      Parameters:
      x - a double value
      Returns:
      The log10
      Throws:
      ArithmeticException