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.
The following table lists the topic required as a prerequisite to understanding this topic.
This topic contains the following sections:
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.
The following table maps the Sparkline types to the property settings that configure them.
The screenshot below the table demonstrates a Sparkline defined with the following settings:
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
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:
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.
The following table demonstrates the property setting for setting a Sparkline of Win/Loss type to property setting that specifies it.
The screenshot below demonstrates how the Sparkline looks as a result of the following settings:
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
The following topics provide additional information related to this topic.