Monday, September 15, 2008

Creating bar chart with trend line

I tried to creat a bar chart and line chart seperately, and then tried to incorporate them in the same panel. But, i couldn't do that as JFreeChart doesn't allow two charts to be in the same panel i.e. ChartPanel. But if you use Component instead of JFreeChart and JPanel instead of ChartPanel you can incorporate both.
But when you use Component instead of JFreeChart you cannot use the ChartFactory class which calls the creatBarchart and createLinechart methods.
As such i couldn't mix the two charts into one using JFreeChart.
But i was able to show to types of charts in one frame and 2 seperate panels.

2 comments:

The Unconventional said...

Hi.

Can you send me a source code as to how to do it?
I am interested in doing the same.

Thanks
Rahul (rahul1988@gmail.com)

Gonzalo Oviedo L. said...

Hi, did you try to incorporate a trend line?, i have the same problem as you, but i think that the solutions is in the trend line.

Help!.