Skip to main content

DateTimeChartRangeControlClient.GridAlignment Property

Gets or sets the date-time measure unit to which the chart’s gridlines and labels should be aligned.

Namespace: DevExpress.Xpf.Charts.RangeControlClient

Assembly: DevExpress.Xpf.Charts.v24.1.dll

NuGet Package: DevExpress.Wpf.Charts

Declaration

public DateTimeGridAlignment GridAlignment { get; set; }

Property Value

Type Description
DateTimeGridAlignment

A DateTimeGridAlignment enumeration value that represents the measurement unit to which the chart’s gridlines and labels should be aligned.

Available values:

Name Description
Millisecond

Specifies a millisecond as the date-time unit to which axis grid lines should be aligned.

Second

Specifies a second as the date-time unit to which axis grid lines should be aligned.

Minute

Specifies a minute as the date-time unit to which axis grid lines should be aligned.

Hour

Specifies an hour as the date-time unit to which axis grid lines should be aligned.

Day

Specifies a day as the date-time unit to which axis gridlines should be aligned.

Week

Specifies a week as the date-time unit to which axis grid lines should be aligned.

Month

Specifies a month as the date-time unit to which axis grid lines should be aligned.

Quarter

Specifies a quarter of a year as the date-time unit to which axis grid lines should be aligned.

Year

Specifies a year as the date-time unit to which axis grid lines should be aligned.

Auto

The date-time unit to which axis gridlines should be aligned is calculated automatically.

Remarks

This setting is in effect if the ChartRangeControlClientBase.ShowGridLines property is set to true.

The following images demonstrate the GridAlignment property in action for the random function.

GridAlignment= Week GridAlignment = Month
DateChartClient_CridAlignment_Week DateChartClient_CridAlignment_Month

Note that the ChartRangeControlClient.GridSpacing property affects GridAlignment, as shown in the images below.

GridAlignment= Week, GridSpacing= 1 GridAlignment = Week, GridSpacing= 3
DateChartClient_CridAlignment_Week DateChartClient_GridAlignment_Week_GridSpacing_3

Example

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:

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

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GridAlignment property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also