sgtplot
Class Axis
- java.lang.Object
-
- sgtplot.Axis
-
- All Implemented Interfaces:
- Selectable
public abstract class Axis extends java.lang.Object implements Selectable
Abstract base class for Cartesian axes. Cartesian axes are designed to be used with theCartesianGraphclass. Axes andAxisTransforms can be registed with anAxis. This allows changes in both the physical range and user range to be immediatedly updated for the registeredAxisTransforms and axes.Cartesian axes can have their user coordinates be double values or time (as
GeoDateobjects). These have been separated into two child objects.
-
-
Field Summary
Fields Modifier and Type Field and Description static intAUTOstatic intBOTH_SIDESDraw the tics on both sides of the axes.static intHORIZONTALDraw a horizontal axis.static intNEGATIVE_SIDEPlace the label and/or tic on the negative side of the axis.static intNO_LABELDo not draw a label and/or tic.static intPOSITIVE_SIDEPlace the label and/or tic on the positive side of the axis.static intVERTICALDraw a vertical axis.
-
Constructor Summary
Constructors Constructor and Description Axis()Default constructor for Axis.Axis(java.lang.String id)Constructor for Axis.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidclear(Axis axis)Unregister an axis.voidclear(AxisTransform trns)Unregister anAxisTransform.voidclearAllRegisteredAxes()Unregister all axes.voidclearAllRegisteredTransforms()Unregister allAxisTransforms.abstract Axiscopy()Create a copy of the axis.abstract java.awt.RectanglegetBounds()Get the bounding box for the axis in device units.CartesianGraphgetGraph()Get theGraphassociated with the axis.java.lang.StringgetId()Get the axis identifier.java.awt.ColorgetLabelColor()Get the label color.java.awt.FontgetLabelFont()Get the label font.doublegetLabelHeightP()Get the label height.intgetLabelPosition()Get the label position.doublegetLargeTicHeightP()Get the large tic height.java.awt.ColorgetLineColor()Get the line color.intgetNumberRegisteredAxes()Get the number of currently registered axes.intgetNumberRegisteredTransforms()Get the number of currently registered transforms.intgetNumberSmallTics()Get the number of small tics between large tics.intgetOrientation()Get axis orientationAbstractPanegetPane()Get the parent pane.Range2DgetRangeP()Get the physical range.doublegetSmallTicHeightP()Get the small tic height.abstract SoTPointgetSoTLocationU()Get current axis location.abstract SoTRangegetSoTRangeU()Get user range.doublegetThickTicWidthP()Get the thick tic width.intgetTicPosition()Get the tic position.SGLabelgetTitle()Get the axis title.booleanisSelectable()Determines if the axis is selectable.booleanisSelected()Determines if the axis has been selected.booleanisSpace()Tests if axis is space.booleanisTime()Tests if axis is time.booleanisVisible()Determines if the axis is visible.voidmodified(java.lang.String mess)Used internally by sgtplot.voidregister(Axis axis)Register an axis.voidregister(AxisTransform trns)Register anAxisTransform.voidsetId(java.lang.String id)Set the axis identifier.voidsetLabelColor(java.awt.Color color)Set the label color.voidsetLabelFont(java.awt.Font fnt)Set the label font.voidsetLabelHeightP(double lhgt)Set the label height in physical units.voidsetLabelPosition(int labp)Set the label position.voidsetLargeTicHeightP(double lthgt)Set the large tic height in physical units.voidsetLineColor(java.awt.Color color)Set the line and tick color.abstract voidsetLocationU(SoTPoint pt)Set the axis location.voidsetNumberSmallTics(int nstic)Set the number of small tics between large tics.voidsetOrientation(int or)Set axis orientation.voidsetRangeP(Range2D pr)Set the physical range.abstract voidsetRangeU(SoTRange range)Set user range.voidsetSelectable(boolean select)Set the selectable state.voidsetSelected(boolean sel)Sets the selected property.voidsetSmallTicHeightP(double sthgt)Set the small tic height in physical units.voidsetThickTicWidthP(double wid)Set the thick tic width in physical units.voidsetTicPosition(int tpos)Set the tic position.voidsetTitle(SGLabel title)Set the axis title.voidsetVisible(boolean visible)Set the visibility state.java.lang.StringtoString()Get aStringrepresentation of theAxis.
-
-
-
Field Detail
-
POSITIVE_SIDE
public static final int POSITIVE_SIDE
Place the label and/or tic on the positive side of the axis. The right side ofVERTICALaxes and the top ofHORIZONTALaxes.- See Also:
- Constant Field Values
-
NEGATIVE_SIDE
public static final int NEGATIVE_SIDE
Place the label and/or tic on the negative side of the axis. The left side ofVERTICALaxes and the bottom ofHORIZONTALaxes.- See Also:
- Constant Field Values
-
NO_LABEL
public static final int NO_LABEL
Do not draw a label and/or tic.- See Also:
- Constant Field Values
-
BOTH_SIDES
public static final int BOTH_SIDES
Draw the tics on both sides of the axes.- See Also:
- Constant Field Values
-
HORIZONTAL
public static final int HORIZONTAL
Draw a horizontal axis.- See Also:
- Constant Field Values
-
VERTICAL
public static final int VERTICAL
Draw a vertical axis.- See Also:
- Constant Field Values
-
AUTO
public static final int AUTO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Axis
public Axis()
Default constructor for Axis.
-
Axis
public Axis(java.lang.String id)
Constructor for Axis. Sets the axis identifier and initializes the defaults. Default values are:numberSmallTics = 0 largeTicHeightP = 0.1 smallTicHeightP = 0.05 thickTicWidth_ = 0.025 ticPosition = NEGATIVE_SIDE labelPosition = NEGATIVE_SIDE labelInterval = 2 labelFont = Font("Helvetica", Font.ITALIC, 10); labelColor = Color.black; labelHeightP = 0.15 significantDigits = 2; labelFormat = "" title = null orientation = HORIZONTAL selectable = true visible = true- Parameters:
id- axis identifier
-
-
Method Detail
-
copy
public abstract Axis copy()
Create a copy of the axis.- Returns:
- the copy
-
getGraph
public CartesianGraph getGraph()
Get theGraphassociated with the axis.- Returns:
- Graph object.
-
getPane
public AbstractPane getPane()
Get the parent pane.- Returns:
- AbstractPane
- Since:
- 2.0
-
modified
public void modified(java.lang.String mess)
Used internally by sgtplot.- Since:
- 2.0
-
register
public void register(Axis axis)
Register an axis. Registered axes will be notified of changes to the user coordinate range.- Parameters:
axis- An Axis object.
-
register
public void register(AxisTransform trns)
Register anAxisTransform. RegisteredAxisTransforms will be notified of changes to the user coordinate range and physical coordinate range.- Parameters:
trns- A AxisTransform object.
-
clear
public void clear(Axis axis)
Unregister an axis. Axis will no longer be notified of changes in the user range.- Parameters:
axis- An Axis object.
-
clear
public void clear(AxisTransform trns)
Unregister anAxisTransform. TheAxisTransformwill no longer be notified of changes to the user or physical coordinate range.- Parameters:
trns- A AxisTransform ojbect.
-
clearAllRegisteredAxes
public void clearAllRegisteredAxes()
Unregister all axes. No axes will be notified of changes in the user range.
-
clearAllRegisteredTransforms
public void clearAllRegisteredTransforms()
Unregister allAxisTransforms. NoAxisTransforms will be notified of changes in the user of physical range.
-
getNumberRegisteredTransforms
public int getNumberRegisteredTransforms()
Get the number of currently registered transforms.- Returns:
- number of registered transforms
-
getNumberRegisteredAxes
public int getNumberRegisteredAxes()
Get the number of currently registered axes.- Returns:
- number of registered axes
-
setLargeTicHeightP
public void setLargeTicHeightP(double lthgt)
Set the large tic height in physical units.- Parameters:
lthgt- large tic height.
-
getLargeTicHeightP
public double getLargeTicHeightP()
Get the large tic height.- Returns:
- large tic height in physcial units.
-
setNumberSmallTics
public void setNumberSmallTics(int nstic)
Set the number of small tics between large tics.- Parameters:
nstic- number of small tics.
-
getNumberSmallTics
public int getNumberSmallTics()
Get the number of small tics between large tics.- Returns:
- number of small tics.
-
setSmallTicHeightP
public void setSmallTicHeightP(double sthgt)
Set the small tic height in physical units.- Parameters:
sthgt- small tic height.
-
getSmallTicHeightP
public double getSmallTicHeightP()
Get the small tic height.- Returns:
- small tic height in physical units.
-
setThickTicWidthP
public void setThickTicWidthP(double wid)
Set the thick tic width in physical units. Minimum thickness is 3 pixels.- Parameters:
wid- thick tic width.
-
getThickTicWidthP
public double getThickTicWidthP()
Get the thick tic width.- Returns:
- thick tic width in physical units.
-
setTicPosition
public void setTicPosition(int tpos)
Set the tic position. Tic position can bePOSITIVE_SIDE,NEGATIVE_SIDE, orBOTH_SIDES.- Parameters:
tpos- tic position
-
getTicPosition
public int getTicPosition()
Get the tic position.- Returns:
- tic position
-
setLabelPosition
public void setLabelPosition(int labp)
Set the label position. Label position can bePOSITIVE_SIDE,NEGATIVE_SIDE, andNO_LABEL.- Parameters:
labp- label position.
-
getLabelPosition
public int getLabelPosition()
Get the label position.- Returns:
- label position
-
setLabelFont
public void setLabelFont(java.awt.Font fnt)
Set the label font.- Parameters:
fnt- label font
-
getLabelFont
public java.awt.Font getLabelFont()
Get the label font.- Returns:
- label font
-
setLineColor
public void setLineColor(java.awt.Color color)
Set the line and tick color.- Parameters:
color- line and tick color- Since:
- 3.0
-
getLineColor
public java.awt.Color getLineColor()
Get the line color.- Returns:
- color
- Since:
- 3.0
-
setLabelColor
public void setLabelColor(java.awt.Color color)
Set the label color.- Parameters:
color- label color- Since:
- 2.0
-
getLabelColor
public java.awt.Color getLabelColor()
Get the label color.- Returns:
- color
- Since:
- 2.0
-
setLabelHeightP
public void setLabelHeightP(double lhgt)
Set the label height in physical units.- Parameters:
lhgt- label height.
-
getLabelHeightP
public double getLabelHeightP()
Get the label height.- Returns:
- label height
-
setTitle
public void setTitle(SGLabel title)
Set the axis title.- Parameters:
title- axis title
-
getTitle
public SGLabel getTitle()
Get the axis title.- Returns:
- axis title
-
setRangeP
public void setRangeP(Range2D pr)
Set the physical range. This method updates any registeredTransforms. If noTransforms are registered, thesetRangePmethod has no effect.- Parameters:
pr- physcial range
-
getRangeP
public Range2D getRangeP()
Get the physical range. Obtains the physical range from the associatedCartesianGraphobject and attachedTransform.- Returns:
- physical range
-
setId
public void setId(java.lang.String id)
Set the axis identifier.- Parameters:
id- identifier
-
getId
public java.lang.String getId()
Get the axis identifier.- Returns:
- identifier
-
setOrientation
public void setOrientation(int or)
Set axis orientation. Allowed orientations areHORIZONATALandVERTICAL.- Parameters:
or- orientation
-
getOrientation
public int getOrientation()
Get axis orientation- Returns:
- axis orientation
-
isSpace
public boolean isSpace()
Tests if axis is space.- Returns:
- true if space
-
isTime
public boolean isTime()
Tests if axis is time.- Returns:
- true if time
-
getBounds
public abstract java.awt.Rectangle getBounds()
Get the bounding box for the axis in device units.- Specified by:
getBoundsin interfaceSelectable- Returns:
- bounding box
-
toString
public java.lang.String toString()
Get aStringrepresentation of theAxis.- Overrides:
toStringin classjava.lang.Object- Returns:
Stringrepresentation
-
setSelected
public void setSelected(boolean sel)
Description copied from interface:SelectableSets the selected property.- Specified by:
setSelectedin interfaceSelectable- Parameters:
sel- true if selected, false if not.
-
isSelected
public boolean isSelected()
Determines if the axis has been selected.- Specified by:
isSelectedin interfaceSelectable- Returns:
- true, if selected
- Since:
- 2.0
-
setSelectable
public void setSelectable(boolean select)
Set the selectable state.- Specified by:
setSelectablein interfaceSelectable- Parameters:
select- if true object is selectable- Since:
- 2.0
-
isSelectable
public boolean isSelectable()
Determines if the axis is selectable.- Specified by:
isSelectablein interfaceSelectable- Returns:
- true if selectable
- Since:
- 2.0
-
isVisible
public boolean isVisible()
Determines if the axis is visible.- Since:
- 2.0
-
setVisible
public void setVisible(boolean visible)
Set the visibility state.- Since:
- 2.0
-
setLocationU
public abstract void setLocationU(SoTPoint pt)
Set the axis location.- Since:
- 2.0
-
getSoTLocationU
public abstract SoTPoint getSoTLocationU()
Get current axis location.- Since:
- 2.0
-
setRangeU
public abstract void setRangeU(SoTRange range)
Set user range.- Since:
- 2.0
-
getSoTRangeU
public abstract SoTRange getSoTRangeU()
Get user range.- Since:
- 2.0
-
-
DMelt 3.0 © DataMelt by jWork.ORG