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.
Set the size of a chart
Set the size of a chart
Live long and prosper.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


I had to redefine the height of my chart (that I use in a scrollpanel as well), so I use the following command :
I also modify default min max size to allow bigger chart (smaller is less necessary) :protected final static int myHeight2G = 325;
myChartPanel.setPreferredSize(new Dimension(ChartPanel.DEFAULT_WIDTH, myHeight2G));
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