Newbie question: scaling the range

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Arrowx7
Posts: 1
Joined: Fri Jun 20, 2008 6:34 pm

Newbie question: scaling the range

Post by Arrowx7 » Fri Jun 20, 2008 6:36 pm

Hello,
I'm trying to set the range to 10-60 on my graph. However, if the values go over 60 or under 10, I'd like the range to resize to accommodate that. I've been playing with different options, but couldn't get it to work. Any ideas on how to do that?

Thanks a lot!
AR

joolz
Posts: 56
Joined: Thu Nov 17, 2005 2:38 am
Location: Australia

Post by joolz » Mon Jun 23, 2008 5:41 am

You'll need to iterate through your data, get your minimum and maximum values, see if they go outside your 10-60 range.
If min-value > 10, call rangeAxis.setLowerBound(10)
If max-value < 60, call rangeAxis.setUpperBound(60)
I don't know what sort of data you are plotting, but it may also be wise to make sure that if min-value < 10 that you also check to see if max-value < 10 (and vice versa)

vaji
Posts: 5
Joined: Wed Jun 04, 2008 8:50 am

Gap between the range axis(Y axis) and first data point

Post by vaji » Fri Jun 27, 2008 12:28 pm

Hi joolz,

I am also getting the same type of problem
I am using area chart with category data set
I getting a space between the range axis and the first data set.
Can i get help from you, to avoid the space between the axis and the data point

Thanks and Regards
Vaji

joolz
Posts: 56
Joined: Thu Nov 17, 2005 2:38 am
Location: Australia

Post by joolz » Mon Jun 30, 2008 12:45 am

vaji, I don't see how your problem is the same as arrowx7's, but I think domainAxis.setLowerMargin(0) will do what you want

Wetzerk
Posts: 14
Joined: Thu Feb 07, 2008 3:54 pm

Post by Wetzerk » Tue Jul 01, 2008 5:22 pm

The best way to ensure the bounds of the plot cover the range of data without inventing additional code is to avoid using setLowerBound / setUpperBound.

Look in the API for setAutoRangeIncludesZero( boolean )

joolz
Posts: 56
Joined: Thu Nov 17, 2005 2:38 am
Location: Australia

Post by joolz » Tue Jul 01, 2008 11:49 pm

Thats true, and I generally do that with my charts, but Arrowx7 seemed to be quite specific in what was to be achieved and how the chart was to look, and I don't think setAutoRangeIncludesZero meets that criteria

Locked