如何绑定和显示ajax图表? [英] how to bind and display ajax chart?
本文介绍了如何绑定和显示ajax图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试绑定并在我的网页上显示ajax图表。但是没有显示任何输出。请帮助我。
Hi, I am trying to bind and display ajax chart on my web page. But doesn't shows any out put. Please help me.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class demo2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(@"connectionString);
SqlCommand cmd=new SqlCommand("select Name, Debit, Credit From aTable",con);
SqlDataAdapter da=new SqlDataAdapter (cmd);
da.Fill(dt);
string[] x = new string[dt.Rows.Count];
decimal[] z = new decimal[dt.Rows.Count];
decimal[] y = new decimal[dt.Rows.Count];
for (int i = 0; i < dt.Rows.Count; i++)
{
x[i] = dt.Rows[i][0].ToString();
y[i] = Convert.ToInt32(dt.Rows[i][1]);
z[i] = Convert.ToInt32(dt.Rows[i][2]);
}
BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = y });
BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = z });
BarChart1.CategoriesAxis = string.Join(",", x);
}
}
}
推荐答案
一旦浏览这些链接。
1. 在ASP.Net GridView中显示和绑定AJAX条形图 [ ^ ]
2. ASP.Net AJAX条形图控件:从数据库示例填充 [ ^ ]
添加链接文本以反映文章/质量保证标题。
[/编辑]
Once go through these links.
1. Display and bind AJAX Bar Chart inside ASP.Net GridView[^]
2. ASP.Net AJAX Bar Chart Control: Populate from Database example[^]
Link text added to reflect the Article/QA title.
[/Edit]
这篇关于如何绑定和显示ajax图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文