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 intField DRAW_AT_LOCATIONstatic final intField DRAW_IN_DISPLAYstatic final intField DRAW_IN_GUTTERstatic final intField LINEARstatic final intField LOG10protected doubleprotected double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcalculateLabels(double minimum, double maximum, int numTicks) Calculates the axis labels.abstract voiddraw(DrawingPanel panel, Graphics g) Draws the axis in a drawing panel.protected voiddrawMultiplier(int xpix, int ypix, int exponent, Graphics2D g2) findInteractive(DrawingPanel panel, int _xpix, int _ypix) doublegetX()doublegetXMax()Gets the maximum x needed to draw this object.doublegetXMin()Gets the minimum x needed to draw this object.doublegetY()doublegetYMax()Gets the maximum y needed to draw this object.doublegetYMin()Gets the minimum y needed to draw this object.booleanbooleanDetermines if information is available to set min/max values.static doublelog10(double x) voidsetAxisType(int type) Method setAxisTypevoidsetEnabled(boolean _enabled) voidsetLabelFormat(String formatString) Method setLabelFormatvoidsetLabelFormat(DecimalFormat format) Method setLabelFormatvoidsetLocation(double _location) Sets the location type.voidsetLocationType(int _locationType) Sets the location type.voidsetShowMajorGrid(boolean show) voidSets the title.voidSets the title.voidsetTitleFont(String name) Set the title font.voidsetX(double x) voidsetXY(double x, double y) voidsetY(double y) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getXMinin interfaceMeasurable- Returns:
- minimum
-
getXMax
public double getXMax()Gets the maximum x needed to draw this object.- Specified by:
getXMaxin interfaceMeasurable- Returns:
- maximum
-
getYMin
public double getYMin()Gets the minimum y needed to draw this object.- Specified by:
getYMinin interfaceMeasurable- Returns:
- minimum
-
getYMax
public double getYMax()Gets the maximum y needed to draw this object.- Specified by:
getYMaxin 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:
isMeasuredin interfaceMeasurable- Returns:
- true if min/max values are valid
-
findInteractive
- Specified by:
findInteractivein interfaceInteractive
-
setEnabled
public void setEnabled(boolean _enabled) - Specified by:
setEnabledin interfaceInteractive
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceInteractive
-
setXY
public void setXY(double x, double y) - Specified by:
setXYin interfaceInteractive
-
setX
public void setX(double x) - Specified by:
setXin interfaceInteractive
-
setY
public void setY(double y) - Specified by:
setYin interfaceInteractive
-
getX
public double getX()- Specified by:
getXin interfaceInteractive
-
getY
public double getY()- Specified by:
getYin interfaceInteractive
-
log10
- Parameters:
x- a double value- Returns:
- The log10
- Throws:
ArithmeticException
-