#763 Ability to set custom calendar for DateTickUnit

General (896)
Mike Harris

The current DateTickUnit implementation uses Calendar.getInstance() to get a locale dependant calendar based on the user's Locale. It is not possible to influence this.

This is not always what you want. In my case I wanted to use a Calendar that would enforce the ISO8601 definition of week numbering, so I had to specify a calendar.

The attached patch allows the caller to set the calendar that is to be used via a new public method setCalendar().


  • Mike Harris

    Mike Harris - 2007-06-12

    Patch prepared with diff -u

  • David Gilbert

    David Gilbert - 2007-06-29

    Logged In: YES
    Originator: NO

    Thanks for the patch (which I'm transferring to the patch database rather than the bug database). One side effect of your change is that instances of the DateTickUnit class will no longer be immutable, which we rely on for cloning the TickUnits class. So it will be necessary to implement Cloneable and update the TickUnits clone method. Furthermore, I think this change needs some additional regression tests to make sure that cloning continues to work for charts that use DateTickUnit or NumberTickUnit.

    [One other thing to add: while taking a look at your patch, I spotted a probable bug in the existing code (not your patch), in that the DateFormat instance passed to one of the constructors isn't cloned, so there's a hole there for modifying the supposedly immutable instance. We should fix that up also.]

  • David Gilbert

    David Gilbert - 2007-06-29
    • labels: --> General
    • priority: 5 --> 6
    • assigned_to: nobody --> mungady

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks