Menu

#1148 DateAxis Tick Unit refresh error

1.0.x
open
nobody
6
2016-04-13
2016-04-13
Sergio
No

Good morning,
I'm working with JFreeChart for some months and it's incredible! Congratulations guys! :D
I have just found a bug when refreshing the Tick Units of the Date Axis (attach images).
As you can see in my java example, when moving right the TickUnits that are visible change (Left.jpg -> Right.jpg), so the tick units move from 4 June to 7 June. Furthermore I have found that the error is also in the demo.jar (I have tried 1.0.13 and 1.0.19 and both have it) as you can see in Demov1.0.19-Left.jpg and Demov1.0.19-Right.jpg.
After an hour looking for the origin of the problem I found that the error is located in org.jfree.chart.axis.DateAxis#previousStandardDate(Date, DateTickUnit)

protected Date previousStandardDate(Date date, DateTickUnit unit) {
...
Ohter stuff
...

int value = count * (current / count);

 ...
 Ohter stuff
 ...

This line makes this behaviour in my example:
- If the min Axis Date is 31st May, the method result is 28th May, so in my case the TickUnit goes to 4th June
- But if the min Axis Date is 1st June, the method result is 31th May, so in my case the TickUnit goes to 7th June

4 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB