如何在C#中更改MS Charts标签字体大小?

时间:2016-03-08 04:57:45

标签: c# forms charts label mschart

我创建了一些MS图表。下面从我的应用程序中提取的代它工作正常。但我想增加标签的字体大小。如何更改标签的字体大小?

感谢。

 Series MIN = Chart2.Series.Add("Minimum");
 MIN.Points.DataBindXY(listVersion, MIN_list[j]);
 MIN.ChartType = SeriesChartType.Line;
 MIN.Color = Color.Red;
 MIN.BorderWidth = 3;
 MIN.IsValueShownAsLabel = true;
 MIN.LabelBackColor = System.Drawing.Color.Red;
 MIN.LabelForeColor = System.Drawing.Color.White;

2 个答案:

答案 0 :(得分:2)

您可以为每个Font单独更改DataPoint

MIN.Points[0].Font = new System.Drawing.Font("Consolas", 10f);
MIN.Points[1].Font = new System.Drawing.Font("Consolas", 12f);
MIN.Points[2].Font = new System.Drawing.Font("Consolas", 14f);

或者您可以更改系列的所有 Font的{​​{1}}:

Labels

enter image description here

答案 1 :(得分:1)

   Chart2.ChartAreas.["yourChartArea"].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None;

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