开发者

How can I bind an asp:chart (from microsoft) to a Dictionary<string,string>?

开发者 https://www.devze.com 2023-01-10 10:51 出处:网络
I\'m using the MS chart controls for ASP.Net an开发者_开发知识库d I can\'t figure out binding.

I'm using the MS chart controls for ASP.Net an开发者_开发知识库d I can't figure out binding. Does any one have information on how can I bind an asp:chart (from microsoft) to a dictionary?


var employees = new Dictionary<int, string>
{
    {10,"Employee 1"},{20,"Employee 2"},{30,"Employee 3"}
};

Chart1.Series[0].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Bar;

foreach (KeyValuePair<int, string> employee in employees)
    Chart1.Series[0].Points.AddXY(employee.Value, employee.Key);

Output:

How can I bind an asp:chart (from microsoft) to a Dictionary<string,string>?

0

精彩评论

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

关注公众号