For differnent sizes of the charts panel axis label and legend text always scales to different sizes.
At very large/wide screens this looks a little bit strange.
Is it possible to aviod these scaling? Is it possible to set a fixed size of a fixed area for the axis label?
The following two screenshots show the same chart at different window/frame sizes:
How to aviod axis label and legend scaling
-
- Posts: 7
- Joined: Thu Jul 17, 2008 2:52 pm
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: How to aviod axis label and legend scaling
Create a ChartPanel with your chart, and add it to a JPanel having a layout that respects the panel's preferred size, e.g. FlowLayout, the default layout for JPanel. You can adjust the preferred size as shown here.
-
- Posts: 7
- Joined: Thu Jul 17, 2008 2:52 pm
Re: How to aviod axis label and legend scaling
I don't want the whole panel to have a fixed size. The ChartPanel should scale into available space if the user resizes the frame. That's ok.
But i would like the text next to axis and the text in the legend to keep a fixed size (e.g. 12pt by default)!
But i would like the text next to axis and the text in the legend to keep a fixed size (e.g. 12pt by default)!
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: How to aviod axis label and legend scaling
GridLayout works well for that.
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: How to aviod axis label and legend scaling
Call ChartPanel.setMinimumDrawWidth/Height with small value and ChartPanel.setMaximumDrawWidth/Height with large values than exceed the screen size of your monitor. Then, the ChartPanel will be scaled without being distorted.
-
- Posts: 7
- Joined: Thu Jul 17, 2008 2:52 pm
Re: How to aviod axis label and legend scaling
The following lines solved this issue:
Now the ChartPanel scales without distortion.
Thanks!
Code: Select all
chartpanel.setMinimumDrawHeight(50);
chartpanel.setMaximumDrawHeight(5000);
chartpanel.setMinimumDrawWidth(50);
chartpanel.setMaximumDrawWidth(5000);
Thanks!