I am attempting to draw dashed lines along the top and bottom of a deviation renderer output. Right now the best idea I have to do that is to get the YIntervalSeries that backs the deviation renderer and make new XYSeries, one for the min, and one for the max, and then draw these series with a new renderer (StandardXYRenderer, for instance). This seems wasteful to me, as then the high/low data is duplicated.
For instance, here is the code I'm using to extract the mins and then draw the mins as a new series:
Code: Select all
private static XYDataset getMinFromInterval(YIntervalSeriesCollection dataset) {
XYSeriesCollection lowDataset = new XYSeriesCollection();
for (int i = 0; i < dataset.getSeriesCount(); i++) {
YIntervalSeries series = dataset.getSeries(i);
XYSeries lowVals = new XYSeries(series.getKey());
for (int j = 0; j < series.getItemCount(); j++) {
lowVals.add(series.getX(j), series.getYLowValue(j));
}
lowDataset.addSeries(lowVals);
}
return lowDataset;
}
Code: Select all
plot.setDataset(1, getMinFromInterval((YIntervalSeriesCollection) dataset));
plot.setRenderer(1, new StandardXYItemRenderer());
Thanks for any help you can provide,
Nick
(The other thought that occurs to me is that I could extend the DeviationRenderer class, but that might be going a bit far)