how to use setuppermargin()

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

how to use setuppermargin()

Post by alan4077alda » Wed Dec 04, 2002 11:57 pm

Hi there,

In a time series chart that I am creating, I need the right margin in the time axis (X axis) to be set to 10 percent of the total width of the axis. Here is the code that I am using to achieve this,

axis = ( HorizontalDateAxis ) plot.getDomainAxis ();
// The following part is not really relevant for the problem in this post
timeClass = timePeriodClass.getClass();
if ( timeClass == Second.class ) {
axis.setFixedAutoRange ( 60 * 60 * 1000 );
}
if ( timeClass == Minute.class ) {
axis.setFixedAutoRange ( 24 * 60 * 60 * 1000 );
}
if ( timeClass == Hour.class ) {
axis.setFixedAutoRange ( 3600 * 1000* 24 * 7 );
}
// End irrelevant part
axis.setUpperMargin(0.1);

However, this does not really work. The new values in my dynamic chart still appear at the right border of the main chart, which makes it difficult for the user to see these latest values. How can I solve this problem?

Thanks,
Alan

David Gilbert

Re: how to use setuppermargin()

Post by David Gilbert » Thu Dec 05, 2002 12:14 am

Hi Alan,

Looking in the code I notice that the upper and lower margins are ignored for the fixed auto range. I'd call that a bug, at least the upper margin should be respected. The problem occurs in the autoAdjustRange() method in the HorizontalDateAxis class, and the fix shouldn't be too difficult, but I'll have to look at it later.

Regards,

DG

Locked