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.
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.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;
}
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.
Telerik UI for WinForms Learning Resources
- Telerik UI for WinForms Sparkline Component
- Getting Started with Telerik UI for WinForms Components
- Telerik UI for WinForms Setup
- Telerik UI for WinForms Application Modernization
- Telerik UI for WinForms Visual Studio Templates
- Deploy Telerik UI for WinForms Applications
- Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)
- Telerik UI for WinForms License Agreement)