public class ScatterPlot extends Object
Modifier and Type | Field and Description |
---|---|
private XYSeriesCollection |
allSeries |
private JFreeChart |
chart |
private XYPlot |
plot |
Constructor and Description |
---|
ScatterPlot(String nameX,
String nameY)
Create a new ScatterPlot.
|
Modifier and Type | Method and Description |
---|---|
void |
addData(SqlResultIterator data,
Collection<PlotAnnotation> annotations)
Add data to the plot.
|
void |
addData(SqlResultIterator data,
String... names)
Add data to the plot.
|
JFreeChart |
getChart()
Get the underlying JFreeChar object.
|
private XYPlot plot
private XYSeriesCollection allSeries
private JFreeChart chart
public void addData(SqlResultIterator data, String... names) throws 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)
SQLException
public void addData(SqlResultIterator data, Collection<PlotAnnotation> annotations) throws 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 annotationSQLException
public JFreeChart getChart()