views:

20

answers:

1

alt text

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

A: 

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}");
FiveTools