Symbol Axis rotation

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ekta1994
Posts: 26
Joined: Fri May 12, 2017 8:06 am
antibot: No, of course not.

Symbol Axis rotation

Post by ekta1994 » Fri May 26, 2017 6:24 am

I am creating the X and Y axis of the jfreechart using symbol axis and want to rotate its tick mark labels by any angle say 45. Using setSeriesPositiveItemLabelPosition() is not working.
Any way to do so?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Symbol Axis rotation

Post by david.gilbert » Fri May 26, 2017 7:04 pm

There isn't a way to do that. I can see why it would make sense...it has been implemented for CategoryAxis (even if the API is a bit awkward) but for the ValueAxis subclasses (NumberAxis, DateAxis) it was less useful, so it was not implemented. SymbolAxis subclasses NumberAxis so didn't get this tick label rotation feature either. It wouldn't be that hard to do, but it would involve updating the auto tick unit selection code which would be a small challenge. If you have a go at it, please post a patch online somewhere, I'm sure others will find it useful.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

MrJack
Posts: 13
Joined: Thu May 18, 2017 3:41 pm
antibot: No, of course not.

Re: Symbol Axis rotation

Post by MrJack » Mon May 29, 2017 4:39 pm

This isn't totally working I think (It's more that I didn't totally understand how it work) but with a ValueAxis you can do this :

Code: Select all

yourValueAxis.setLabelAngle(90);

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Symbol Axis rotation

Post by david.gilbert » Tue May 30, 2017 2:46 pm

That option is for the axis label not the tick labels.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

MrJack
Posts: 13
Joined: Thu May 18, 2017 3:41 pm
antibot: No, of course not.

Re: Symbol Axis rotation

Post by MrJack » Tue May 30, 2017 4:18 pm

My bad didn't see that was for a tick label

Locked