Jump to content
Software FX Community

How to bind Data to Pie Chart


radhi

Recommended Posts

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.StoredProcedure

comm.Parameters.Add("city", Data.SqlDbType.NVarChar).Value = city

comm.Parameters(0).Direction = Data.ParameterDirection.Input

da = 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"

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...