Class PlotSeries
- java.lang.Object
-
- edu.rit.numeric.plot.impl.PlotSeries
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
- Direct Known Subclasses:
- SegmentedPlotSeries, XYPlotSeries
public abstract class PlotSeries extends java.lang.Object implements java.io.ExternalizableClass PlotSeries is the abstract base class for a plot series for an XYPlot.Class PlotSeries 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 PlotSeries 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.
Class PlotSeries provides an operation to tell whether to plot a smooth curve instead of straight line segments.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description PlotSeries()Construct a new plot series.PlotSeries(XYSeries theDataSeries, Dots theDots, java.awt.BasicStroke theStroke, java.awt.Color theColor, boolean isSmooth)Construct a new plot series.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description java.awt.ColorgetColor()Returns the color for drawing line segments for this plot series.XYSeriesgetDataSeries()Returns the data series for this plot series.abstract intgetDotCount()Returns the number of dots to be plotted.DotsgetDots()Returns the drawable object for plotting data points for this XY plot series.abstract doublegetDotX(int i)Returns the X coordinate of the given dot.abstract doublegetDotY(int i)Returns the Y coordinate of the given dot.abstract intgetLineCount()Returns the number of line segments to be plotted.abstract doublegetLineX1(int i)Returns the starting X coordinate of the given line segment.abstract doublegetLineX2(int i)Returns the ending X coordinate of the given line segment.abstract doublegetLineY1(int i)Returns the starting Y coordinate of the given line segment.abstract doublegetLineY2(int i)Returns the ending Y coordinate of the given line segment.java.awt.BasicStrokegetStroke()Returns the stroke for drawing line segments for this plot series.booleanisSmooth()Determine whether to plot a smooth curve or straight line segments.voidreadExternal(java.io.ObjectInput in)Read this plot series from the given object input stream.voidwriteExternal(java.io.ObjectOutput out)Write this plot series to the given object output stream.
-
-
-
Constructor Detail
-
PlotSeries
public PlotSeries()
Construct a new plot series. This constructor is intended for use only by object deserialization.
-
PlotSeries
public PlotSeries(XYSeries theDataSeries, Dots theDots, java.awt.BasicStroke theStroke, java.awt.Color theColor, boolean isSmooth)
Construct a new plot series. Dots are plotted on the data points using the given drawable object. Line segments are drawn 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 line segments. If null, line segments are not drawn.theColor- Color for drawing line segments. If null, line segments are not drawn.isSmooth- True to plot a smooth curve, false to plot straight line segments.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDataSeries is null.
-
-
Method Detail
-
getDataSeries
public XYSeries getDataSeries()
Returns the data series for this plot series.
-
getDots
public Dots getDots()
Returns the drawable object for plotting data points for this XY plot series. If dots are not to be plotted, null is returned.
-
getStroke
public java.awt.BasicStroke getStroke()
Returns the stroke for drawing line segments for this plot series. If line segments are not to be drawn, null is returned.
-
getColor
public java.awt.Color getColor()
Returns the color for drawing line segments for this plot series. If line segments are not to be drawn, null is returned.
-
isSmooth
public boolean isSmooth()
Determine whether to plot a smooth curve or straight line segments.- Returns:
- True to plot a smooth curve, false to plot straight line segments.
-
getDotCount
public abstract int getDotCount()
Returns the number of dots to be plotted.This method must be overridden in a subclass.
-
getDotX
public abstract double getDotX(int i)
Returns the X coordinate of the given dot.This method must be overridden in a subclass.
- 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 abstract double getDotY(int i)
Returns the Y coordinate of the given dot.This method must be overridden in a subclass.
- 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 abstract int getLineCount()
Returns the number of line segments to be plotted.This method must be overridden in a subclass.
-
getLineX1
public abstract double getLineX1(int i)
Returns the starting X coordinate of the given line segment.This method must be overridden in a subclass.
- 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 abstract double getLineY1(int i)
Returns the starting Y coordinate of the given line segment.This method must be overridden in a subclass.
- 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 abstract double getLineX2(int i)
Returns the ending X coordinate of the given line segment.This method must be overridden in a subclass.
- 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 abstract double getLineY2(int i)
Returns the ending Y coordinate of the given line segment.This method must be overridden in a subclass.
- 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.
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionWrite this plot series to the given object output stream.- Specified by:
writeExternalin interfacejava.io.Externalizable- Parameters:
out- Object output stream.- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this plot series from the given object input stream.- Specified by:
readExternalin interfacejava.io.Externalizable- Parameters:
in- Object input stream.- Throws:
java.io.IOException- Thrown if an I/O error occurred.java.lang.ClassNotFoundException- Thrown if a class needed to deserialize this plot series was not found.
-
-
DMelt 3.0 © DataMelt by jWork.ORG