New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms Sparkline

1. To start using the RadSparkLine first you need to place the control on the form. By default the control should look like a regular panel.

WinForms RadSparkline Sample

2. Once the control is on the form go to the code behind and create a new SparkBarSeries.

Adding SparkBarSeries to RadSparkline

private void SparklineCode_Load(object sender, EventArgs e)
    var series = new SparkBarSeries();
    series.CategoryMember = "Category";
    series.ValueMember = "Values";
    series.DataSource = GetData();
    series.ShowHighPointIndicator = true;
    series.ShowLowPointIndicator = true;
    radSparkline1.Series = series;

Private Sub SparklineCode_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim series = New SparkBarSeries()
    series.CategoryMember = "Category"
    series.ValueMember = "Values"
    series.DataSource = GetData()
    series.ShowHighPointIndicator = True
    series.ShowLowPointIndicator = True
    radSparkline1.Series = series
End Sub

3. Here is the method that returns the sample data as well.

Sample Data

public static DataTable GetData()
    DataTable table = new DataTable();
    table.Rows.Add(1, "John");
    table.Rows.Add(3, "Adam");
    table.Rows.Add(5, "Peter");
    table.Rows.Add(12, "Sam");
    table.Rows.Add(6, "Paul");
    return table;

Public Shared Function GetData() As DataTable
    Dim table As New DataTable()
    table.Rows.Add(1, "John")
    table.Rows.Add(3, "Adam")
    table.Rows.Add(5, "Peter")
    table.Rows.Add(12, "Sam")
    table.Rows.Add(6, "Paul")
    Return table
End Function

4. The RadSparkline now shows the data and indicates the high an low points.

WinForms RadSparkline SparkBarSeries

Telerik UI for WinForms Learning Resources

In this article