Calling autoAdjustRange() in NumberAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mminer
Posts: 11
Joined: Wed Jun 06, 2007 8:11 pm

Calling autoAdjustRange() in NumberAxis

Post by mminer » Thu Jun 28, 2007 8:58 pm

Perhaps I'm missing something obvious, but I'm unable to call the autoAdjustRange() method in NumberAxis due to it having protected access. How might I perform this operation? If I had something like a LogarithmicAxis object I could do it, but not so with a plain old NumberAxis.

Any suggestions are greatly appreciated.

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Thu Jun 28, 2007 9:08 pm

autoAdjustRange has protected access since it is a method used as part of the drawing process and is not intended to be used otherwise. What are you trying to accomplish? Most likely, there is a means to do what you want with the public methods.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

mminer
Posts: 11
Joined: Wed Jun 06, 2007 8:11 pm

Post by mminer » Fri Jun 29, 2007 1:08 pm

I have a line graph which has a y minimum of about 200 and a maximum of about 250. Unfortunately, as the NumberAxis I'm using for the range starts at zero, this leaves a lot of empty space below the line. When I created the NumberAxis I tried calling the setAutoRangeIncludesZero() method which I hoped would solve the problem, but it doesn't appear to have made any difference (my dataset includes many null values, so these are perhaps the culprit here). I thought that calling autoAdjustRange() after I add the dataset to the plot might do the trick, but as you say this method isn't meant to be used directly.

Surely there's a simple way to accomplish what I wish to do. Has anybody else run into a similar problem and found a solution?

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Fri Jun 29, 2007 2:02 pm

Code: Select all

public void setAutoRangeIncludesZero(boolean flag)

mminer
Posts: 11
Joined: Wed Jun 06, 2007 8:11 pm

Post by mminer » Fri Jun 29, 2007 2:28 pm

mminer wrote:When I created the NumberAxis I tried calling the setAutoRangeIncludesZero() method which I hoped would solve the problem, but it doesn't appear to have made any difference
Disregard this, I found the reason why calling the setAutoRangeIncludesZero() method didn't work. Deep in my code I set the plot to use a new NumberAxis which hadn't been set to not include zero. Now it works as it should. Thanks for the help.

Locked