radhi Posted August 26, 2008 Report Share Posted August 26, 2008 Hi, how can i bind the data from stored procedure(stored procedure is creatred in sqlserver2000) to pie . Iam using chartfx 7 and Visual studio 2005 Thanks Radhi Quote Link to comment Share on other sites More sharing options...
Frank Posted August 26, 2008 Report Share Posted August 26, 2008 The same way you bind any other type of chart. The wizard will guide you through it. Each numeric column in your resultset will generate a Pie and there will be one slice for each record (row). Quote Link to comment Share on other sites More sharing options...
radhi Posted August 26, 2008 Author Report Share Posted August 26, 2008 Thank you. I am trying to bind the data dynamically and the sored procedure takes a parameter . here is my sample code: comm = New SqlCommand() sqlConn.Open() comm.CommandText = "usp_Sandwichsite"comm.Connection = sqlConn comm.CommandType = Data.CommandType.StoredProcedurecomm.Parameters.Add("city", Data.SqlDbType.NVarChar).Value = city comm.Parameters(0).Direction = Data.ParameterDirection.Inputda = New SqlDataAdapter(comm)ds = New Data.DataSet("tabl") da.Fill(ds) Chart1.DataSourceSettings.Fields.Add( New FieldMap("rooms", FieldUsage.XValue))Chart1.DataSourceSettings.Fields.Add(New FieldMap("func", FieldUsage.Value))Chart1.DataSourceSettings.Fields.Add(New FieldMap("maxused", FieldUsage.XValue)) Chart1.DataSourceSettings.DataSource = ds.tables(0).DefaultView Chart1.DataBind() when i execute the above code i get "No Data is available" Quote Link to comment Share on other sites More sharing options...
radhi Posted August 26, 2008 Author Report Share Posted August 26, 2008 thank you , i found the solution to my problem . I have another question . My stored procedure returns 3 columns(Func, Rooms, Maxused) . because of this, there are two pie charts that gets displayed - One func vs rooms and another Maxused Vs Func Now i want only one pie chart(Func Vs Maxused) and the rooms should be displayed as lablel next to func .How can I acheive this Thanks in Advance Radhi Quote Link to comment Share on other sites More sharing options...
Frank Posted August 27, 2008 Report Share Posted August 27, 2008 You must add the values (the column that gives the pie slice its size) as FieldUsage.Value and the labels as FieldUsage.Label. Quote Link to comment Share on other sites More sharing options...
radhi Posted August 27, 2008 Author Report Share Posted August 27, 2008 Thank you , It is working Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.