Hi,
I think there is an error with LogAxis and minor grid lines.
The problem accurs when I use LogAxis (Domain or Range does not matter) and the minor grid lines are displayed.
There should be 8 minor lines between the mayor lines - but there are 9.
e.g. between 10^0 (=1) and 10^1 (=10) there should be 8 minor lines for 2,3,4,5,6,7,8,9
but there are 9...
When I use LogarithmicAxis it is correct.
My problem is that I want to use LogAxis because it's easier to get the tick marks right.
Any chance this will be fixed?
Thanks,
Thomas
Issue with LogAxis and minor grid lines
Re: Issue with LogAxis and minor grid lines
Hi,
Nobody experienced the same problem?
Here's a picture:
Thanks,
Thomas
Nobody experienced the same problem?
Here's a picture:
Thanks,
Thomas
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Issue with LogAxis and minor grid lines
Looks like a classical bug to me.
In the current version of JFreeChart, the LogAxis calculates the minor ticks in a way that seems to be identical to that of a NumberAxis, i.e. with 1, 3, 4, or 9 minor tick lines between major tick lines.
In an earlier version, the minor tick count could be explicitly set for a ValueAxis, and the default for a LogAxis was 9 (corresponding to 9 "regions" between major tick marks, which are separated from each other by 8 minor tick lines).
In the current version of JFreeChart, the LogAxis calculates the minor ticks in a way that seems to be identical to that of a NumberAxis, i.e. with 1, 3, 4, or 9 minor tick lines between major tick lines.
In an earlier version, the minor tick count could be explicitly set for a ValueAxis, and the default for a LogAxis was 9 (corresponding to 9 "regions" between major tick marks, which are separated from each other by 8 minor tick lines).
Re: Issue with LogAxis and minor grid lines
Hi,
I found a solution for above problem:
Thomas
I found a solution for above problem:
- download the source file of LogAxis.java
- change line number 144 (replace 10 with 9) and include the file in your project (don't forget to include the missing imports)
- set the axis auto tick unit selection to false: axis.setAutoTickUnitSelection(false);
Thomas
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Issue with LogAxis and minor grid lines
The auto tick unit selection can probably be fixed by changing the code here:
In the call to super(), the NumberTickUnitSource instance assumes 10 minor tick intervals, whereas we want 9 I guess. The initial tickUnit I already changed in the code above.
Code: Select all
public LogAxis(String label) {
super(label, new NumberTickUnitSource());
setDefaultAutoRange(new Range(0.01, 1.0));
this.tickUnit = new NumberTickUnit(1.0, new DecimalFormat("0.#"), 9);
}
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program