我正在尝试在 asp.net 中创建一个简单的图表。我有一个 SQL 查询,但不知道如何设置它来填充图表。我有一个定义为 ChartDefaultPageOpenTickets 的图表。我想将我的数据集设置为图表,以便用 x 轴上的状态和 y 轴上的打开票证总数填充图表。
namespace StatusTrackerWeb
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
string query = "";
DataTable data = new DataTable();
data.Columns.Add("Status");
data.Columns.Add("Total");
//get a list of all open tickets by status
query = "SELECT status, count(ticketnumber) FROM maintable GROUP BY status HAVING status IN ('New','In Progress - Review','In Progress - Scripting','In Progress - Execution','To Be Closed','Waiting- App Team', 'Waiting - Results Review')";
DataSet allopenticketdata = br_common_functions.GetDataSet(query);
}
}
catch (System.Threading.ThreadAbortException)
{
//dont do anything
}
catch (System.Exception ex)
{
Session["error_string"] = ex.Message;
Session["stack_trace_string"] = ex.StackTrace.ToString();
Page.Response.Redirect("~/ErrorPage.aspx");
}
}
}
}