Documentation of 'sgtplot.Graph' Java class
Graph
sgtplot

Class Graph

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.util.EventListener
    Direct Known Subclasses:
    CartesianGraph, MapGraph, PolarGraph


    public abstract class Graph
    extends java.lang.Object
    implements java.beans.PropertyChangeListener
    Abstract base class for all graphics drawn on a Layer. The Graph class defines the interfaces for the user to physical coordinate, user to device, and physical to user coordinate systems.

    The following demonstrates how a CartesianGraph may be used.

       // Create a CartesianGraph and transforms.
    
        CartesianGraph graph;
        LinearTransform xt, yt;
        Range2D xPhysRange, xUserRange;
        Range2D yPhysRange, yUserRange;
        Point2D.Double origin;
    
        graph = new CartesianGraph("Point Graph");
        layer.setGraph(graph);
        xt = new LinearTransform(xPhysRange, xUserRange);
        yt = new LinearTransform(yPhysRange, yUserRange);
        graph.setXTransform(xt);
        graph.setYTransform(yt);
        origin = new Point2D.Double(xUserRange.start,
                                    yUserRange.start);
    
         // Create the bottom axis, set its range in user units
         // and its origin. Add the axis to the graph.
    
        PlainAxis xbot;
    
        xbot = new PlainAxis("Botton Axis");
        xbot.setRangeU(xUserRange);
        xbot.setLocationU(origin);
        graph.addXAxis(xbot);
    
         // Create the left axis, set its range in user units
         // and its origin. Add the axis to the graph.
    
        PlainAxis yleft;
    
        yleft = new PlainAxis("Left Axis");
        yleft.setRangeU(yUserRange);
        yleft.setLocationU(origin);
        graph.addYAxis(yleft);
    
         // Create a PointAttribute for the display of the
         // Collection of points. The points will be marked
         // with a red triangle and labelled at the NE corner
         // in blue.
    
        PointAttribute pattr;
    
        pattr = new PointAttribute(10, Color.red);
    
         // Associate the attribute and the point Collection
         // with the graph.
    
        graph.setData(col, pattr);
     
    Since:
    1.0
    See Also:
    Layer, LinearTransform, PlainAxis, SGLabel, CartesianGraph
    • Constructor Summary

      Constructors 
      Constructor and Description
      Graph()
      Default constructor.
      Graph(java.lang.String id)
      Constructor for Graph class.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      static Range2D computeRange(double min, double max, int num)
      Compute a "nice" range from the minimum, maximum, and number of intervals.
      static Range2D computeRange(Range2D range, int num)
      Compute a "nice" range from a range and number of intervals.
      static SoTRange computeRange(SoTRange range, int num)
      Compute a "nice" range from a range and number of intervals.
      abstract Graph copy()
      Copy the Graph object and all attached classes.
      abstract SGTData getDataAt(java.awt.Point pt)
      Find data at a Point
      java.lang.String getId()
      Get the Graph identifier
      Layer getLayer()
      Get the associated Layer.
      AbstractPane getPane()
      Return parent pane.
      void modified(java.lang.String mess)
      Used internally by sgtplot.
      java.lang.String toString()
      Get a String representation of the Graph.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.beans.PropertyChangeListener

        propertyChange
    • Constructor Detail

      • Graph

        public Graph()
        Default constructor.
      • Graph

        public Graph(java.lang.String id)
        Constructor for Graph class.
        Parameters:
        id - identifier
    • Method Detail

      • copy

        public abstract Graph copy()
        Copy the Graph object and all attached classes.
      • getId

        public java.lang.String getId()
        Get the Graph identifier
        Returns:
        ident
      • getLayer

        public Layer getLayer()
        Get the associated Layer.
        Returns:
        Layer object
      • getPane

        public AbstractPane getPane()
        Return parent pane.
        Since:
        2.0
      • modified

        public void modified(java.lang.String mess)
        Used internally by sgtplot.
        Since:
        2.0
      • computeRange

        public static Range2D computeRange(Range2D range,
                                           int num)
        Compute a "nice" range from a range and number of intervals.
        Parameters:
        range - min and max values
        num - number of intervals
        Returns:
        "nice" range
      • computeRange

        public static SoTRange computeRange(SoTRange range,
                                            int num)
        Compute a "nice" range from a range and number of intervals.
        Parameters:
        range - min and max values
        num - number of intervals
        Returns:
        "nice" range
        Since:
        2.0
      • computeRange

        public static Range2D computeRange(double min,
                                           double max,
                                           int num)
        Compute a "nice" range from the minimum, maximum, and number of intervals.
        Parameters:
        min - minimum value
        max - maximum value
        num - number of intervals
        Returns:
        "nice" range
      • toString

        public java.lang.String toString()
        Get a String representation of the Graph.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation
      • getDataAt

        public abstract SGTData getDataAt(java.awt.Point pt)
        Find data at a Point
        Since:
        3.0

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.