开发者

set labels on datapoints using mschart

开发者 https://www.devze.com 2023-01-19 08:40 出处:网络
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) :

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

精彩评论

暂无评论...
验证码 换一张
取 消