I would like to format my Y-axis lables on a BasicTimeSeries chart from "DD-MON-YYYY" to "MM/DD/YYYY". Does anyone know how to do this? Thanks,
Kenny
Formatting date labels of BasicTimeSeries chart
Re: Formatting date labels of BasicTimeSeries chart
Hi Kenny,
There's currently two approaches:
1) Set a fixed tick size and format using the setTickUnit(...) method in the DateAxis class. The only problem is when you resize your chart (if you allow that) you might find the tick labels overlap.
2) Create your own collection of TickUnits with the formatting you require. The default TickUnits are created in the createStandardDateTickUnits() method of the DateAxis class. You should use some similar code (the number of units you create is not important, usually you will want at least 2) and when you TickUnits collection is ready, call the setStandardTickUnits(...) method that is inherited from the ValueAxis class.
This sets up a collection of "standard" tick sizes, and JFreeChart will choose the smallest one such that the tick labels do not overlap.
Regards,
DG.
There's currently two approaches:
1) Set a fixed tick size and format using the setTickUnit(...) method in the DateAxis class. The only problem is when you resize your chart (if you allow that) you might find the tick labels overlap.
2) Create your own collection of TickUnits with the formatting you require. The default TickUnits are created in the createStandardDateTickUnits() method of the DateAxis class. You should use some similar code (the number of units you create is not important, usually you will want at least 2) and when you TickUnits collection is ready, call the setStandardTickUnits(...) method that is inherited from the ValueAxis class.
This sets up a collection of "standard" tick sizes, and JFreeChart will choose the smallest one such that the tick labels do not overlap.
Regards,
DG.