Documentation of 'sgtplot.SpaceAxis' Java class
SpaceAxis
sgtplot

Class SpaceAxis

  • All Implemented Interfaces:
    Selectable
    Direct Known Subclasses:
    LogAxis, PlainAxis


    public abstract class SpaceAxis
    extends Axis
    Abstract base class for axes whose user coordinates are double values. The following is an example of using a PlainAxis.
     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);
     
    Since:
    1.0
    See Also:
    Axis, PlainAxis, TimeAxis
    • 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
      • setRangeU

        public void setRangeU(SoTRange ur)
        Description copied from class: Axis
        Set user range.
        Specified by:
        setRangeU in class Axis
      • getRangeU

        public Range2D getRangeU()
        Get the user range.
        Returns:
        range in user coordinates
      • getSoTRangeU

        public SoTRange getSoTRangeU()
        Description copied from class: Axis
        Get user range.
        Specified by:
        getSoTRangeU in class Axis
      • 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: Axis
        Set the axis location.
        Specified by:
        setLocationU in class Axis
      • 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: Axis
        Get current axis location.
        Specified by:
        getSoTLocationU in class Axis
      • getBounds

        public abstract java.awt.Rectangle getBounds()
        Get the bounding box for the axis in device units.
        Specified by:
        getBounds in interface Selectable
        Specified by:
        getBounds in class Axis
        Returns:
        bounding box
        See Also:
        Rectangle
      • modified

        public void modified(java.lang.String mess)
        Description copied from class: Axis
        Used internally by sgtplot.
        Overrides:
        modified in class Axis

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.