ASP .net Bar chart Drawing

[.aspx]

<fieldset>
<legend>Result Status</legend>
<div align="center">
<asp:Chart ID="ChartSummary" runat="server" Height="306px" Width="489px">
<Series>
<asp:Series Name="Series1">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<AxisX Title="Marks Range">
</AxisX>
<AxisY Title="No. of Student">
</AxisY>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
</div>
</fieldset>

[.aspx.cs]

private void viewSummary(String param)
{
string qs = "select * from dbo.fn_CenteralVivaGraphical('" + param + "')"; // table valued function call with passing parameter
DataSet ds = new DataSet();
ds = ClsCommon.GetAdhocResult(qs);
DataTable dt = new DataTable();
dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
ChartSummary.DataSource = dt; // data bind and drawing at drawing control
ChartSummary.DataBind();
ChartSummary.Series["Series1"].XValueMember = "Ranger";
ChartSummary.Series["Series1"].YValueMembers = "StudentCount";
gvwCenteralViva.Visible = true;
btnSubmit.Visible = true;
ChartSummary.Visible = true;
}
else
{
ChartSummary.Visible = false;
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s