New to Telerik UI for WinFormsStart a free 30-day trial

Data Binding

Updated over 6 months ago

You can directly bind your preferred series to your data, the currently supported data sources are:

  • IList interface for one-dimensional arrays.

  • IListSource interface (like DataTable and DataSet classes).

  • IBindingList interface. For example the generic BindingList class.

  • IBindingListView interface. For example BindingSource class.

To bind the series you need to set the ValueMember property. The following example demonstrates this.

Bind Series to a DataTable

C#
DataTable table;
public void AddBoundSeries()
{
    table = new DataTable();
    table.Columns.Add("Value", typeof(double));
    table.Rows.Add(1);
    table.Rows.Add(-3);
    table.Rows.Add(5);
    table.Rows.Add(1);
    table.Rows.Add(6);
    table.Rows.Add(-1);
    table.Rows.Add(3);
    table.Rows.Add(-5);
    table.Rows.Add(1);
    table.Rows.Add(6);
    SparkLineSeries lineSeries = new SparkLineSeries();
    lineSeries.ValueMember = "Value";
    lineSeries.DataSource = table;
    lineSeries.ShowMarkers = true;
    lineSeries.ShowHighPointIndicator = true;
    lineSeries.ShowLowPointIndicator = true;
    radSparkline1.Series = lineSeries;
}

The bellow image show the result from the above code.

WinForms RadSparkline Data Binding DataTable

Not finding the help you need?
Contact Support