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
How to set different range from tick unit to tick unit
-
- Posts: 4
- Joined: Mon Jun 19, 2017 10:13 am
- antibot: No, of course not.
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: How to set different range from tick unit to tick unit
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.
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.