Skip to main content
A newer version of this page is available. .

How to: Obtain Automatically Calculated Axis Property Values

  • 2 minutes to read

This example demonstrates how to obtain axis parameters, which are calculated automatically, for example, in ContinuouslDateTimeScale mode.

To do this, handle the ChartControl.AxisScaleChanged event. In the event handler, it is possible to obtain axis parameters using the AxisScaleChangedEventArgs.Axis property. In this example, the property is cast to the ContinuouslDateTimeScale type and its ContinuousDateTimeScaleOptions.GridSpacing and ContinuousDateTimeScaleOptions.GridAlignment properties are used.

View Example

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ValuesOfDateTimeScale"
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" x:Class="ValuesOfDateTimeScale.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>

        <dxc:ChartControl x:Name="ChartControl" AxisScaleChanged="ChartControl_AxisScaleChanged">
            <dxc:ChartControl.Legend>
                <dxc:Legend/>
            </dxc:ChartControl.Legend>
            <dxc:XYDiagram2D>
                <dxc:BarSideBySideSeries2D DisplayName="Series 1">
                    <dxc:SeriesPoint Argument="08/01/2005" Value="6.5"/>
                    <dxc:SeriesPoint Argument="09/01/2005" Value="4.4"/>
                    <dxc:SeriesPoint Argument="10/01/2005" Value="7.1"/>
                    <dxc:SeriesPoint Argument="11/01/2005" Value="6.5"/>
                    <dxc:SeriesPoint Argument="12/01/2005" Value="6.5"/>

                    <dxc:SeriesPoint Argument="08/01/2006" Value="6.9"/>
                    <dxc:SeriesPoint Argument="09/01/2006" Value="4.4"/>
                    <dxc:SeriesPoint Argument="10/01/2006" Value="4.1"/>
                    <dxc:SeriesPoint Argument="11/01/2006" Value="2.9"/>
                    <dxc:SeriesPoint Argument="12/01/2006" Value="3.5"/>

                    <dxc:SeriesPoint Argument="08/01/2007" Value="6.9"/>
                    <dxc:SeriesPoint Argument="09/01/2007" Value="5.4"/>
                    <dxc:SeriesPoint Argument="10/01/2007" Value="3.9"/>
                    <dxc:SeriesPoint Argument="11/01/2007" Value="4.9"/>
                    <dxc:SeriesPoint Argument="12/01/2007" Value="3.5"/>
                </dxc:BarSideBySideSeries2D>
            </dxc:XYDiagram2D>
        </dxc:ChartControl>

    </Grid>
</Window>