I tried to bind chart to generatedSequence
of type List<float>
. How to update chart control after binding?
I tried this but with no luck:
chart1.DataSource = new BindingList<float>(chartSequence);
chart1.DataBind();
chart1.Update();
Simple data binding is the type of binding typical for controls such as a TextBox control or Label control, which are controls that typically only display a single value. In fact, any property on a control can be bound to a field in a database. There's extensive support for this feature in Visual Studio.
The ASP.NET Chart Control provides flexible data binding options that allow you to bind to a table from a database or a collection created in code. The control also includes a built-in chart wizard that is invoked at design time, to assist in chart configuration.
Don't forget set DataSource property of Series in chart property.
Set XValueMember
and YValueMembers
from code:
chart1.Series.First().XValueMember = "X";
chart1.Series.First().YValueMembers = "Y";
Tutorial: Creating a Basic Chart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With