I would like to customize the labels on the datapoints below so they would render as (using first datapoint on the chart as an exam开发者_StackOverflow社区ple) :
4:10 - 4:40 yellow class
Datapoint has a label property that can be set programatically:
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}");
精彩评论