Sparkline for WPF
In This Topic
    Sparkline Types
    In This Topic

    The Sparkline control supports three different sparkline types, namely Line, Column, and Winloss, for visualizing data in different contexts. For example, Line charts are suitable to visualize continuous data, while Column sparklines are used in scenarios where data comparison is involved. Similarly, a Win-Loss sparkline is best used to visualize a true-false (that is, win-loss) scenario.

    The different sparkline types are explained in greater detail in the following table:

    SparklineType Description

    Line

    Displays Line Sparkline.
    A line sparkline consists of data points connected by line segments. It is best suited for visualizing continuous data and can be used to visualize sales figures, stock values, or website traffic. By default, Sparkline renders as a line sparkline.

    Column

    Displays Column Sparkline.
    Each data point in this type of sparkline is depicted as a vertical rectangle/column. In a column sparkline, positive data points are drawn in upward direction, while negative data points are drawn in downward direction. Column sparklines are used to facilitate comparison and are best suited for visualizing categorical data. For example, to visualize the revenues/profits earned from different departments in a store.

    WinLoss

    Displays WinLoss Sparkline.
    WinLoss sparkline displays data points through equal-sized columns drawn in upward and downward directions. The winloss sparkline is only concerned with whether a data point is positive or negative, it does not take the relative value of the data point into account. It is used to visualize a win/loss scenario. Columns drawn in upward direction indicate a win, while downward columns indicate a loss. For example, winloss sparkline can be used to track a sports season.

    Set Sparkline Type

    By default, a sparkline is rendered as a line sparkline. But, you can use SparklineType property of the C1Sparkline class to set other type of sparkline. The SparklineType property uses the SparklineType enumeration to set the one of the sparkline types

    To set the chart type for Sparkline, use the SparklineType property to set a specific chart type using the following code.

    <c1:C1Sparkline x:Name="sparkline" SparklineType="Column" Height="250" Width="250"  />
    
    sparkline.SparklineType = SparklineType.Column;