i'm new with jfreechart and i'm confused in combining different plots... the documentation and the demo code coudn't explain me that enough.
i wanna plot a chart with three areas and two lines... is the following way wrong?
1. i creat two XYSeriesCollection. One for the areas and one for the lines...
2. i creat the first XYSeries and add them to the area collection
3. i creat the second XYSeries and add them to the area collection too
4. i creat two XYSeries for the lines and add them to the line collection...
now i have two datasets (daAreas, daLines) which are XYSeriesCollections.
now i tried following:
- Code: Select all
XYItemRenderer areaRenderer = new XYAreaRenderer();
XYPlot plot = new XYPlot(
daAreas,
new NumberAxis(),
null,
areaRenderer
);
StandardXYItemRenderer lineRenderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES);
plot.setDataset(1, daLines);
plot.setRenderer(1, lineRenderer); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
JFreeChart chart = new JFreeChart(
"title",
JFreeChart.DEFAULT_TITLE_FONT,
plot,
true // legend
);
Thx for help!
spross
