than use
System.Web.UI.DataVisualization.Charting
System.Web.DataVisualization
SqlConnection cot = new SqlConnection(Your Connection String);
SqlCommand cmt = new SqlCommand("Select * your synatx", cot);
cot.Open();
SqlDataAdapter dat = new SqlDataAdapter(cmt);
DataSet ds = new DataSet();
dat.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Chart1.Series["Series1"]["PointWidth"] = "0.5";// Show data points labels
Chart1.Series["Series1"].IsValueShownAsLabel = true;// Set data points label style
Chart1.Series["Series1"]["BarLabelStyle"] = "Center";// Show chart as 3D
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;// Draw chart as 3D Cylinder
Chart1.Series["Series1"]["DrawingStyle"] = "Cylinder";
// Define the database query
//string mySelectQuery = "SELECT CampaignName,TotalEmails FROM Campaign";
SqlConnection con = new SqlConnection(Your Connection String);
SqlCommand cmd = new SqlCommand("SELECT xxx,yyy from tablename", con);
Chart1.DataSource = cmd;
Chart1.Series["Series1"].XValueMember = "xxx";
Chart1.Series["Series1"].YValueMembers = "yyy";
Chart1.DataBind();
}
else
{
Chart1.Visible = false;
}
No comments:
Post a Comment