VerticalLogarithmicAxis - unable to show values between 1 an

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

VerticalLogarithmicAxis - unable to show values between 1 an

Post by yaron » Tue Dec 03, 2002 1:24 pm

Hi All,
I am trying to use VerticalLogarithmicAxis to show values between 0-1.

I can't set the axis range to display correctly.
I see only the top range 10^0, and don't see any log grid.
the data doesn't apear, probebly becuase the axis range is not correct.

i use the follwing code:

BasicTimeSeries MySeries = new BasicTimeSeries("Myseries", "Second", "Value", Second.class);

TimeSeriesCollection data = new TimeSeriesCollection();
data.addSeries(MySeries );
JFreeChart chart = ChartFactory.createTimeSeriesChart(title, domain, range, data, true);
XYPlot plot = chart.getXYPlot();

VerticalLogarithmicAxis vla = new VerticalLogarithmicAxis(range);
vla.setAutoRange(false);
vla.setMaximumAxisValue(1.0);
vla.setMinimumAxisValue(0.0);
vla.setAutoRangeIncludesZero(true);
plot.setRangeAxis(vla);

MySeries.add(new Second(d), new Double(1/(10^2)) );
MySeries.add(new Second(d), new Double(2/(10^2)) );

Any help will be very appriciated,
thanks,
yaron

Dave O'Donnell

Re: VerticalLogarithmicAxis - unable to show values between

Post by Dave O'Donnell » Wed Dec 04, 2002 5:15 am

Just a thought, have you tried setting the lower bounds to a positive, non-zero value?

DaveOD

David Gilbert

Re: VerticalLogarithmicAxis - unable to show values between

Post by David Gilbert » Wed Dec 04, 2002 11:01 am

The axis label is using 10^0 (which is equal to 1), because '^' is a common symbol meaning 'to the power of'. So I think the axis range is correct, although I'm not sure why you don't see more grid lines.

BUT, in Java '^' is the exlusive OR operator, it does NOT raise a number to the nth power. Try running the following code to see what I mean:

System.out.println(10^2); // answer = 8
System.out.println(1 / (10^2)); // answer = 0 (because of integer rounding)

After you fix that problem, you should see some data on your chart.

Regards,

DG

yaron

Re: VerticalLogarithmicAxis - unable to show values between

Post by yaron » Wed Dec 04, 2002 2:11 pm

Hi,
Thanks alot, your answers really helped me.
Yaron

Locked