Hi,
I am wondering what is the API to set the internal height and width of a chart. I am not sure if my terminology is right, but this is what I mean - The complete chart is the actual chart area plus the xaxis and yaxis title and tickmarks. I want to control the the height and width of just the chart area - the region containing the data points. I think this should be possible for any plot, but I am unable to find such an API. any pointers please ? In my case I am trying to plot a timeseries.
Thanks
Harsha
controlling internal width and height of chart
-
- Posts: 12
- Joined: Fri Jan 06, 2006 1:36 am
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
JFreeChart does its layout from the outside in (that is, titles, legends and axes first) using any remaining space for the data area. It is not possible to set a fixed size for the data area.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 12
- Joined: Fri Jan 06, 2006 1:36 am
controlling internal width and height of chart
In such a case if we have multiple charts, one below the other how do we allign the data areas ?
For example, if we are viewing some data for 6 months in two separate graphs it would be ideal to allign their data area to be able to compare and analyze
For example, if we are viewing some data for 6 months in two separate graphs it would be ideal to allign their data area to be able to compare and analyze
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
It's difficult to do, given the way JFreeChart dynamically lays out the chart areas. There is a hack you can try...the setFixedDimension() method in the Axis class. If you have two charts stacked on top of one another, you can call setFixedDimension() on the range axis for both charts to make their axes have the same width (which very often results in the data areas having the same size). The difficulty is determining a suitable width so that the axis labels are not clipped, but where there isn't a lot of white space either. The CombinedDomainXYPlot class uses this approach...it sets the fixed dimension to the width of the widest axis (with a fair amount of ugly code to determine this).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

