How to change the _width_ of a plot?

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

How to change the _width_ of a plot?

Post by Irv Thomae » Wed Sep 11, 2002 8:26 pm

I've placed my TimeSeries plot inside a ChartPanel, which in turn occupies only about half of my screen width. Now, the ChartPanel class has methods setMinimumDrawWidth() and setMaximumDrawWidth(), but they seemed to have no observable effect.
How can I "encourage" FreeChart to use up more of the width available to it?

josh

Re: How to change the _width_ of a plot?

Post by josh » Wed Sep 11, 2002 9:16 pm

ChartPanel.setPrefferedSize()

josh

Re: How to change the _width_ of a plot?

Post by josh » Thu Sep 12, 2002 2:15 am

ps

that method is not static, i just wanted to show shich class it was in.

David Gilbert

Re: How to change the _width_ of a plot?

Post by David Gilbert » Thu Sep 12, 2002 8:50 am

It is entirely up to the layout manager to determine the size of your ChartPanel...once the size is determined, JFreeChart will draw a chart to fit the available space.

The setMinimumDrawWidth(...) and setMaximumDrawWidth(...) methods don't control the size of the visible chart, they control the 'pre-transform' size of the chart. What happens is if the available space is smaller (or larger) than these settings, JFreeChart will draw the chart at the min (or max) size, then scale down (up) to fit the available space.

To see this in practice, run the demo and resize one of the chart frames to a very small size. What you see is a scaled down version of a chart that has been drawn at a logical size of 200 x 300 (or something around that size).

A similar effect happens if you resize the frame to something really large.

Regards,

DG.

Locked