Version

Adding XamSparkline

Purpose

This topic explains conceptually how to add the XamSparkline control and introduces to the available adding options.

Required background

The following table lists the materials required as a prerequisite to understanding this topic.

Topic Purpose

This topic provides an overview of the XamSparkline control, its benefits, and the supported chart types.

This topic provides an overview of the possible ways to configure the XamSparkline control. Links to the detailed configurations (available in separate topics) are provided as well.

Adding a Sparkline

Introduction

Sparkline can be displayed in WPF application as a stand-alone control, in small spaces such as grid cells, or in-line with text. The XamSparkline control can be added through XAML, as well as in-code.

In order to determine what data is to be displayed, you need a data source with at least two numeric fields in the class as the data points. This is handled by the ItemsSource and ValueMemberPath properties, respectively. These are the minimum set of properties you need to configure for the XamSparkline control.

The project requirements for adding the XamSparkline control include adding assembly references and namespaces as well as some data requirements.

The XamSparkline supports any one-dimensional data source, as long as the data contains at least two numeric fields in order to render the chart.

Requirements

Add the following NuGet package references to your main project:

  • Infragistics.WPF.Sparkline

For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

Also, add the following Infragistics namespaces:

In XAML:

xmlns:ig="http://schemas.infragistics.com/xaml"

In C#:

using Infragistics.Controls.Charts;

In VB:

Imports Infragistics.Controls.Charts

Final requirement to create XamSparkline control, is one-dimensional data that contains numeric values. Note: With the Win/Loss display type of Sparkline, only two values will be used for the chart – the highest one and the lowest one. The rest of the values in the data set will be ignored.

Options for adding the XamSparkline control

The following table lists the ways in which you can add the XamSparkline control.

Example Description

You can add the XamSparkline control directly to a Page using one-dimensional data.

You can add the XamSparkline control to xamGrid™ cells using the Sparkline column type.

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains the featured properties of the XamSparkline control.

This topic introduces the Sparkline column type of the xamGrid control and demonstrates its use.