Page 1 of 1

Put axis label above left axis?

Posted: Tue Mar 26, 2013 9:53 pm
by 17064597
It's possible to put a (vertically centered) title on the left axis. It's also possible to add a label placed to the left, at the maximum value.

I want to place a label/title above the axis. Actually, I have an arrow at the top of the axis and I would like to put the label above that.
axis.png
axis.png (962 Bytes) Viewed 4290 times

Re: Put axis label above left axis?

Posted: Wed Mar 27, 2013 12:34 pm
by yeray
Hi,

You could use an Annotation tool for it.

Re: Put axis label above left axis?

Posted: Sun Jun 23, 2013 3:37 pm
by 17064597
Thanks. But how do I position it at that exact location? At the time I instantiate my axis/arrow, they have no coordinates set!

Re: Put axis label above left axis?

Posted: Wed Jun 26, 2013 9:26 am
by yeray
Hi,

You need the chart to be drawn at least once to retrieve getChartRect or the axis position.

Re: Put axis label above left axis?

Posted: Wed Jun 26, 2013 11:46 am
by 17064597
There is no event or similar that I can hook into to position the label? Or should I simply call setAutoRepaint(true) and refreshControl() and then position the label?

Re: Put axis label above left axis?

Posted: Wed Jun 26, 2013 12:05 pm
by yeray
Hi,

I'm not sure it will work. In cases like this I remember to end up setting it at the chartPaint event, using some boolean to make sure I'm not creating and endless loop.

Re: Put axis label above left axis?

Posted: Sat Jun 29, 2013 8:52 am
by 17064597
Thanks. I have a feeling it won't work, like you say. I believe I tried this in the past.

One problem is that I'd like my label to push down the axis from the top, so that it does indeed fit. This happens automatically when an axis label is present. In that case the entire axis is pushed to the right.

May the best approach is to modify the source code to get this desired feature?

Re: Put axis label above left axis?

Posted: Tue Jul 02, 2013 11:38 am
by yeray
Hi,

Of course modifying the sources can be more accurate if you are always going to have this label on top of your axis.
Alternatively, if the axis will always have the same position, you can just find the appropriate Top and Left values to set for the Annotation tool and set them at the startup. In this option, you'll probably have to add some Top and/or Left Margins to the chart panel to leave some space for the Annotation.