[英]Microsoft WinForms Chart Control - Set Position of Y-Axis Label
I have a Y-Axis Label as shown here: 我有一个Y轴标签,如下所示:
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. 我可以添加Winforms标签并相应地放置它,但以防万一有更好的方法。
If you are talking about the AxisY.Title AvGkW
you can't position it other than aligning it near, center, far
. 如果您在谈论
AxisY.Title AvGkW
,则只能将其对齐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.. 但是您可以根据需要向
Chart
添加任意多个Titles
,将它们停靠在地球的所有四个角处,例如um, Chart
,设置其样式并设置其偏移量。
After you have added your Title
like this: 像这样添加
Title
:
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! 它不在MSDN上的规范中,但通常它位于
Chart.Size
1/100中,因此将其设置为50
会将Title
移动到ChartArea
的中间..奇怪的是,它是int32
!
You will have to play with the number depending on the size of the Y-Labels
and the position of the Y-Axis
. 您将不得不根据
Y-Labels
的大小和Y-Axis
的位置来玩数字游戏。 Values of 2-7
are OK here.. 2-7
值在这里可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.