Hi,
Is there a way to set the tickLabelFormatter in the HorizontalDateAxis without setting it in the long constructor (using the no arguments constructor and then calling some set method)??
Thanks,
Set tickLabelFormatter in DateAxis
Re: Set tickLabelFormatter in DateAxis
In 0.9.4, the formatting is all controlled by the DateTickUnit class. The tickLabelFormatter in the constructor is a "leftover" and has been removed for the upcoming 0.9.5 release.
By default, the axis will auto-select one of the units from the "standard" collection - see the createStandardDateTickUnits() method in the DateAxis class. You can replace this collection with your own if you want to.
Otherwise, you can manually set the tick unit via the setTickUnit(...) method, which turns off the auto-select feature.
Regards,
Dave Gilbert
By default, the axis will auto-select one of the units from the "standard" collection - see the createStandardDateTickUnits() method in the DateAxis class. You can replace this collection with your own if you want to.
Otherwise, you can manually set the tick unit via the setTickUnit(...) method, which turns off the auto-select feature.
Regards,
Dave Gilbert
Re: Set tickLabelFormatter in DateAxis
David, as you have suggested I have tried using the setTickUnit method, this is great in that I was able to specify the format of the dates and the timezone to use. However, this has caused the problem in that the dates when they are too close together overlap each other, since I have to specify the unit and count. Can you give me some suggestions on how I can overcome this problem. Is it possible to use auto setting but at the same time specify the timezone? Thanks for your help.
Re: Set tickLabelFormatter in DateAxis
In 0.9.4, you have to create your own TickUnits collection and then call the setStandardTickUnits(...) method in the DateAxis class. This is just replacing the default collection, JFreeChart will then choose the smallest TickUnit in the collection such that the labels don't overlap.
In 0.9.5, there will be a new method setDateFormatOverride(...) that will allow you to set one DateFormat that will override the date formats in the TickUnits collection...that might work in some cases.
Regards,
Dave Gilbert
In 0.9.5, there will be a new method setDateFormatOverride(...) that will allow you to set one DateFormat that will override the date formats in the TickUnits collection...that might work in some cases.
Regards,
Dave Gilbert