I am using JFreeChart and want to be able to change the label on the range axis from a number to something more meaningful for the domain I am in. I only see options for customizing the look of the label and no way to override the content of the label based on the position of the tick.
Does anyone know how to override the text of the tickLabel?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With