Values less than or equal to zero not allowed on log axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
joelwyland
Posts: 15
Joined: Wed Jun 02, 2004 10:26 pm

Values less than or equal to zero not allowed on log axis

Post by joelwyland » Tue Jul 13, 2004 11:32 pm

Hi all,

I'm making an XY scatter plot with log axes for X and Y. I'm getting:

Code: Select all

java.lang.RuntimeException: Values less than or equal to zero not allowed with logarithmic axis
        at org.jfree.chart.axis.LogarithmicAxis.autoAdjustRange(LogarithmicAxis.java:422)......
I've printed out all of my data points and none of them are zero or negative, I'm totally confused.

Code: Select all

------ VALUES ------
        (0.0016578744555898748, 0.12896105027738244)
        (0.026944376865505704, 0.11966656016730082)
        (0.009001540424901745, 0.07203229835313253)
        (0.018147379404992798, 0.0557669406604897)
        (4.783178517788641E-5, 0.011618112637602021)
        (1.5325012873010813E-4, 0.011618112637602021)
        (1.7393119282012036E-4, 0.005809056318801011)
Some of them are VERY small... but none of them are zero or non-zero. What's happening?

Any help is appreciated, thanks,
Kenny

joelwyland
Posts: 15
Joined: Wed Jun 02, 2004 10:26 pm

Post by joelwyland » Wed Jul 14, 2004 7:11 pm

I determined what the problem was. I was using an XYSeriesCollection, which implements the IntervalXYDataset interface. When determining the "minimum" value in the dataset, the XYSeriesCollection would report the minimum value lower than what it really was, because it was including area around the value. So, my values that were really close to zero ended up reporting values below zero because the XYSeriesCollection was including some area around the actual value.

My solution was to just create my own XYDataset.... which actually kind of bugs me. Why isn't there just a simple XYDataset that keeps a bunch of XYDataItems? We have a ton of fancy datasets that I'm sure are good for really complex things, but what about just a collection of x,y points?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Jul 14, 2004 8:57 pm

joelwyland wrote:I determined what the problem was. I was using an XYSeriesCollection, which implements the IntervalXYDataset interface. When determining the "minimum" value in the dataset, the XYSeriesCollection would report the minimum value lower than what it really was, because it was including area around the value. So, my values that were really close to zero ended up reporting values below zero because the XYSeriesCollection was including some area around the actual value.
That is an unintended side effect of recent changes. As a workaround, try calling setIntervalWidth(0.0) for your dataset - I think it should work, but I haven't tried it.
joelwyland wrote:My solution was to just create my own XYDataset.... which actually kind of bugs me. Why isn't there just a simple XYDataset that keeps a bunch of XYDataItems? We have a ton of fancy datasets that I'm sure are good for really complex things, but what about just a collection of x,y points?
It bugs me too. XYSeriesCollection should be relatively straightforward - I will take a look at it and see if I can separate out the IntervalXYDataset implementation into a subclass (or a wrapper class) and leave XYSeriesCollection as a simple XYDataset implementation.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Guest

Post by Guest » Wed Jul 14, 2004 9:04 pm

It bugs me too. XYSeriesCollection should be relatively straightforward - I will take a look at it and see if I can separate out the IntervalXYDataset implementation into a subclass (or a wrapper class) and leave XYSeriesCollection as a simple XYDataset implementation.
Thanks, that would rock.

Locked