Hi!
Is there a way to eliminate some of the empty space seen in the ChartPanel on the left and right of the MeterPlot?
Thanks!
MeterPlot and empty space
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
I don't think so. Do you want the dial stretched to fill the space? That isn't supported as far as I know, but it could probably be done as an option...
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Not so much stretched as proportional to the ChartPanel size. If the size of the ChartPanel that contains the Meter is a square, maybe the Meter could fill up the space.
I noticed that when the ChartPanel size is smaller (about 200x200 ) the Meter is more of an ellipse (more height than width) than a circle with quite a bit of empty space on the right and left. However, when the size is about 300x300 the meter is more circular with less empty space.
Let me know if there could be something that I may be doing wrong.
Thank you!
I noticed that when the ChartPanel size is smaller (about 200x200 ) the Meter is more of an ellipse (more height than width) than a circle with quite a bit of empty space on the right and left. However, when the size is about 300x300 the meter is more circular with less empty space.
Let me know if there could be something that I may be doing wrong.
Thank you!
Re: MeterPlot and empty space
Was there ever a resolution to this? I'm having the same issue (using JFreeChart 1.0.1).
Thanks,
Keith
Thanks,
Keith
Re: MeterPlot and empty space
OK, I finally figured this one out.
SYMPTOM: MeterPlots smaller than 300x200 are no longer drawn as circles
CAUSE: ChartPanel is applying an affine transform to the graphics device that scales x & y differently. This is being done to satisfy the minimumDrawWidth and minimumDrawHeight constraints.
WORKAROUND: Use ChartPanel.setMinimumDrawWidth and ChartPanel.setMinimumDrawHeight to set both of these properties to be proportional to the width & height of your ChartPanel. For example, if your ChartPanel is square, then set both minimums to the same value (for example, 250).
LONGER TERM SOLUTION: It is worth considering whether ChartPanel should really scale the x & y directions differently. This is could be the cause of other oddities, such as stretched text. If ChartPanel were to change, the appropriate method to change would be ChartPanel.paintComponent(Graphics g).
SYMPTOM: MeterPlots smaller than 300x200 are no longer drawn as circles
CAUSE: ChartPanel is applying an affine transform to the graphics device that scales x & y differently. This is being done to satisfy the minimumDrawWidth and minimumDrawHeight constraints.
WORKAROUND: Use ChartPanel.setMinimumDrawWidth and ChartPanel.setMinimumDrawHeight to set both of these properties to be proportional to the width & height of your ChartPanel. For example, if your ChartPanel is square, then set both minimums to the same value (for example, 250).
LONGER TERM SOLUTION: It is worth considering whether ChartPanel should really scale the x & y directions differently. This is could be the cause of other oddities, such as stretched text. If ChartPanel were to change, the appropriate method to change would be ChartPanel.paintComponent(Graphics g).