Caculate bounds occupied to render legends in a plot.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
vijay
Posts: 13
Joined: Thu Nov 17, 2005 3:20 pm
Location: India

Caculate bounds occupied to render legends in a plot.

Post by vijay » Wed Nov 30, 2005 12:51 pm

Hi

I am generating few charts and converting them to images. These charts are different representation for the same data. The different images generated has to have the same height, this means that the height of data area for different graphs has to be the same The need is to display all graphs side by side. Hence height has to be the same for the data area, and i have to align the domain axis of all the images. I am using setFixedDimension on the axis. I am able to almost get to the height i require. When there are legends the height of the range axis gets altered. So it possible to calculate the height / bounds that will be occupied to render the legend items? Is there any direct api? or a neat way to do it.

Thanks,
Vijay Venkataram

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 » Wed Nov 30, 2005 1:13 pm

The legend size isn't stored anywhere, but if you look through the drawTitle() method in the JFreeChart class you'll see how it is calculated by calling the arrange() method. You could call arrange() yourself to find out how big the legend is...
David Gilbert
JFreeChart Project Leader

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

Locked