Using Multiple Renderers in JFreechart
<p>I have data that I'd like to represent as a box and whiskers graph, and have set up a category plot to do so. However, in addition, I'd like to add a line chart that shows an accumulation of the averages for each data point.</p>

<p>Right now my code is something like this </p>

<pre><code>DefaultBoxAndWhiskerCategoryDataset dataSet = new DefaultBoxAndWhiskerCategoryDataset();
int i = 0;
for (List&lt;Integer&gt; categoryList : categoryLists) {
    dataSet.add(categoryList, i, "BoxAndWhiskers");
    i++;
}
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();

double sum = 0;
i = 0;
DefaultCategoryDataset averageDataSet = new DefaultCategoryDataset();
for (double average : averages) {
    sum += average;
    averageDataSet.add(sum, i, "Average");
    i++;
}
LineAndShapeRenderer lineAndShapeRenderer = new LineAndShapeRenderer();


CategoryAxis xAxis = new CategoryAxis("Type");
NumberAxis yAxis = new NumberAxis("Value");
CategoryPlot plot = new CategoryPlot(dataSet, xAxis, yAxis, renderer);

plot.setDataset(1, averageDataSet);
plot.setRenderer(1, lineAndShapeRenderer);

JFreeChart chart = new JFreeChart(
    "Box-and-Whisker",
    new Font("SansSerif", Font.BOLD, 14),
    plot,
    true
);

BufferedImage outputImage = chart.createBufferedImage(800, 600);

ImageIO.write(outputImage, "png", new File("output.png"));
</code></pre>

<p>However, when I look at my output.png, I only see the box and whiskers render (no lineandshape graph).</p>

<p>Is there something else I need to do to use both renderers and datasets in my output image? Additionally, is there a better approach to getting a cumuluative line for the averages in my box and whiskers graph? </p>