/**
* @author Jacob von Eyben - Nordija A/S
*/
public class JFreeChartResourceSource implements StreamResourceSource {
public StreamResource getStreamResource(IRequestCycle cycle, Object[] parameters) throws IOException {
DefaultKeyedValuesDataset dataset = new DefaultKeyedValuesDataset();
dataset.setValue("one", 50);
dataset.setValue("two", 20);
dataset.setValue("three", 30);
JFreeChart chart = ChartFactory.createPieChart("My Piechart", dataset, false, false, false);
return new SimpleJFreeChartResource(chart, 100, 200, ImageFormat.JPEG);
}