Friday, August 3

How to Create a Pie Chart in

Here, i am discussing about , how to create a pie chart in

Step-1: My database Overview.

Step-2: Insert your values into your table.
Step-3: Then add a chart control to your page.

<asp:Chart ID="Chart1" runat="server">
<asp:Series Name="Series1" ChartType="Pie">
<asp:ChartArea Name="ChartArea1">
Step-4: Then add this code behind method to your page and call this method whenever you want to load your chart.

protected void Load_Chart()
SqlConnection con = new SqlConnection("------- Your connection string--------“);
SqlCommand com;
com = new SqlCommand("select ProjectTitle,ProgressPercentage from Project", con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(com);
Chart1.DataSource = dt;
Chart1.Series[0].XValueMember = "ProjectTitle";
Chart1.Series[0].YValueMembers = "ProgressPercentage";
Chart1.Series[0].ToolTip = "Completed : " + "#PERCENT";//--Used to show tooltip
Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
Step-5: The final output:
Here is My Output with ToolTips:

Thanks Shibashish Mohanty

No comments:

Post a Comment

Please don't spam, spam comments is not allowed here.

shibashish mohanty