Hi
Is it possible to have the labels of Symbol axis / numeric axis rotated by defined angle. I was able to accomplish this in CategoryAxis with the available apis. Is there a api or a interface which i can extend to accomplish this.
Thanks,
Vijay Venkataraman
Rotate labels of numberic and symbol axis by defined angle.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
It hasn't been implemented, because with the auto tick unit selection mechanism it becomes a little more complex than the CategoryAxis case (which just displays all labels regardless). It wouldn't be impossible to implement, just a little difficult and time consuming which is why no one has done it yet.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Hi Dave,
Thanks for all the responses. I am able to get the labels rotate for now by overriding the method
On rc3 probably aka branch STABLE_1-0-0
This method is used internally in ValueAxis at
This is probably a hack. I havent completely succeeded in this endavour. I do have the labels rotated. I will have to work with the textAnchor and fix it too. For now it is a hack from my end. Once i get a better hang of things probably i will have them neatly placed at symbolAxis level.
Can you let me know, if this is ok or there is a better way to get to get this done. I am pretty much new to JFree Chart and getting to have grip of the different api and the architecture as such.
Thanks for the responses.
Vijay Venkataraman
Thanks for all the responses. I am able to get the labels rotate for now by overriding the method
On rc3 probably aka branch STABLE_1-0-0
Code: Select all
public List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge)
Code: Select all
drawTickMarksAndLabels(Graphics2D g2,
double cursor,
Rectangle2D plotArea,
Rectangle2D dataArea,
RectangleEdge edge)
Can you let me know, if this is ok or there is a better way to get to get this done. I am pretty much new to JFree Chart and getting to have grip of the different api and the architecture as such.
Thanks for the responses.
Vijay Venkataraman
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
That approach doesn't seem too bad to me. The hard part (for NumberAxis) is choosing a tick size such that the tick labels don't overlap, and that gets done inside the refreshTicks() method. You can return whatever you like from an overridden version of refreshTicks(), as long as you take responsibility for label overlapping yourself.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

