简体   繁体   中英

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

I have a Y-Axis Label as shown 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.

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..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM