How to Set Ticks to Values That Are Not Multiples of the Tick Length

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Cartographer
Posts: 1
Joined: Fri May 15, 2020 7:03 pm
antibot: No, of course not.

How to Set Ticks to Values That Are Not Multiples of the Tick Length

Post by Cartographer » Mon May 18, 2020 3:03 pm

Hello,

I'm having some trouble getting ticks to display at the right values. Whatever I do, the ticks are always at values that are multiples of the tick length, and I don't want that.

For example, let's say I have a time series chart where the y-axis ranges from -24.6 to 55.6. I want to draw ticks 10 units apart, but I want them to fall on values that end with .5. So for this chart, I want ticks (with labels and gridlines) at -24.5, -14.5, -4.5, 5.5, 15.5, 25.5, 35.5, 45.5, 55.5, and nowhere else. Is there any simple way to do something like this? I thought of trying to set the tick value to .5 and then erasing the ticks (and labels and gridlines) I don't want, but I can't find a way to do that either.

Thanks!

Locked