|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.plot.HistogramPlot
public class HistogramPlot
A simple plot utility for generating histogram 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.
Nested Class Summary | |
---|---|
private static class |
HistogramPlot.HistogramBin
Represents a single bin in a histogram. |
private static class |
HistogramPlot.HistogramDataset
An dataset implementation for histogram data that allows us to send data to JFreeChart the way we want. |
private static class |
HistogramPlot.HistogramSeries
Collects information about one histogram series. |
private static class |
HistogramPlot.TempSeries
Helper class for storing histogram data that needs to split into different annotations. |
static class |
HistogramPlot.YAggregate
Defines what to to plot on the y axis in a histogram plot. |
Field Summary | |
---|---|
private JFreeChart |
chart
|
private Range |
domainRange
|
private HistogramPlot.HistogramDataset |
hilo
|
private HistogramPlot.HistogramDataset |
histogram
|
private XYPlot |
plot
|
private Range |
rangeRange
|
Constructor Summary | |
---|---|
HistogramPlot(String nameX,
String nameY,
XYItemRenderer renderer)
Create a new HistogramPlot. |
Method Summary | |
---|---|
void |
addData(SqlResultIterator data,
Collection<PlotAnnotation> annotations,
float binSize,
HistogramPlot.YAggregate yAggregate,
HistogramPlot.YAggregate hiloAggregate)
Add data to the plot. |
void |
addData(SqlResultIterator data,
String name,
float binSize,
HistogramPlot.YAggregate yAggregate,
HistogramPlot.YAggregate hiloAggregate)
Add data to the plot. |
private void |
adjustRanges()
Auto-size of the x and y range doesn't seem to work, so we have to do it manually. |
JFreeChart |
getChart()
Get the underlying JFreeChar object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Range domainRange
private Range rangeRange
private XYPlot plot
private HistogramPlot.HistogramDataset histogram
private HistogramPlot.HistogramDataset hilo
private JFreeChart chart
Constructor Detail |
---|
public HistogramPlot(String nameX, String nameY, XYItemRenderer renderer)
nameX
- The label on the X-axisnameY
- The label on the Y-axisrenderer
- The renderer to use or null for the default (XYBarRenderer)Method Detail |
---|
public void addData(SqlResultIterator data, String name, float binSize, HistogramPlot.YAggregate yAggregate, HistogramPlot.YAggregate hiloAggregate) throws SQLException
SqlResultIterator
should return
the x value as a float in the first position, ie. data.getFloat(1)
and, if used, the y value in the second position.
The y value is not used if the yAggregate parameter is HistogramPlot.YAggregate.COUNT
.
data
- The data to plotname
- The name of the data seriesbinSize
- The size (= range on x-axis) of each histogram binyAggregate
- What to plot on the y-axishiloAggregate
- Optional parameter specifying if high/low values shold be drawn for each bin
SQLException
private void adjustRanges()
public void addData(SqlResultIterator data, Collection<PlotAnnotation> annotations, float binSize, HistogramPlot.YAggregate yAggregate, HistogramPlot.YAggregate hiloAggregate) throws SQLException
SqlResultIterator
should return
the annotation value in the first position, ie. data.getInt(1)
,
the x value as a float in the second position, and, if used, the y value in the
third position.
The y value is not used if the yAggregate parameter is HistogramPlot.YAggregate.COUNT
.
data
- The data to plotannotations
- Annotation information that maps each data spot to
an annotation (see ScatterPlot.addData(SqlResultIterator, Collection)
binSize
- The size (= range on x-axis) of each histogram binyAggregate
- What to plot on the y-axishiloAggregate
- Optional parameter specifying if high/low values shold be drawn for each bin
SQLException
public JFreeChart getChart()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |