Hi All,
Can anybody help me to in finding a sample code to merge two charts with same datataset. For example, I have a bar chart and a TimeSeries. I want to show it overlayed. Please help me.
Thanks
Deekshit M
Merge/Overlay two charts
Re: Merge/Overlay two charts
If the solution in CombinedDomainCategoryPlot demo does not satisfy you (having a bar chart below, and time series above) then one way is to use JLayeredPane.
You would then add the two JFreeCharts to the panel, one below and other with a transparent background above... something like:
And make sure that the background of the time series is transparent with:
Cheers,
Nenad Bartonicek
EMBL-EBI
You would then add the two JFreeCharts to the panel, one below and other with a transparent background above... something like:
Code: Select all
lLayeredPane.add(barPlotChart, new Integer(0));
lLayeredPane.add(timeSeriesChart, new Integer(1));
Code: Select all
timeSeriesChart.setOpaque(false);
timeSeriesChart.setBackground(new Color(0, 0, 0, 0));
Nenad Bartonicek
EMBL-EBI
-
- Posts: 47
- Joined: Thu Dec 11, 2008 7:59 pm
Re: Merge/Overlay two charts
JFreeChart also supports multiple charts in the same ChartPanel, which is like overlaying. The added benefit is that zooming will zoom in on both charts at the same time. http://www.jfree.org/phpBB2/viewtopic.p ... 883#p77685