Tick unit formatting on range axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Kenny Dubuisson

Tick unit formatting on range axis

Post by Kenny Dubuisson » Fri Nov 29, 2002 6:14 pm

I have an area XY chart that I would like to format the ticks for. I've figured out how to set my minimum (-50) and my maximum (0) but I've not figured out how to force it to do two other things. What I want is 1) tick unit spacing every 5 integers (meaning 0, -5, -10, etc.) and I want to add a percent sign to the end of the tick label (meaning 0%, -5%, etc.).

Has anyone done this (or Dave could you point me in the right direction)? Thanks,
Kenny

David Gilbert

Re: Tick unit formatting on range axis

Post by David Gilbert » Fri Nov 29, 2002 6:27 pm

You can manually set a tick unit using the setTickUnit(...) method in the NumberAxis class (there is a similar method in the DateAxis class). You need to create an instance of NumberTickUnit, and it can incorporate any NumberFormat object (including one that formats as percentages).

Regards,

DG

Kenny Dubuisson

Re: Tick unit formatting on range axis

Post by Kenny Dubuisson » Fri Nov 29, 2002 7:19 pm

Dave:

That makes sense (I read about it in the documentation) but I wasn't able to get it to work. Could you possibly post some example code?

As always, thanks for your help. If you ever need a reference for your JFreeChart library, just send me an email. I can't tell you how much we are incorporating all our new web site stuff around it. I wish I could let you see the site but it is a closed site only available to our reps across the US and due to SEC compliance issues we are not able to grant general access to it.

Thanks again,
Kenny

Locked