Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I want to create Pie Chart in ASP.NET C#, Scenario is:
i have one tale in SqlServer
table name : tb_abc
fields:

1 : IsApproved
2 : IsRejected
3 : IsPending

i am taking Yes/No in all these fields.
Now what i want is i want to make a PIE chart which is divided into three. IsApproved,IsRejected,IsPending. i want to show that howmany IsApproved is Yes in Count/Percent , how many IsRejected is Yes in Count/Percent , How many IsPending is Yes in Count/Percent....

Hope you Understand my Question
Please Help...........
Posted
Updated 10-Oct-14 19:02pm
v2
Comments
Member 11014751 15-Oct-14 2:25am    
I have create PIE chart but is only Showing IsApproved value . it is not showing IsRejected & IsPending.....
Member 11014751 15-Oct-14 3:23am    
private void GetChatData()
{
var table = new DataTable();

SqlDataAdapter da = new SqlDataAdapter("SELECT(SELECT Count(IsSubmited) FROM Tb_NewHouseForm WHERE name= '" + lblname.Text + "' AND Submited= 'Yes') As Submited ,(SELECT Count(IsApproved) FROM Tb_NewHouseForm WHERE name= '" + lblname.Text + "' AND IsApproved = 'No') As Approved", sConn);
da.Fill(table);

double[] yValues = { 10, 23.19 };
string[] xValues = { "Submited", "Approved" };
Chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
Chart1.Series["Default"].Points[0].Color = Color.MediumSeaGreen;
Chart1.Series["Default"].Points[1].Color = Color.PaleGreen;
//Chart1.Series["Default"].Points[2].Color = Color.LawnGreen;
Chart1.Series["Default"].ChartType = SeriesChartType.Pie;
Chart1.Series["Default"]["PieLabelStyle"] = "Enable";
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
Chart1.Legends[0].Enabled = true;

}
i am getting two values in Select query Submited & Approved how i put that value in double[] yValues = { "", "" };

please help....

 
Share this answer
 
Comments
Member 11014751 15-Oct-14 1:00am    
This is not Helping me
Sergey Alexandrovich Kryukov 15-Oct-14 1:41am    
This is because you are not trying to help yourself, don't want to pay sufficient effort, think.
At least you could explain what did you try and what went wrong.
—SA
Member 11014751 15-Oct-14 1:36am    
I have create PIE chart but is only Showing IsApproved value . it is not showing IsRejected & IsPending.....
Sergey Alexandrovich Kryukov 15-Oct-14 1:40am    
What difference can it make? Please show whatever you want to show...
—SA
Sergey Alexandrovich Kryukov 15-Oct-14 1:40am    
My 5.
—SA
 
Share this answer
 
Comments
Member 11014751 15-Oct-14 1:36am    
I have create PIE chart but is only Showing IsApproved value . it is not showing IsRejected & IsPending.....
Sergey Alexandrovich Kryukov 15-Oct-14 1:39am    
What difference can it make? Please show whatever you want to show...
—SA
Member 11014751 15-Oct-14 3:24am    
private void GetChatData()
{
var table = new DataTable();

SqlDataAdapter da = new SqlDataAdapter("SELECT(SELECT Count(IsSubmited) FROM Tb_NewHouseForm WHERE name= '" + lblname.Text + "' AND Submited= 'Yes') As Submited ,(SELECT Count(IsApproved) FROM Tb_NewHouseForm WHERE name= '" + lblname.Text + "' AND IsApproved = 'No') As Approved", sConn);
da.Fill(table);

double[] yValues = { 10, 23.19 };
string[] xValues = { "Submited", "Approved" };
Chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
Chart1.Series["Default"].Points[0].Color = Color.MediumSeaGreen;
Chart1.Series["Default"].Points[1].Color = Color.PaleGreen;
//Chart1.Series["Default"].Points[2].Color = Color.LawnGreen;
Chart1.Series["Default"].ChartType = SeriesChartType.Pie;
Chart1.Series["Default"]["PieLabelStyle"] = "Enable";
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
Chart1.Legends[0].Enabled = true;

}
i am getting two values in Select query Submited & Approved how i put that value in double[] yValues = { "", "" };

please help....
Sergey Alexandrovich Kryukov 15-Oct-14 3:37am    
How is that related to the chart? Chart is just graphics, nothing else.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900