图表区域内的 MSchart 标签

标签 mschart

enter image description here

谁能告诉我如何在 MSChart 上显示 Total Collection

最佳答案

您可以使用 chart.Annotations 属性来获得类似的结果。

例如使用以下代码(位于填充图表之后):

var ann = new RectangleAnnotation();
ann.Text = "Total Collection" + Environment.NewLine + "250 Billion";
ann.IsMultiline = true;
ann.AxisX = this.chart1.ChartAreas[0].AxisX;
ann.AxisY = this.chart1.ChartAreas[0].AxisY;
ann.AnchorX = 9;  // as you can see from the image below,
ann.AnchorY = 41; // these values are inside the range

// add the annotation to the chart annotations list
this.chart1.Annotations.Add(ann);

我得到了以下结果:

enter image description here

注意:
有很多注释类型(CalloutAnnotationEllipseAnnotation...),它们有很多属性可以改变样式和行为。您甚至可以设置一个属性以允许注释移动(即 AllowMoving=true)。

通过智能感知或 MSDN 查看注释属性。

关于图表区域内的 MSchart 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11717478/

相关文章:

c# - MSChart Y 轴和 X 轴标签

c# - MS Chart Control :Two X Axis, 一个用于数小时,另一个用于数天(或两者混合)

C# 将 FontDialog 设置为仅显示 TrueType 字体

c# - 微软图表 Winforms。如何去除空白点?

vb.net - 如何从轴添加/删除自定义标签

c# - 许多系列的图表控件宽度

vba - 如何动态更改 Access 图表的行源

c# - 图表处理程序配置中的临时图像目录无效 [C :\Users\user1\Documents\Visual Studio 2010\WebSites\Website1\]

c# - WPF 上的 MSCharts

c# - Web 表单中的 ASP.Net 图表适用于本地系统,不适用于 Web 服务器