How to set different range from tick unit to tick unit

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
fitrianadz
Posts: 4
Joined: Mon Jun 19, 2017 10:13 am
antibot: No, of course not.

How to set different range from tick unit to tick unit

Post by fitrianadz » Fri Jul 21, 2017 8:23 am

I have chart with specific number of tick unit, e.g. 10 tick units. Can I set range from first tick unit to second tick unit? or from third tick unit to fourth tick unit?
Thank you

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: How to set different range from tick unit to tick unit

Post by paradoxoff » Sat Jul 22, 2017 5:01 pm

Yes, you can.
Subclass the axis that you use, override refreshTicks, and return whatever list of ticks you need.
For the record:
- JFreeChart should support generics. The return value is declared as List, but is really a List<ValueTick>.
- Since this question comes up quite often, we probably need a more elegant way to create user defined tick lists. At present, the axis class of choice needs to be subclassed. If the generation of the tick list could be delegated to a separate object (TickListCreator), that can be set for instances of ValueAxis, subclassing would not be necessary.

Locked