sgtplot
Class Graph
- java.lang.Object
-
- sgtplot.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.PropertyChangeListenerAbstract base class for all graphics drawn on aLayer. TheGraphclass defines the interfaces for the user to physical coordinate, user to device, and physical to user coordinate systems.The following demonstrates how a
CartesianGraphmay 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 forGraphclass.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description static Range2DcomputeRange(double min, double max, int num)Compute a "nice" range from the minimum, maximum, and number of intervals.static Range2DcomputeRange(Range2D range, int num)Compute a "nice" range from a range and number of intervals.static SoTRangecomputeRange(SoTRange range, int num)Compute a "nice" range from a range and number of intervals.abstract Graphcopy()Copy theGraphobject and all attached classes.abstract SGTDatagetDataAt(java.awt.Point pt)Find data at aPointjava.lang.StringgetId()Get theGraphidentifierLayergetLayer()Get the associatedLayer.AbstractPanegetPane()Return parent pane.voidmodified(java.lang.String mess)Used internally by sgtplot.java.lang.StringtoString()Get aStringrepresentation of theGraph.
-
-
-
Constructor Detail
-
Graph
public Graph()
Default constructor.
-
Graph
public Graph(java.lang.String id)
Constructor forGraphclass.- Parameters:
id- identifier
-
-
Method Detail
-
copy
public abstract Graph copy()
Copy theGraphobject and all attached classes.
-
getId
public java.lang.String getId()
Get theGraphidentifier- Returns:
- ident
-
getLayer
public Layer getLayer()
Get the associatedLayer.- Returns:
Layerobject
-
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 valuesnum- 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 valuesnum- 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 valuemax- maximum valuenum- number of intervals- Returns:
- "nice" range
-
toString
public java.lang.String toString()
Get aStringrepresentation of theGraph.- Overrides:
toStringin classjava.lang.Object- Returns:
Stringrepresentation
-
getDataAt
public abstract SGTData getDataAt(java.awt.Point pt)
Find data at aPoint- Since:
- 3.0
-
-
DMelt 3.0 © DataMelt by jWork.ORG