# Getting Started with WinForms Sparkline

This tutorial will help you to quickly get started using the control.

## Adding Telerik Assemblies Using NuGet

To use `RadSparkline` when working with NuGet packages, install the `Telerik.UI.for.WinForms.AllControls` package. The [package target framework version may vary](https://www.telerik.com/products/winforms/documentation/visual-studio-integration/available-nugets).

Read more about NuGet installation in the [Install using NuGet Packages](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/install-using-nuget) article.

> tip With the 2025 Q1 release, the Telerik UI for WinForms has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/winforms/documentation/licensing/license-key).

## Adding Assembly References Manually

When dragging and dropping a control from the Visual Studio (VS) Toolbox onto the Form Designer, VS automatically adds the necessary assemblies. However, if you're adding the control programmatically, you'll need to manually reference the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.WinControls**
* **Telerik.WinControls.UI**
* **TelerikCommon**

The Telerik UI for WinForms assemblies can be install by using one of the available [installation approaches](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/installing-on-your-computer).

## Defining the RadSparkline

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](https://www.telerik.com/products/winforms/documentation/assets/1c88243c27a408dc49a3169ed385c1e0/sparkline-getting-started001.png)

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

#### Adding SparkBarSeries to RadSparkline

```C#
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;

}
```

```VB.NET
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

```C#
public static DataTable GetData()
{
    DataTable table = new DataTable();

    table.Columns.Add("Values");
    table.Columns.Add("Category");

    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;
}
```

```VB.NET
Public Shared Function GetData() As DataTable
    Dim table As New DataTable()

    table.Columns.Add("Values")
    table.Columns.Add("Category")

    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](https://www.telerik.com/products/winforms/documentation/assets/fb0627e0f8e6844805f6c5ca2951f5df/sparkline-getting-started002.png)

## Telerik UI for WinForms Learning Resources

* [Telerik UI for WinForms Sparkline Component](https://www.telerik.com/products/winforms/sparkline.aspx)
* [Getting Started with Telerik UI for WinForms Components](https://docs.telerik.com/devtools/winforms/getting-started/first-steps)
* [Telerik UI for WinForms Setup](https://docs.telerik.com/devtools/winforms/installation-and-upgrades/installing-on-your-computer)
* [Telerik UI for WinForms Converter](https://www.telerik.com/products/winforms/documentation/ai-coding-assistant/converter/converter)
* [Telerik UI for WinForms Visual Studio Templates](https://docs.telerik.com/devtools/winforms/visual-studio-integration/visual-studio-templates)
* [Deploy Telerik UI for WinForms Applications](https://docs.telerik.com/devtools/winforms/deployment-and-distribution/application-deployment)
* [Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/17/telerik-ui-for-winforms)
* [Telerik UI for WinForms License Agreement)](https://www.telerik.com/purchase/license-agreement/winforms-dlw-s)
