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...
Still an Auto-Range Problem in v0.7.4
Re: Still an Auto-Range Problem in v0.7.4
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);
}
}
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);
}
}
Re: Still an Auto-Range Problem in v0.7.4
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...
...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...
