2016-03-08 116 views
1

我创建了很少的MS图表。以下代码从我的应用程序中提取它工作正常。但我想增加标签的字体大小。我如何更改标签的字体大小?如何更改C#中的MS Charts标签字体大小?

谢谢。

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; 

回答

0

可以单独改变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所有系列Labels

MIN.Font = new System.Drawing.Font("Times", 16f); 

enter image description here

0
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); 
+0

它改变了X轴的标签。其实我想改变图上的标签。请参考这个[图片](http://oi67.tinypic.com/vyxe29.jpg) – Sachith

相关问题