edu.rit.numeric.plot.impl
Class SegmentedPlotSeries
- java.lang.Object
-
- edu.rit.numeric.plot.impl.PlotSeries
-
- edu.rit.numeric.plot.impl.SegmentedPlotSeries
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
public class SegmentedPlotSeries extends PlotSeries
Class SegmentedPlotSeries provides a plot series for an XYPlot. An XYSeries specifies the data points to be plotted. The data points are divided into pairs. Each pair of data points specifies the starting and ending coordinates of a line segment. A dot is drawn at each endpoint of each line segment. A line segment's starting coordinates need not be the same as the previous line segment's ending coordinates. If the data series has an odd number of data points, the last data point is ignored.Class SegmentedPlotSeries provides operations to tell where to plot data points as well as which Drawable object to use to plot the points. Class Dots provides several shapes of drawable objects for plotting data points.
Class SegmentedPlotSeries provides operations to tell where to plot line segments as well as which stroke and color objects to use to plot the line segments. Class Strokes provides several kinds of strokes for drawing lines.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SegmentedPlotSeries()Construct a new segmented plot series.SegmentedPlotSeries(XYSeries theDataSeries, java.awt.BasicStroke theStroke, java.awt.Color theColor)Construct a new segmented plot series.SegmentedPlotSeries(XYSeries theDataSeries, Dots theDots)Construct a new segmented plot series.SegmentedPlotSeries(XYSeries theDataSeries, Dots theDots, java.awt.BasicStroke theStroke, java.awt.Color theColor)Construct a new segmented plot series.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetDotCount()Returns the number of dots to be plotted.doublegetDotX(int i)Returns the X coordinate of the given dot.doublegetDotY(int i)Returns the Y coordinate of the given dot.intgetLineCount()Returns the number of line segments to be plotted.doublegetLineX1(int i)Returns the starting X coordinate of the given line segment.doublegetLineX2(int i)Returns the ending X coordinate of the given line segment.doublegetLineY1(int i)Returns the starting Y coordinate of the given line segment.doublegetLineY2(int i)Returns the ending Y coordinate of the given line segment.-
Methods inherited from class edu.rit.numeric.plot.impl.PlotSeries
getColor, getDataSeries, getDots, getStroke, isSmooth, readExternal, writeExternal
-
-
-
-
Constructor Detail
-
SegmentedPlotSeries
public SegmentedPlotSeries()
Construct a new segmented plot series. This constructor is intended for use only by object deserialization.
-
SegmentedPlotSeries
public SegmentedPlotSeries(XYSeries theDataSeries, Dots theDots)
Construct a new segmented plot series. The given data series contains the data points to be plotted. Dots are plotted on the data points using the given drawable object. Lines are not drawn between data points.- Parameters:
theDataSeries- Data series.theDots- Drawable object for plotting data points. If null, dots are not plotted on the data points.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDataSeries is null.
-
SegmentedPlotSeries
public SegmentedPlotSeries(XYSeries theDataSeries, java.awt.BasicStroke theStroke, java.awt.Color theColor)
Construct a new segmented plot series. The given data series contains the data points to be plotted. No dots are plotted on the data points. Lines are drawn between data points using the given stroke and color.- Parameters:
theDataSeries- Data series.theStroke- Stroke for drawing lines between data points. If null, lines are not drawn between data points.theColor- Color for drawing lines between data points. If null, lines are not drawn between data points.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDataSeries is null.
-
SegmentedPlotSeries
public SegmentedPlotSeries(XYSeries theDataSeries, Dots theDots, java.awt.BasicStroke theStroke, java.awt.Color theColor)
Construct a new segmented plot series. The given data series contains the data points to be plotted. Dots are plotted on the data points using the given drawable object. Lines are drawn between data points using the given stroke and color.- Parameters:
theDataSeries- Data series.theDots- Drawable object for plotting data points. If null, dots are not plotted on the data points.theStroke- Stroke for drawing lines between data points. If null, lines are not drawn between data points.theColor- Color for drawing lines between data points. If null, lines are not drawn between data points.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDataSeries is null.
-
-
Method Detail
-
getDotCount
public int getDotCount()
Returns the number of dots to be plotted.- Specified by:
getDotCountin classPlotSeries
-
getDotX
public double getDotX(int i)
Returns the X coordinate of the given dot.- Specified by:
getDotXin classPlotSeries- Parameters:
i- Dot index.- Returns:
- X coordinate.
- Throws:
java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if i is not in the range 0 .. getDotCount()-1.
-
getDotY
public double getDotY(int i)
Returns the Y coordinate of the given dot.This method must be overridden in a subclass.
- Specified by:
getDotYin classPlotSeries- Parameters:
i- Dot index.- Returns:
- Y coordinate.
- Throws:
java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if i is not in the range 0 .. getDotCount()-1.
-
getLineCount
public int getLineCount()
Returns the number of line segments to be plotted.- Specified by:
getLineCountin classPlotSeries
-
getLineX1
public double getLineX1(int i)
Returns the starting X coordinate of the given line segment.- Specified by:
getLineX1in classPlotSeries- Parameters:
i- Line segment index.- Returns:
- Starting X coordinate.
- Throws:
java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if i is not in the range 0 .. getLineCount()-1.
-
getLineY1
public double getLineY1(int i)
Returns the starting Y coordinate of the given line segment.- Specified by:
getLineY1in classPlotSeries- Parameters:
i- Line segment index.- Returns:
- Starting Y coordinate.
- Throws:
java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if i is not in the range 0 .. getLineCount()-1.
-
getLineX2
public double getLineX2(int i)
Returns the ending X coordinate of the given line segment.- Specified by:
getLineX2in classPlotSeries- Parameters:
i- Line segment index.- Returns:
- Ending X coordinate.
- Throws:
java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if i is not in the range 0 .. getLineCount()-1.
-
getLineY2
public double getLineY2(int i)
Returns the ending Y coordinate of the given line segment.- Specified by:
getLineY2in classPlotSeries- Parameters:
i- Line segment index.- Returns:
- Ending Y coordinate.
- Throws:
java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if i is not in the range 0 .. getLineCount()-1.
-
-
DMelt 3.0 © DataMelt by jWork.ORG