1
如何顯示asp.net圖表的標籤?我附上了一個示例圖表。我怎樣才能定義產品A,B等? 如何爲asp.net圖表創建標籤?
如何顯示asp.net圖表的標籤?我附上了一個示例圖表。我怎樣才能定義產品A,B等? 如何爲asp.net圖表創建標籤?
看一看下面的例子,你要尋找的方法是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);
}
}
}
}