2012-04-02 76 views

回答

1

看一看下面的例子,你要寻找的方法是callled - AddXY:

using System; 
using System.Collections.Generic; 
using System.Web.UI.DataVisualization.Charting; 

namespace WebApplication1 
{ 
    public partial class WebForm1 : System.Web.UI.Page 
    { 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      Dictionary<int, string> employees = new Dictionary<int, string>(); 

      employees.Add(10, "Product A"); 
      employees.Add(20, "Product B"); 
      employees.Add(30, "Product C"); 

      Chart1.Series[0].ChartType = SeriesChartType.Bar; 

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

ASP.NET MS Chart control