Margins calculated correctly?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Todd J.

Margins calculated correctly?

Post by Todd J. » Mon Mar 25, 2002 7:24 pm

Hiya,

I have an XY graph and the Y data ranges from 18 - 20. After settign the upperMargin and lowerMargin to 0.1 = 10%, I expected the y-axis max value to be 22 (20 + 20*0.1). However, in reality it appears to be 20.2. Could this indicate a bug in the code?

Thanks,
Todd

PS. I'll be glad to fix this if you point me to the relevant code segment...

David Gilbert

Re: Margins calculated correctly?

Post by David Gilbert » Mon Mar 25, 2002 10:45 pm

Hi Todd,

I've interpreted the margins to be a percentage of the range that is showing on the axis, which in your case is 2 (that is, 20 minus 18).

The code is in the autoAdjustRange() method which is implemented in HorizontalNumberAxis and VerticalNumberAxis() if you want to try out alternatives...

Regards,

DG.

Locked