Dear all,
Is there any API that can set the plot's height or width of a chart?
or the length of the x/y-axis of a chart?
Cheers,
alsw-2000
How to explicitly set the plot area inside a chart
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
No. JFreeChart allocates space for the chart title(s), legend, and the plot's axes...whatever is left after that gets used for the data.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


David,
I would like to see this discussed farther. I set up the ratio (dataAreaRatio) appoach in the ContourPlot in order to create plots with the correct aspect ratio (i.e. so that map contours would look correct when doing lat/lon type plotting). This approach could easily be applied to the XYPlot type. Another benefit to defining the plot's aspect ratio is that plots sent to the printer will have the same aspect ratio as shown on the screen. I not sure how this translates to other plot types (i.e. combop plots).
TakeCare,
DaveOD
I would like to see this discussed farther. I set up the ratio (dataAreaRatio) appoach in the ContourPlot in order to create plots with the correct aspect ratio (i.e. so that map contours would look correct when doing lat/lon type plotting). This approach could easily be applied to the XYPlot type. Another benefit to defining the plot's aspect ratio is that plots sent to the printer will have the same aspect ratio as shown on the screen. I not sure how this translates to other plot types (i.e. combop plots).
TakeCare,
DaveOD
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Am I right in saying that your aspect ratio code will reduce the data area (either in width or height) to preserve the unit relationship between the two axes? That's safe, because now the axes, etc. have more space than they actually require, so you'll just see some whitespace at the left and right or top and bottom of your chart. What I need to avoid is the situation where the data area is made any larger than the space that is available after the titles, legend and axes have been drawn.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

