|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.generation5.util.Plot
org.generation5.util.Plot2D
Plot2D is a simple utility class designed to plot data. The class
provides the necessary render functions to plot points, line or histogram data.
| Field Summary | |
protected java.awt.Color[] |
datasetColors
The colours to use for the different data-sets. |
static int |
HISTOGRAM
Draw the data-series as a histogram |
static int |
LINES
Draw the data-series as lines. |
static int |
NONE
Don't draw the data series. |
protected java.util.LinkedList[] |
plotData
The data to plot. |
static int |
POINTS
Draw the data-series as points. |
| Fields inherited from class org.generation5.util.Plot |
drawAxes, maxX, maxY, minX, minY, plotTypes |
| Constructor Summary | |
Plot2D()
Creates a new instance of Plot2D |
|
Plot2D(int dataSets)
Create a new instance of Plot2D, with a given number of data sets. |
|
| Method Summary | |
void |
render(java.awt.Graphics g,
int width,
int height)
Render the plot on a graphics context. |
protected void |
renderHistogram(java.awt.Graphics g,
int dataSeries,
int width,
int height)
Render the data as a histogram. |
protected void |
renderLines(java.awt.Graphics g,
int dataSeries,
int width,
int height)
Render the data as lines. |
protected void |
renderPoint(java.awt.Graphics g,
double x,
double y,
int width,
int height)
Render a point. |
protected void |
renderPoints(java.awt.Graphics g,
int dataSeries,
int width,
int height)
Render the data series as points. |
void |
setData(int dataSeries,
double[] pd)
Set the data for a given series. |
void |
setData(int dataSeries,
double[][] pd)
Set the data for a given series. |
void |
setData(int dataSeries,
java.util.LinkedList pd)
Set the data for a given series. |
void |
setData(int dataSeries,
long[] pd)
Set the data from an array of longs. |
void |
setDataSets(int dataSets)
Set the number of the datasets. |
void |
setPlotColor(int dataSeries,
java.awt.Color plotColor)
Set the plot colour for a given data series. |
void |
setPlotType(int dataSeries,
int plotType)
Sets the plot type for a given data series. |
| Methods inherited from class org.generation5.util.Plot |
calculateRanges, drawAxes, getMaximumX, getMaximumY, getMinimumX, getMinimumY, getRangeX, getRangeY, setDrawAxes, setMaximumX, setMaximumY, setMinimumX, setRange, translateCoordinate, translateCoordinate, writeImage |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.awt.Color[] datasetColors
protected java.util.LinkedList[] plotData
public static final int POINTS
public static final int LINES
public static final int HISTOGRAM
public static final int NONE
| Constructor Detail |
public Plot2D()
public Plot2D(int dataSets)
dataSets - the number of data sets in this plot.| Method Detail |
public void setDataSets(int dataSets)
dataSets - the number of data sets present.
public void setPlotType(int dataSeries,
int plotType)
dataSeries - the series number.plotType - the plot type to use (see POINTS, LINES, FILLED).
public void setPlotColor(int dataSeries,
java.awt.Color plotColor)
dataSeries - the data series.plotColor - the new plot colour.
public void setData(int dataSeries,
double[] pd)
plotData[dataSeries] = new LinkedList();
for (int i=0; i
- Parameters:
dataSeries - the data series.pd - a one-dimensional double array specifying the y-coordinates of the data.
public void setData(int dataSeries,
long[] pd)
longs.
dataSeries - the data series to set.pd - a one-dimensional long array specifying the y-coordinates of the data.
public void setData(int dataSeries,
double[][] pd)
plotData[dataSeries] = new LinkedList();
for (int i=0; i
- Parameters:
dataSeries - the data series.pd - a two-dimensional array specifying the x and y coordinates of the data.
public void setData(int dataSeries,
java.util.LinkedList pd)
PlotPoint.
dataSeries - the data series.pd - the linked list of plot data.
public void render(java.awt.Graphics g,
int width,
int height)
render in interface Visualizablerender in class Plotg - the graphics context.width - the width of the context.height - the height of the context.
protected void renderLines(java.awt.Graphics g,
int dataSeries,
int width,
int height)
g - the graphics context.dataSeries - the data series to render.width - the width of the context.height - the height of the context.
protected void renderHistogram(java.awt.Graphics g,
int dataSeries,
int width,
int height)
g - the graphics context.dataSeries - the data series to plot.width - the width of the context.height - the height of the context.
protected void renderPoints(java.awt.Graphics g,
int dataSeries,
int width,
int height)
g - the graphics context.dataSeries - the data series to render.width - the width of the context.height - the height of the context.
protected void renderPoint(java.awt.Graphics g,
double x,
double y,
int width,
int height)
g - the graphics context.x - the x-coordinate.y - the y-coordinate.width - the width of the context.height - the height of the context.
|
This documentation is part of the Generation5 JDK.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||