How can I change the tickLabel on a NumberAxis in JFreeChart?

The JFreeChart BarChartDemo1 shows how to use the setStandardTickUnits() method. NumberAxis has several handy static factories for this. To override the defaults, you can “create your own instance of TickUnits and then pass it to the setStandardTickUnits() method.”

Addendum: The defaults mentioned above simply use a subclass of java.text.Format; you can supply your own for each TickUnit you add(). If this is inadequate, you can override valueToString() in your own concrete subclass of TickUnit and use it to compose the required TickUnits.

Leave a Comment