jfreechartpanel

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
anoop

jfreechartpanel

Post by anoop » Mon Apr 08, 2002 5:11 am

Hi everyone,
1) In the demo program, in the JFreeChartFrame, the graph get's reduced to the frame size automatically. I have added a JFreeChartPanel to some other frame, but when the frame is resized, the chart doesn't get resized. how do i do it??
2) How can i print 2-4 graphs on one single page??

thanks
anup

Todd J.

Re: jfreechartpanel

Post by Todd J. » Mon Apr 08, 2002 6:34 am

Well, it all depends on the LayoutManager your frame is using. I bet you used the default FlowLayout which doesn't always resize the component. Try this for a frame with one chart panel:

JPanel p = new JPanel(new BorderLayout());
p.add(chartPanel, BorderLayout.CENTER);

JFrame f = new JFrame();
f.setContentPane(p);
f.pack();
f.show;

If you want to show several charts on one page, then you have several choices for a LayoutManager: BoxLayout, GridLayout, and GridbagLayout to name a few. Or you could use a JTabbedPane. The BoxLayout is probably a good choice if you simply want to place the charts side by side.

-Todd

Locked