sgtplot
Class SpaceAxis
- java.lang.Object
-
- sgtplot.Axis
-
- sgtplot.SpaceAxis
-
- All Implemented Interfaces:
- Selectable
public abstract class SpaceAxis extends Axis
Abstract base class for axes whose user coordinates are double values. The following is an example of using aPlainAxis.import gov.noaa.pmel.sgt.PlainAxis; import gov.noaa.pmel.sgt.LinearTransform; import gov.noaa.pmel.sgt.Graph; ... Graph graph; PlainAxis xbot, xtop; LinearTransform xt; Point2D.Double lowerleft = new Point2D.Double(10.0, 100.0); ... // // Instatiate xt and set it as the x transform. // xt = new LinearTransform(0.75, 3.5, 10.0, 100.0); graph.setXTransform(xt); ... // // Instatiate xbot and set its range, delta, and // location. Set xbot the numberSmallTics property // for xbot. // xbot = new PlainAxis("Bottom Axis"); xbot.setRangeU(new Range2D(10.0, 100.0)); xbot.setDeltaU(20.0); xbot.setNumberSmallTics(4); xbot.setLocationU(lowerleft); // // Create title for xbot. // Font xbfont = new Font("Helvetica", Font.ITALIC, 14); xbot.setLabelFont(xbfont); SGLabel xtitle = new SGLabel("xaxis title", "Test X-Axis Title", new Point2D.Double(0.0, 0.0)); Font xtfont = new Font("Helvetica", Font.PLAIN, 14); xtitle.setFont(xtfont); xtitle.setHeightP(0.2); xbot.setTitle(xtitle); graph.setXAxis(xbot); ... // // Instatiate xtop and set its range, delta, and // location. Set xtop properties on ticPosition and // labelPosition. // xtop = new PlainAxis("Top Axis"); xtop.setRangeU(new Range2D(10.0, 100.0)); xtop.setDeltaU(20.0); xtop.setNumberSmallTics(0); xtop.setLocationU(new Point2D.Double(10.0, 300.0)); xtop.setLabelFont(xbfont); xtop.setTicPosition(Axis.POSITIVE_SIDE); xtop.setLabelPosition(Axis.NO_LABEL); graph.setXAxis(xtop); ... // // Register the x transform and the top x axis with the bottom x axis. // By registering xt and xtop, any updates to the user or physical range // of xbot will be automatically performed on xt and xtop. // xbot.register(xt); xbot.register(xtop);
-
-
Field Summary
-
Fields inherited from class sgtplot.Axis
AUTO, BOTH_SIDES, HORIZONTAL, NEGATIVE_SIDE, NO_LABEL, POSITIVE_SIDE, VERTICAL
-
-
Constructor Summary
Constructors Constructor and Description SpaceAxis()Default constructor for SpaceAxis.SpaceAxis(java.lang.String id)Constructor for Axis.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract java.awt.RectanglegetBounds()Get the bounding box for the axis in device units.doublegetDeltaU()Get the increment between large tics.java.lang.StringgetLabelFormat()Get the label format.intgetLabelInterval()Get the label interval.Point2D.DoublegetLocationU()Get the origin in user units of the axisRange2DgetRangeU()Get the user range.intgetSignificantDigits()Get the number of significant digits in the label.SoTPointgetSoTLocationU()Get current axis location.SoTRangegetSoTRangeU()Get user range.TimePointgetTimeLocationU()Get the origin in user units of the axisvoidmodified(java.lang.String mess)Used internally by sgtplot.voidsetDeltaU(double delta)Set the increment between large tics.voidsetLabelFormat(java.lang.String frmt)Set the label format.voidsetLabelInterval(int lint)Set the label interval.voidsetLocationU(Point2D.Double upt)Set the origin in user units of the axis.voidsetLocationU(SoTPoint upt)Set the axis location.voidsetLocationU(TimePoint uptt)Set the origin in user units of the axis.voidsetRangeU(Range2D ur)Set the user range to draw the axis.voidsetRangeU(SoTRange ur)Set user range.voidsetSignificantDigits(int nsig)Set the number of significant digits in the label.-
Methods inherited from class sgtplot.Axis
clear, clear, clearAllRegisteredAxes, clearAllRegisteredTransforms, copy, getGraph, getId, getLabelColor, getLabelFont, getLabelHeightP, getLabelPosition, getLargeTicHeightP, getLineColor, getNumberRegisteredAxes, getNumberRegisteredTransforms, getNumberSmallTics, getOrientation, getPane, getRangeP, getSmallTicHeightP, getThickTicWidthP, getTicPosition, getTitle, isSelectable, isSelected, isSpace, isTime, isVisible, register, register, setId, setLabelColor, setLabelFont, setLabelHeightP, setLabelPosition, setLargeTicHeightP, setLineColor, setNumberSmallTics, setOrientation, setRangeP, setSelectable, setSelected, setSmallTicHeightP, setThickTicWidthP, setTicPosition, setTitle, setVisible, toString
-
-
-
-
Constructor Detail
-
SpaceAxis
public SpaceAxis()
Default constructor for SpaceAxis.
-
SpaceAxis
public SpaceAxis(java.lang.String id)
Constructor for Axis. Sets the axis identifier and initializes the defaults.- Parameters:
id- axis identification
-
-
Method Detail
-
setSignificantDigits
public void setSignificantDigits(int nsig)
Set the number of significant digits in the label. This is used if a format is not specified.- Parameters:
nsig- number of significant digits
-
getSignificantDigits
public int getSignificantDigits()
Get the number of significant digits in the label.- Returns:
- number of significant digits.
-
setLabelInterval
public void setLabelInterval(int lint)
Set the label interval.- Parameters:
lint- label interval.
-
getLabelInterval
public int getLabelInterval()
Get the label interval.- Returns:
- label interval
-
setLabelFormat
public void setLabelFormat(java.lang.String frmt)
Set the label format. Format should be in the sprintf style. The formating uses the Format class in the Core Java book. A null or empty string will cause formating to use the significant digits.Gary Cornell and Cay S. Horstmann, Core Java (Book/CD-ROM) Published By SunSoft Press/Prentice-Hall Copyright (C) 1996 Sun Microsystems Inc. All Rights Reserved. ISBN 0-13-596891-7
- Parameters:
frmt- label format.
-
getLabelFormat
public java.lang.String getLabelFormat()
Get the label format.- Returns:
- label format
-
setRangeU
public void setRangeU(Range2D ur)
Set the user range to draw the axis. Registered Axes and AxisTransforms will be updated.- Parameters:
ur- range in user coordinates
-
getRangeU
public Range2D getRangeU()
Get the user range.- Returns:
- range in user coordinates
-
getSoTRangeU
public SoTRange getSoTRangeU()
Description copied from class:AxisGet user range.- Specified by:
getSoTRangeUin classAxis
-
setDeltaU
public void setDeltaU(double delta)
Set the increment between large tics.- Parameters:
delta- increment in user coordinates
-
getDeltaU
public double getDeltaU()
Get the increment between large tics.- Returns:
- user coordinate increment
-
setLocationU
public void setLocationU(TimePoint uptt)
Set the origin in user units of the axis.- Parameters:
upt- origin in user units
-
setLocationU
public void setLocationU(Point2D.Double upt)
Set the origin in user units of the axis.- Parameters:
upt- origin in user units
-
setLocationU
public void setLocationU(SoTPoint upt)
Description copied from class:AxisSet the axis location.- Specified by:
setLocationUin classAxis
-
getLocationU
public Point2D.Double getLocationU()
Get the origin in user units of the axis- Returns:
- origin
-
getTimeLocationU
public TimePoint getTimeLocationU()
Get the origin in user units of the axis- Returns:
- origin
-
getSoTLocationU
public SoTPoint getSoTLocationU()
Description copied from class:AxisGet current axis location.- Specified by:
getSoTLocationUin classAxis
-
getBounds
public abstract java.awt.Rectangle getBounds()
Get the bounding box for the axis in device units.- Specified by:
getBoundsin interfaceSelectable- Specified by:
getBoundsin classAxis- Returns:
- bounding box
- See Also:
Rectangle
-
-
DMelt 3.0 © DataMelt by jWork.ORG