c# - 如何在 C# 中更改 MS 图表标签字体大小?

标签 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;

最佳答案

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

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

或者您可以为系列的所有标签更改字体:

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

enter image description here

关于c# - 如何在 C# 中更改 MS 图表标签字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35859303/

相关文章:

c# - 检查图中所有节点之间的距离是否 <=k

php - 表格和表单提交

html - 在不更改 CSS 的情况下在提交按钮上应用 input.button CSS?

android - 如何删除 Horizo​​ntalBarChart 中条形后面的网格线?

C# WPF D3(动态数据显示)图表项目

c# - WinForms 文本框中的换行符

c# - 验证按钮上的输入单击winforms c#

c# - 如何在 .NET 中不使用乘法运算符实现乘法

angular - 无法绑定(bind)到 'formGroup',因为它不是 'form' 的已知属性。 ionic v5.2.2 中的错误

javascript - Charts.js 图不缩放到 Canvas 大小