New to Telerik UI for WPF? Download free 30-day trial

Set MinXValue and MaxXValue When DateTime Values are Used in RadSparkline

Environment

Product Version 2019.3.917
Product RadSparkline for WPF

Description

How to set the minimum (MinXValue) and maximum (MaxXValue) when DateTime values are plotted on the horizonal axis.

Solution

To define the range manually, set the AutoRange property of RadSparkline to False. Then set the MinXValue and MaxXValue properties. To make this work with DateTime values, you will need to use the Ticks of the DateTime objects used as minimum and maximum of the range.

this.radSparkline.AutoRange = false; 
this.radSparkline.MinXValue = minDateTime.Ticks; 
this.radSparkline.MaxXValue = maxDateTime.Ticks; 
In this article