Reputation: 23
I am using a jfreechart to show a line graph. I want to use same graph to show another line graph. Can anyone tell me how to do that? Thanks in advance
Upvotes: 0
Views: 4452
Reputation: 2817
JFreeChart chart = ... //Get the chart with your first dataset.
CategoryPlot plot = chart.getCategoryPlot();
plot.setDataset(1, anotherDataset); //The '1' at the first parameter is
//the index of dataset.
//Thus, '1' for the second dataset.
... //some other settings to the plot, with index=1.
plot.setRenderer(1, someRenderer);
Then we can get the graph with this chart.
Upvotes: 1