Class XYAxis
java.lang.Object
org.opensourcephysics.display.axes.XYAxis
- All Implemented Interfaces:
Drawable
,Interactive
,Measurable
A superclass for the x axis and y axis.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Field DRAW_AT_LOCATIONstatic final int
Field DRAW_IN_DISPLAYstatic final int
Field DRAW_IN_GUTTERstatic final int
Field LINEARstatic final int
Field LOG10protected double
protected double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
calculateLabels
(double minimum, double maximum, int numTicks) Calculates the axis labels.abstract void
draw
(DrawingPanel panel, Graphics g) Draws the axis in a drawing panel.protected void
drawMultiplier
(int xpix, int ypix, int exponent, Graphics2D g2) findInteractive
(DrawingPanel panel, int _xpix, int _ypix) double
getX()
double
getXMax()
Gets the maximum x needed to draw this object.double
getXMin()
Gets the minimum x needed to draw this object.double
getY()
double
getYMax()
Gets the maximum y needed to draw this object.double
getYMin()
Gets the minimum y needed to draw this object.boolean
boolean
Determines if information is available to set min/max values.static double
log10
(double x) void
setAxisType
(int type) Method setAxisTypevoid
setEnabled
(boolean _enabled) void
setLabelFormat
(String formatString) Method setLabelFormatvoid
setLabelFormat
(DecimalFormat format) Method setLabelFormatvoid
setLocation
(double _location) Sets the location type.void
setLocationType
(int _locationType) Sets the location type.void
setShowMajorGrid
(boolean show) void
Sets the title.void
Sets the title.void
setTitleFont
(String name) Set the title font.void
setX
(double x) void
setXY
(double x, double y) void
setY
(double y) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
DRAW_IN_DISPLAY
public static final int DRAW_IN_DISPLAYField DRAW_IN_DISPLAY- See Also:
-
DRAW_IN_GUTTER
public static final int DRAW_IN_GUTTERField DRAW_IN_GUTTER- See Also:
-
DRAW_AT_LOCATION
public static final int DRAW_AT_LOCATIONField DRAW_AT_LOCATION- See Also:
-
LINEAR
public static final int LINEARField LINEAR- See Also:
-
x
protected double x -
y
protected double y -
LOG10
public static final int LOG10Field LOG10- See Also:
-
-
Constructor Details
-
XYAxis
public XYAxis()Constructor XYAxis
-
-
Method Details
-
draw
Draws the axis in a drawing panel. -
setLabelFormat
Method setLabelFormat- Parameters:
format
-
-
setLabelFormat
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
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
Sets the title.- Parameters:
title
-
-
setTitleFont
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
-
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 interfaceMeasurable
- Returns:
- minimum
-
getXMax
public double getXMax()Gets the maximum x needed to draw this object.- Specified by:
getXMax
in interfaceMeasurable
- Returns:
- maximum
-
getYMin
public double getYMin()Gets the minimum y needed to draw this object.- Specified by:
getYMin
in interfaceMeasurable
- Returns:
- minimum
-
getYMax
public double getYMax()Gets the maximum y needed to draw this object.- Specified by:
getYMax
in interfaceMeasurable
- 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 interfaceMeasurable
- Returns:
- true if min/max values are valid
-
findInteractive
- Specified by:
findInteractive
in interfaceInteractive
-
setEnabled
public void setEnabled(boolean _enabled) - Specified by:
setEnabled
in interfaceInteractive
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceInteractive
-
setXY
public void setXY(double x, double y) - Specified by:
setXY
in interfaceInteractive
-
setX
public void setX(double x) - Specified by:
setX
in interfaceInteractive
-
setY
public void setY(double y) - Specified by:
setY
in interfaceInteractive
-
getX
public double getX()- Specified by:
getX
in interfaceInteractive
-
getY
public double getY()- Specified by:
getY
in interfaceInteractive
-
log10
- Parameters:
x
- a double value- Returns:
- The log10
- Throws:
ArithmeticException
-