Still an Auto-Range Problem in v0.7.4

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

Still an Auto-Range Problem in v0.7.4

Post by Julien SERDARU » Fri Mar 08, 2002 3:16 pm

Hi,

I've seen in another thread about the auto-range problem in v0.7.4.

It should have been corrected, but it appears that in the following code :

<pre>
String timeAxisLabel = "Date";
String valueAxisLabel = "Price (Euro)";

JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, timeAxisLabel, valueAxisLabel, data, true);
VerticalNumberAxis vAxis = new VerticalNumberAxis(valueAxisLabel);
vAxis.setAutoRangeIncludesZero(false);
vAxis.setAutoRange(true);
chart.getPlot().setVerticalAxis(vAxis);
</pre>

The range of my axis is still between 0 and 1...

David Gilbert

Re: Still an Auto-Range Problem in v0.7.4

Post by David Gilbert » Sat Mar 09, 2002 12:23 pm

Hi Julien,

This works OK for me. Here's the test program I ran against 0.7.4 - it results in a vertical axis having a range of about 166 to 181. Can you try it out?

Regards,

DG.

package com.jrefinery.chart.demo;

import com.jrefinery.data.DefaultCategoryDataset;
import com.jrefinery.chart.ChartFactory;
import com.jrefinery.chart.JFreeChart;
import com.jrefinery.chart.JFreeChartFrame;
import com.jrefinery.chart.Plot;
import com.jrefinery.chart.HorizontalDateAxis;
import com.jrefinery.chart.VerticalNumberAxis;

public class Test1 {

public static JFreeChart createTimeSeriesChart() {

JFreeChart chart = ChartFactory.createTimeSeriesChart("Price Chart",
"Time",
"Price",
DemoDatasetFactory.createTimeSeriesCollection2(),
true);
VerticalNumberAxis vaxis = new VerticalNumberAxis("Price");
vaxis.setAutoRangeIncludesZero(false);
vaxis.setAutoRange(true);
chart.getPlot().setVerticalAxis(vaxis);
return chart;

}

public static void main(String args[]) {

JFreeChart chart = Test1.createTimeSeriesChart();
JFreeChartFrame frame = new JFreeChartFrame("Title", chart);
frame.pack();
frame.setVisible(true);

}

}

Julien SERDARU

Re: Still an Auto-Range Problem in v0.7.4

Post by Julien SERDARU » Fri Mar 15, 2002 11:06 pm

The code you provided works great on my machine...
...but it did not solve my problem !!

But I guess my problem lies somewhere else :

I have troubles with the autorange only when I draw 2 series...

I could provide you with a sample code, but I modified your Stock Datasets in order to handle some specific issues with my code.

It used to work under 0.7.3. I guess the problem comes from my code.

Did you test autorange with multiple series ?

PS : Sorry for answering so late, I was a bit overwhelmed with work...

PS2 : Re-Sorry for my poor English... :)

Locked