[Resolved] Size of a plot in a combinedPlot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
zinZ
Posts: 19
Joined: Mon Jul 09, 2007 2:18 pm

[Resolved] Size of a plot in a combinedPlot

Post by zinZ » Wed Jul 18, 2007 3:02 pm

Hello,

Actually, my ChartPanel is in a ScrollPane and I want to activate the vertical Scroll.
So I'd like to impose the size, especially the height, of the plots of my DomainCombinedXYPlot, which is in the ChartPanel. I want all the same size.

I tried setPreferredSize on the ChartPanel but it doesn't work well, maybe because the RangeAxis aren't recalculate, ut I am not sure.

Thanks for any help.
Last edited by zinZ on Mon Jul 23, 2007 3:30 pm, edited 1 time in total.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Wed Jul 18, 2007 4:24 pm

Call this method on each of the subplots with the same value to make them all the same size:

Code: Select all

xyPlot.setWeight(int weight)
or call this method when you add the subplots:

Code: Select all

combo.add(XYPlot subplot, int weight)

zinZ
Posts: 19
Joined: Mon Jul 09, 2007 2:18 pm

Post by zinZ » Mon Jul 23, 2007 8:28 am

Thank you for your reply.
By default they all have the same weight, so I don't need to change that.

In fact I need to set their height to 300. Because I have 8 plot, then the scroll should be activated.

Is their a way to do that?

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 » Mon Jul 23, 2007 10:41 am

The subplot height is determined dynamically, depending on the available space for the chart (which is determined externally, either by a Swing layout manager setting the size of the ChartPanel that contains the chart, or your code setting the size of a BufferedImage into which the chart is drawn, or...). JFreeChart always tries to draw the best chart it can at the size *given* to it from some other code.
David Gilbert
JFreeChart Project Leader

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

zinZ
Posts: 19
Joined: Mon Jul 09, 2007 2:18 pm

Post by zinZ » Mon Jul 23, 2007 3:28 pm

Thank you for your reply David.
However it looks a little too complicated for me.

I have found the method CharPanel.setMaximumDrawHeight(int height) which resolved my problem in addition to setPreferredSize

Locked