Microsoft WinForms Chart Control - Set Position of Y-Axis Label

3.5k Views Asked by At

I have a Y-Axis Label as shown here:

enter image description here

I am trying to position the label closer to the chart, is there any facility to do this?

I could add a Winforms Label and position it accordingly but just in case there is a better way.

1

There are 1 best solutions below

2
On BEST ANSWER

If you are talking about the AxisY.Title AvGkW you can't position it other than aligning it near, center, far.

But you can add as many Titles to your Chart as you want, dock them to all four corners of the earth, um, Chart, style them and set their offset..

After you have added your Title like this:

Title TT = new Title( yourTitleText, Docking.Left, yourFont, yourcolor);
TT.Docking = Docking.Left;
yourChart.Titles.Add(TT);

You can move it left and right like this:

TT.DockingOffset = yourOffset;

It isn't in the specs here on MSDN but as usual it is in 1/100 of the Chart.Size, so setting it to 50 moves the Title into the middle of the ChartArea.. It is an int32 strangely!

You will have to play with the number depending on the size of the Y-Labels and the position of the Y-Axis. Values of 2-7 are OK here..