Auto Range is of no effect

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

Auto Range is of no effect

Post by YaoYue » Tue Feb 26, 2002 2:34 am

Why setAutoRange(true) of VerticalNumberAxis is no effect?

David Gilbert

Re: Auto Range is of no effect

Post by David Gilbert » Thu Feb 28, 2002 2:18 pm

I'm not sure. Can you describe the context in which you call setAutoRange(true)? What you see, and what you expected to see?

Regards,

Dave Gilbert

YaoYue

Re: Auto Range is of no effect

Post by YaoYue » Fri Mar 01, 2002 3:14 am

public VerticalNumberAxis createVerticalNumberAxis(){
VerticalNumberAxis vna=new VerticalNumberAxis("value");
// vna.setGridPaint(Color.cyan);
// vna.setInverted(true);
vna.setAutoRange(false);
vna.setAutoRange(true);
// vna.setMaximumAxisValue(50.0);
// vna.setMinimumAxisValue(-50.0);
return vna;
}

public void createVerticalBarChart(){
JFreeChart barChart=ChartFactory.createVerticalBarChart("Price Chart","Category","Price",new DefaultCategoryDataset(seriesName,categoriesName,data),true);
barChart.getPlot().setVerticalAxis(createVerticalNumberAxis());
try{
ChartUtilities.saveChartAsPNG(new File("test.png"),barChart,600,600);
}catch(IOException e){
System.out.println(e.getMessage());
}
}

Whether setAutoRange(true) or setAutoRange(false),the max and min value of the axis always equal to 1.00 and 0.00 as long as you set the axis.

David Gilbert

Re: Auto Range is of no effect

Post by David Gilbert » Fri Mar 01, 2002 2:20 pm

OK, thanks for the sample code. I can see the problem against the 0.7.3 code (same as you) but it appears to be fixed in my current source tree (which will be 0.7.4 soon). That could be because of some changes I made while trying to track down a bug with the CombinedPlot class a couple of days ago.

I made quite a few changes here and there and I can't be sure which one(s) fixes the problem so you'll have to wait for 0.7.4 to be released (I hope next week).

Regards,

DG.

Locked