我正在尝试在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");
}
}
}
}