Package net.sf.basedb.util.plot
Class ScatterPlot
java.lang.Object
net.sf.basedb.util.plot.ScatterPlot
A simple plot utility for generating scatter plots without
the need to delve deep into the JFreePlot package. Note! This class
is experimental and it is likely that the implementation will change
in the future.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2015-05-12 11:27:08 +0200 (ti, 12 maj 2015) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addData
(SqlResultIterator data, String... names) Add data to the plot.void
addData
(SqlResultIterator data, Collection<PlotAnnotation> annotations) Add data to the plot.getChart()
Get the underlying JFreeChar object.
-
Field Details
-
plot
-
allSeries
-
chart
-
-
Constructor Details
-
ScatterPlot
Create a new ScatterPlot.- Parameters:
nameX
- The label on the X-axisnameY
- The label on the Y-axis
-
-
Method Details
-
addData
Add data to the plot. TheSqlResultIterator
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.- Parameters:
data
- The data to plotnames
- An array of series names, x-value for series 'i' is found indata.getFloat(2+i)
- Throws:
SQLException
-
addData
public void addData(SqlResultIterator data, Collection<PlotAnnotation> annotations) throws SQLException Add data to the plot. The SqlResultIterator must return at least 3 columns. The first column in the result is used to determine which annotation/series the spot belongs to. The second column is the x value and the third column is the y value. Additional columns are not used.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.- Parameters:
data
- The data to plotannotations
- Annotation information that maps each data spot to an annotation- Throws:
SQLException
-
getChart
Get the underlying JFreeChar object. Use this method to polish up everything and save the image.
-