Autorange ?

A free public discussion forum for the JFreeChart class library.

Autorange ?

Postby Ricco » Thu Jun 04, 2009 4:20 pm

Hi,

I have an issue with the autorange function and jfreechart 1.13. I have a dataset with 3 ( visibles ! ) series but the autorange seems to concidere only the first serie. With version 1.12 , 1.11 and 1.10 its ok ... Is it a bug or a new way to use autorange ?

I have another problem. I tried with older version but it's the same. I don't know what I have done but I don't think I had this kind of space between axis with my other soft using jfreechart ... I can I make the axis touch on 0 ?

Image
Ricco
 
Posts: 5
Joined: Tue Aug 14, 2007 9:45 am

Re: Autorange ?

Postby david.gilbert » Mon Jun 08, 2009 3:49 pm

Ricco wrote:I have an issue with the autorange function and jfreechart 1.13. I have a dataset with 3 ( visibles ! ) series but the autorange seems to concidere only the first serie. With version 1.12 , 1.11 and 1.10 its ok ... Is it a bug or a new way to use autorange ?


It sounds like a bug - do you have any hints on how to reproduce it? What dataset type are you using? Which renderer? If you can supply either a JUnit test or a small self-contained application that shows the problem, then I should have no trouble tracing the cause of the problem.

Ricco wrote:I have another problem. I tried with older version but it's the same. I don't know what I have done but I don't think I had this kind of space between axis with my other soft using jfreechart ... I can I make the axis touch on 0 ?


You can call the setAxisOffset() method in the CategoryPlot or XYPlot class.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11352
Joined: Fri Mar 14, 2003 10:29 am

Re: Autorange ?

Postby JonLiss » Mon Jun 15, 2009 12:03 pm

Confirmed here too. Junit:

import junit.framework.TestCase;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

public class AutorangeTest extends TestCase {

private JFreeChart generateChart(int seriesCount) {
XYSeriesCollection seriesCollection = new XYSeriesCollection();
XYSeries[] series = new XYSeries[seriesCount];
for (int i = 0; i < seriesCount; i++) {
for (int j = 0; j <= 10; j++) {
if (series[i] == null) {
series[i] = new XYSeries(new Integer(0));
seriesCollection.addSeries(series[i]);
}
series[i].add(j, (i + 1) * j);
}
}
return ChartFactory.createXYLineChart("Test", "i", "j", seriesCollection,
PlotOrientation.VERTICAL, true, false, false);
}

public void testSingleSeriesAutorange() throws Exception {
JFreeChart chart = generateChart(1);
chart.getXYPlot().getDomainAxis().setAutoRange(true);
assertTrue(chart.getXYPlot().getDomainAxis().isAutoRange());
assertTrue(chart.getXYPlot().getDomainAxis().getUpperBound() >= 10.0);
}

public void testMultipleSeriesAutorange() throws Exception {
JFreeChart chart = generateChart(2);
chart.getXYPlot().getDomainAxis().setAutoRange(true);
assertTrue(chart.getXYPlot().getDomainAxis().isAutoRange());
assertTrue(chart.getXYPlot().getDomainAxis().getUpperBound() >= 20.0);
}
}
JonLiss
 
Posts: 2
Joined: Mon Jun 15, 2009 12:01 pm

Re: Autorange ?

Postby david.gilbert » Mon Jun 15, 2009 10:53 pm

Thanks for the test. Just looking at it quickly, I wonder if this has something to do with the XYSeriesCollection erroneously allowing multiple series in the collection to have the same key? Ideally, this should cause an exception when you add a series with a duplicate key. I'm going to have to reflect on the best way to resolve this. Input is welcome, of course.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11352
Joined: Fri Mar 14, 2003 10:29 am

Re: Autorange ?

Postby JonLiss » Tue Jun 16, 2009 9:31 am

david.gilbert wrote:Thanks for the test. Just looking at it quickly, I wonder if this has something to do with the XYSeriesCollection erroneously allowing multiple series in the collection to have the same key? Ideally, this should cause an exception when you add a series with a duplicate key. I'm going to have to reflect on the best way to resolve this. Input is welcome, of course.

Oops, think I might want to replace DomainAxis with RangeAxis in that test. Range is the Y values, right? :P
JonLiss
 
Posts: 2
Joined: Mon Jun 15, 2009 12:01 pm

Re: Autorange ?

Postby arianfornaris » Fri Aug 07, 2009 7:16 pm

Hi

JFreeChart has the feature "autorange", but I have a question. Autorange is only for the range axis?
This code work fine:

plot.getRangeAxis().setAutoRange(true);
plot.configure() //I expect that blank spaces in top and bottom will be removed with the properly zoom.

But, this code don't work:

plot.getDomainAxis().setAutoRange(true);
plot.configure() //I expect that blank spaces in left and right will be removed with the properly zoom.

Is this a bug? Or "autorange" is only for the RangeAxis?

Thanks,
Arian.
arianfornaris
 
Posts: 1
Joined: Fri Aug 07, 2009 7:09 pm

Re: Autorange ?

Postby david.gilbert » Sun Aug 09, 2009 9:02 pm

Autorange works for any numerical or date axis. You'll have to provide more detail about the actual problem you are seeing.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11352
Joined: Fri Mar 14, 2003 10:29 am

Re: Autorange ?

Postby iweinzierl » Wed Dec 16, 2009 2:48 pm

Hi,

Ricco wrote:Hi,

I have an issue with the autorange function and jfreechart 1.13. I have a dataset with 3 ( visibles ! ) series but the autorange seems to concidere only the first serie. With version 1.12 , 1.11 and 1.10 its ok ... Is it a bug or a new way to use autorange ?

I have another problem. I tried with older version but it's the same. I don't know what I have done but I don't think I had this kind of space between axis with my other soft using jfreechart ... I can I make the axis touch on 0 ?



same problem here. 'setAutoRange(boolean)' seems to take just the first dataset into account. Does it make sense to report this issue in the bug tracker? Or is the forum the main communication plattform for such things?

Best regards, Ingo
iweinzierl
 
Posts: 6
Joined: Wed Dec 16, 2009 2:11 pm

Re: Autorange ?

Postby plunavat » Sun Jan 01, 2012 11:55 am

update to version 1.0.14 and problem is solved

Regards,
Pranav C Lunavat
plunavat
 
Posts: 20
Joined: Sun Jan 01, 2012 10:59 am


Return to JFreeChart - General

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests