8

我想更改 Y 轴标签字体大小。

我试过了...

AxisY LineColor="64, 64, 64, 64" LabelAutoFitMinFontSize="5"
   LabelStyle Font="NanumGothic, 5pt"

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

但它不起作用。即使我扩展或缩小它,它的大小也无法修改。

请帮我...!!:)

4

4 回答 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);
于 2012-07-24T07:38:12.830 回答
9

你试试这可能是它的工作

Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new Font("your required font",uyour required size, FontStyle.your required style);

设置标题颜色

Chart1.ChartAreas["ChartArea1"].AxisX.ForeColor = Color.Red;

于 2013-09-28T07:14:33.057 回答
6

与其尝试直接更改字体大小,不如为字体分配您需要的样式。例如:

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

根据您的操作,您可能还希望将 IsLabelAutoFit 设置为 false。

于 2012-07-11T04:48:21.877 回答
1

秘诀不在chartArea,而在Series:

Chart1.Series["SerieName"].Font = new Font("Arial", 7, FontStyle.Bold);
于 2016-10-08T23:10:06.840 回答