Version

Defining the XamSparkline Type

Purpose

This topic explains, with code examples, how to define the XamSparkline™ type. There are individual sections about specifying the Win/Loss type because of the special requirements of this Sparkline type.

Required Background

The following table lists the topic 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.

Defining the Sparkline Type

Overview

The XamSparkline control supports the following types of Sparklines

  • Line

  • Area

  • Column

  • Win/Loss

The type is defined by the setting of the DisplayType property . If the DisplayType property property is not specified, by default, the Line type is displayed.

Property settings

The following table maps the Sparkline types to the property settings that configure them.

Desired XamSparkline type Set the DisplayType property to:

Line

Area

Column

WinLoss

Example

The screenshot below the table demonstrates a Sparkline defined with the following settings:

Property Value

Column

Define Sparkline Types 1.png

Code

The following code demonstrates setting the display type of the Sparkline to Column . In XAML:

<ig:XamSparkline Name="XamSparkline1" DisplayType="Column"/>

In C#:

this.XamSparkline1.DisplayType = SparklineDisplayType.Column;

In Visual Basic:

Me.XamSparkline1.DisplayType = SparklineDisplayType.Column

Defining a Sparkline of Win/Loss Type

Overview

The Win/Loss type is a column chart type, in which the value of each column is equal to either the positive maximum (for positive values) or the negative minimum (for negative minimum) of the data set, often denoting a win or a loss (or similar opposing concepts). For the Win/Loss chart to display properly, the data set must have both positive and negative values.

If the Win/Loss type is bound to the same data as the other types such as the Line type (which can be bound to a collection of numeric values), then XamSparkline will select two values from the collection – the highest and the lowest – and will render the Sparkline based on those values.

For example, if all Sparkline types are bound to the same data source as follows:

Records Values

Record 1

2

Record 2

5

Record 3

-1

Record 4

4

Record 5

-3

The Win/Loss type will pick only two values from the entire data source, the highest (5) and the lowest (-3) , then it will plot all positive data points identical to the highest value and all negative data points identical to the lowest value.

Property settings

The following table demonstrates the property setting for setting a Sparkline of Win/Loss type to property setting that specifies it.

In order to: Use this property: And set it to:

Set the Sparkline type to Win/Loss

WinLoss

Example

The screenshot below demonstrates how the Sparkline looks as a result of the following settings:

Property Value

WinLoss

sparkline overview 4.png

Code

The following code demonstrates setting the display type for XamSparkline to WinLoss . In XAML:

<ig:XamSparkline Name="XamSparkline1" DisplayType="WinLoss"/>

In C#:

this.XamSparkline1.DisplayType = SparklineDisplayType.WinLoss;

In Visual Basic:

Me.XamSparkline1.DisplayType = SparklineDisplayType.WinLoss

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

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

This topic explains the featured properties of the XamSparkline control.