de.erichseifert.gral.plots.axes
Class Axis
- java.lang.Object
-
- de.erichseifert.gral.plots.axes.Axis
-
- All Implemented Interfaces:
- java.io.Serializable
public class Axis extends java.lang.Object implements java.io.SerializableClass that represents an arbitrary axis.
Functionality includes:
- Different ways of setting and getting the range of this axis
- Administration of
AxisListeners
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Axis()Initializes a new instance without minimum and maximum values.Axis(java.lang.Number min, java.lang.Number max)Initializes a new instance with the specified minimum and maximum values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddAxisListener(AxisListener listener)Adds the specifiedAxisListenerto this Axis.java.lang.NumbergetMax()Returns the maximum value to be displayed.java.lang.NumbergetMin()Returns the minimum value to be displayed.java.lang.NumbergetPosition(java.lang.Number value)Returns the relative position of the specified value on the axis.doublegetRange()Returns the range of values to be displayed.booleanisAutoscaled()Returns whether the axis range should be determined automatically rather than using the axis's minimum and a maximum values.booleanisValid()Returns whether the currently set minimum and maximum values are valid.voidremoveAxisListener(AxisListener listener)Removes the specifiedAxisListenerfrom this Axis.voidsetAutoscaled(boolean autoscaled)Sets whether the axis range should be determined automatically rather than using the axis's minimum and a maximum values.voidsetMax(java.lang.Number max)Sets the maximum value to be displayed.voidsetMin(java.lang.Number min)Sets the minimum value to be displayed.voidsetRange(java.lang.Number min, java.lang.Number max)Sets the range of values to be displayed.
-
-
-
Constructor Detail
-
Axis
public Axis()
Initializes a new instance without minimum and maximum values.
-
Axis
public Axis(java.lang.Number min, java.lang.Number max)Initializes a new instance with the specified minimum and maximum values.- Parameters:
min- minimum valuemax- maximum value
-
-
Method Detail
-
addAxisListener
public void addAxisListener(AxisListener listener)
Adds the specifiedAxisListenerto this Axis. The Listeners will be notified if changes to the Axis occur, for Example if the minimum or maximum value changes.- Parameters:
listener- Listener to be added- See Also:
AxisListener
-
removeAxisListener
public void removeAxisListener(AxisListener listener)
Removes the specifiedAxisListenerfrom this Axis.- Parameters:
listener- Listener to be removed- See Also:
AxisListener
-
getMin
public java.lang.Number getMin()
Returns the minimum value to be displayed.- Returns:
- Minimum value.
-
setMin
public void setMin(java.lang.Number min)
Sets the minimum value to be displayed.- Parameters:
min- Minimum value.
-
getMax
public java.lang.Number getMax()
Returns the maximum value to be displayed.- Returns:
- Maximum value.
-
setMax
public void setMax(java.lang.Number max)
Sets the maximum value to be displayed.- Parameters:
max- Maximum value.
-
getRange
public double getRange()
Returns the range of values to be displayed.- Returns:
- Distance between maximum and minimum value.
-
setRange
public void setRange(java.lang.Number min, java.lang.Number max)Sets the range of values to be displayed.- Parameters:
min- Minimum value.max- Maximum value.
-
getPosition
public java.lang.Number getPosition(java.lang.Number value)
Returns the relative position of the specified value on the axis. The value is returned in view coordinates.- Parameters:
value- Value whose positition is to be determined- Returns:
- Position relative to axis range
-
isAutoscaled
public boolean isAutoscaled()
Returns whether the axis range should be determined automatically rather than using the axis's minimum and a maximum values.- Returns:
- whether the axis is scaled automatically to fit the current data
-
setAutoscaled
public void setAutoscaled(boolean autoscaled)
Sets whether the axis range should be determined automatically rather than using the axis's minimum and a maximum values.- Parameters:
autoscaled- Defines whether the axis should be automatically scaled to fit the current data.
-
isValid
public boolean isValid()
Returns whether the currently set minimum and maximum values are valid.- Returns:
truewhen minimum and maximum values are correct, otherwisefalse
-
-
DataMelt 3.0 © DataMelt by jWork.ORG