Sparkline for WPF
In This Topic
    Data Binding
    In This Topic

    Data forms the core for any data visualization control. The Sparkline control can easily bind to any enumerable collection of data values i.e. to any class that implements the IEnumerable interface or the INotifyCollectionChanged interface to support data modification after binding. 

    You can populate the sparkline using the Data property.

    C#
    Copy Code
    sparkline.Data = new List<double> { 5, 6, 2, 12 };
    

    Additionally, Sparkline supports a date axis which can be bound to a collection of dates that acts as x-coordinates using the DateAxisData property.

    C#
    Copy Code
    sparkline.DateAxisData = new List<DateTime> { new DateTime(2022, 1, 1), new DateTime(2022, 1, 2), new DateTime(2022, 1, 3) };
    

    For a complete sample on how to bind Sparkline to a data source, see Bind to Data Source section in the Quick Start topic.