using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SoftwareFX.ChartFX.Internet.Server;
public partial class stu : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Chart chart1 = new Chart();
Panel1.Controls.Add(chart1);
DataTable dt = new DataTable();
DataColumn dc = new DataColumn();
DataRow dr;
dt.Columns.Add("姓名",typeof(System.String));
dt.Columns.Add("语文", typeof(System.String));
dt.Columns.Add("数学", typeof(System.String));
dt.Columns.Add("英语", typeof(System.String));
dt.Columns.Add("化学", typeof(System.String));
dr = dt.NewRow();
dr[0] = " 张三";
dr[1] = "77";
dr[2] = "90";
dr[3] = "66";
dr[4] = "61";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = " 王五";
dr[1] = "89";
dr[2] = "78";
dr[3] = "97";
dr[4] = "72";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = " 小张";
dr[1] = "78";
dr[2] = "80";
dr[3] = "86";
dr[4] = "73";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = " 小明";
dr[1] = "75";
dr[2] = "70";
dr[3] = "45";
dr[4] = "68";
dt.Rows.Add(dr);
chart1.Gallery = SoftwareFX.ChartFX.Gallery.Bar;
chart1.Stacked = SoftwareFX.ChartFX.Stacked.Normal;
// Populating the chart1 with random data
chart1.OpenData(SoftwareFX.ChartFX.COD.Values,dt.Columns.Count-1,dt.Rows.Count);
System.Random r;
int i, j;
r = new System.Random();
for (i = 0; i < dt.Columns.Count - 1; i++){
for (j = 0; j < dt.Rows.Count; j++){
chart1.Value[i, j] = Convert.ToDouble(dt.Rows[j][i+1]);
chart1.KeyLeg[i] = dt.Rows[i][0].ToString();
}
//chart1.SerLeg[i] = dt.Columns[j].ColumnName;
}
chart1.DataEditor = true;
chart1.LegendBox = true;
chart1.CloseData(SoftwareFX.ChartFX.COD.Values);
}
}