public class ScatterPlot
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private XYSeriesCollection |
allSeries |
private JFreeChart |
chart |
private XYPlot |
plot |
Constructor and Description |
---|
ScatterPlot(java.lang.String nameX,
java.lang.String nameY)
Create a new ScatterPlot.
|
Modifier and Type | Method and Description |
---|---|
void |
addData(SqlResultIterator data,
java.util.Collection<PlotAnnotation> annotations)
Add data to the plot.
|
void |
addData(SqlResultIterator data,
java.lang.String... names)
Add data to the plot.
|
JFreeChart |
getChart()
Get the underlying JFreeChar object.
|
private XYPlot plot
private XYSeriesCollection allSeries
private JFreeChart chart
public ScatterPlot(java.lang.String nameX, java.lang.String nameY)
nameX
- The label on the X-axisnameY
- The label on the Y-axispublic void addData(SqlResultIterator data, java.lang.String... names) throws java.sql.SQLException
SqlResultIterator
should return
the x value as a float in the first position, ie. data.getFloat(1)
and y values in the positions 2 and up.data
- The data to plotnames
- An array of series names, x-value for series 'i' is found
in data.getFloat(2+i)
java.sql.SQLException
public void addData(SqlResultIterator data, java.util.Collection<PlotAnnotation> annotations) throws java.sql.SQLException
The annotations collection contains the mappings from the actual value to
the annotation. Ie. if the result contains a 1 in the first column we
check which annotation returns a 1 in it's PlotAnnotation.getValues()
method. One value may not be used by more than one annotation.
data
- The data to plotannotations
- Annotation information that maps each data spot to
an annotationjava.sql.SQLException
public JFreeChart getChart()