如何更改Y轴标签字体大小?

9
我想改变 Y 轴标签的字体大小。
我尝试过...
AxisY LineColor="64, 64, 64, 64" LabelAutoFitMinFontSize="5"
   LabelStyle Font="NanumGothic, 5pt"

并且

Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font.Size = 5;

但是它不起作用。即使我扩展或缩小它,其大小也无法修改。
请帮帮我...!! :)
4个回答

14

您似乎忘记更改此轴的自适应样式。它的默认设置会替换您的字体大小。

Chart1.ChartAreas.["ChartArea1"].AxisY.LabelAutoFitStyle 
    = LabelAutoFitStyles.None;
Chart1.ChartAreas.["ChartArea1"].AxisX.LabelStyle.Font 
    = new System.Drawing.Font("Trebuchet MS", 2.25F, System.Drawing.FontStyle.Bold);

10
你可以尝试这个,可能会有效。
Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new Font("your required font",uyour required size, FontStyle.your required style);

设置标题颜色

Chart1.ChartAreas["ChartArea1"].AxisX.ForeColor = Color.Red;(将图表1的横轴文本颜色设置为红色)


6

不要直接尝试更改字体大小,而是使用所需样式指定字体。例如:

Chart1.ChartAreas.["ChartArea1"].AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 2.25F, System.Drawing.FontStyle.Bold);

根据你的操作,你可能也想将 IsLabelAutoFit 设置为 false。


1

秘密不在图表区域(chartArea),而在系列(Series)中:

Chart1.Series["SerieName"].Font = new Font("Arial", 7, FontStyle.Bold);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接