RangeControl
- 3 minutes to read
Overview
The RangeControl is used to select and visualize data ranges.
The RangeControl offers the following features.
Client approach
The RangeControl comes with a variety of range control clients. A range control client is a special class that provides data for the RangeControl and handles data visualization. To specify the required client, use the RangeControl.Client property. The following clients are available out-of-the-box.
- DateTimeChartRangeControlClient
- TimeSpanChartRangeControlClient
- NumericChartRangeControlClient
- SchedulerRangeControlClient
- CalendarClient
To create a custom range control client, implement the IRangeControlClient interface.
Touch support
The RangeControl supports the following touch gestures.
- Pinch and stretch (zooming in and out)
- Pan (horizontal scrolling)
- Hold and pan (moving the selection)
Navigation buttons
The navigation buttons are automatically displayed when the selected range does not fit in the visible range. The RangeControl.ShowNavigationButtons property toggles the visibility of the navigation buttons.
Declaration
This example demonstrates how to use the date-time chart client for a range control to display a chart with date-time data within the range control’s viewport.
In this example a date-time chart range control client is bound to a System.Collections.Generic.List containing DateTimeItem objects.
Each DateTimeItem object contains Argument and Value properties, to which a date-time chart range control client is bound via its ChartRangeControlClient.ArgumentDataMember and ChartRangeControlClient.ValueDataMember properties.
See also:
- How to: Bind a Numeric Chart Range Control Client to an Array of Simple Type Objects;
- How to: Bind a Numeric Chart Range Control Client to a List of Custom Objects.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-bind-a-date-time-chart-range-control-client-to-a-list-of-custom-objects-e5111.
Imports System
Imports System.Collections.Generic
Imports System.Windows
Namespace DateTimeChartRangeControlClient
Public Class DateTimeItem
Public Property Argument() As Object
Public Property Value() As Object
End Class
Partial Public Class MainWindow
Inherits Window
Private Const dataCount As Integer = 100
Private data As New List(Of DateTimeItem)()
Private Function GenerateDateTimeData() As List(Of DateTimeItem)
Dim now As Date = Date.Now.Date
Dim rand As New Random()
Dim value As Double = 0
For i As Integer = 0 To dataCount - 1
now = now.AddDays(1)
value += (rand.NextDouble() - 0.5)
data.Add(New DateTimeItem() With {.Argument = now, .Value = value + Math.Sin(i * 0.6)})
Next i
Return data
End Function
Public Sub New()
InitializeComponent()
Me.DataContext = GenerateDateTimeData()
End Sub
End Class
End Namespace