Set the size of a chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
n.vasili
Posts: 3
Joined: Mon Jan 08, 2007 9:49 am
Location: Athens, Greece

Set the size of a chart

Post by n.vasili » Tue Jan 09, 2007 10:01 am

Hi.

I can't find the method by which one can set the size of a chart.

I add my chart at a chart panel. Then the chart panel is added at a scroll pane which settles in a frame (jInternalFrame actually). The scroll pane creates vertical scroll bar because the chart is quite bigger than itself. I need to make the chart fit exactly in the scroll pane.

Can anyone help?
Thanks a lot.
Live long and prosper.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Jan 09, 2007 5:42 pm

If you want the ChartPanel to be exactly the same size as the JScrollPane, then the JScrollPane is redundant...just put the ChartPanel in the same place (that is, replacing) the JScrollPane.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

n.vasili
Posts: 3
Joined: Mon Jan 08, 2007 9:49 am
Location: Athens, Greece

Post by n.vasili » Wed Jan 10, 2007 9:23 am

Thanx a lot.
Be well.
Live long and prosper.

hugues
Posts: 18
Joined: Tue Jul 04, 2006 8:59 am
Contact:

Post by hugues » Wed Jan 10, 2007 10:46 am

I had to redefine the height of my chart (that I use in a scrollpanel as well), so I use the following command :
protected final static int myHeight2G = 325;
myChartPanel.setPreferredSize(new Dimension(ChartPanel.DEFAULT_WIDTH, myHeight2G));
I also modify default min max size to allow bigger chart (smaller is less necessary) :
protected final static int myMinSize = 100;
protected final static int myMaxSize = 2048;
myChartPanel.setMinimumDrawWidth(myMinSize);
myChartPanel.setMaximumDrawWidth(myMaxSize);
myChartPanel.setMinimumDrawHeight(myMinSize);
myChartPanel.setMaximumDrawHeight(myMaxSize);
SAMTECH, Integrating CAE towards Professional Solutions : www.samcef.com

Locked