[英]set labels on datapoints using mschart
I would like to customize the labels on the datapoints below so they would render as (using first datapoint on the chart as an example) : 我想在下面的数据点上自定义标签,以便将它们呈现为(以图表上的第一个数据点为例):
4:10 - 4:40 yellow class 4:10-4:40黄色课
Datapoint has a label property that can be set programatically: Datapoint具有label属性,可以通过编程设置:
DataPoint dp = new DataPoint();
dp.Label = c.Start.ToShortTimeString() + " - " + c.End.ToShortTimeString() + "\n" + c.Class;
You can iterate through the datapoints in a series after databinding: 绑定数据后,可以依次遍历一系列数据点:
foreach (DataPoint d in Chart1.Series[0].Points)
{
d.Label = "somevalue";
}
Or you can set the values when you databind: 或者,您可以在数据绑定时设置值:
Chart1.Series[0].Points.DataBind(datasource, "xField", "yField", "Label={somevalue}");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.