Menu

#571 Logarithmic Axis's tick labels for negative values wrong

1.0.x
open
General (896)
7
2006-02-10
2005-11-14
sarcan
No

When displaying negative values on the LogarithmicAxis the tick
labels for negative values are displayed incorrectly (the wrong
ticks are labeled, see attchmt). The problem occurs from version
0.9.2 to the latest cvs version. It seems to me that this code
fragment:

tickLabel = ((expTickLabelsFlag && j < 2)
|| j < 1
|| (i < 1 && j < 5) || (j < 4 - i)
|| currentTickValue >= upperBoundVal)
? makeTickLabel(currentTickValue) :
"";

(line 614) only works correctly for positive values. One would need
to distinguish between positive and negative values and adjust the
variables i and j accordingly:

if (i < 0) {
final int k = -i - 1;
final int l = 9 - j;
tickLabel = ((expTickLabelsFlag && l < 2)
|| l < 1
|| (k < 1 && l < 5) || (l < 4 - k)
|| currentTickValue <= lowerBoundVal)
? makeTickLabel(currentTickValue) :
"";

} else {
tickLabel = ((expTickLabelsFlag && j < 2)
|| j < 1
|| (i < 1 && j < 5) || (j < 4 - i)
|| currentTickValue >= upperBoundVal)
? makeTickLabel(currentTickValue) :
"";
}

The above code should do the trick as it creates labels for a
negative value whenever it would create a label for it's positive
counterpart.

Cheers

Discussion

  • sarcan

    sarcan - 2005-11-14

    Screenshot illustrating the bug

     
  • David Gilbert

    David Gilbert - 2006-02-10
    • milestone: --> 1.0.x
    • priority: 5 --> 7
    • assigned_to: nobody --> mungady
     
  • David Gilbert

    David Gilbert - 2006-02-10

    Logged In: YES
    user_id=112975

    Confirmed, thanks for the report. I'm looking at this class
    now to see how it can be tidied up in general. At the very
    least, I'll get your fix applied for the next release.

     

Log in to post a comment.