*
* @return A sample dataset.
*/
private static IntervalXYDataset createDataset(List data) throws BadDataForChartException {
XYSeries series = new XYSeries("Data");
for (Object obj : data) {
Map result = (Map)obj;
if (result.values().size() < 2)
throw new BadDataForChartException("For chart, must have at least two columns of data");
Iterator iterator = result.entrySet().iterator();
Object column1Value = ((Map.Entry)iterator.next()).getValue();
Object column2Value = ((Map.Entry)iterator.next()).getValue();
if (!(column1Value instanceof Number) || !(column2Value instanceof Number))
throw new BadDataForChartException("Data must be decimal or integer. Can't plot otherwise.");
series.add((Number)column1Value,
(Number)column2Value);
}
return new XYSeriesCollection(series);
}