Skip to main content
All docs
V24.1

ContinuousNumericScaleOptions.GridAlignmentStartPoint Property

Specifies the start point for aligning the scale along the x-axis.

Namespace: DevExpress.Xpf.Charts

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

NuGet Package: DevExpress.Wpf.Charts

Declaration

public NumericStartPoint GridAlignmentStartPoint { get; set; }

Property Value

Type Description
NumericStartPoint

The start point for aligning the scale along the x-axis.

Available values:

Name Description
Zero

The alignment of the chart x-axis scale starts at zero.

MinRangeValue

The alignment of the chart x-axis scale starts at the specified Range.MinValue property value.

Property Paths

You can access this nested property as listed below:

Object Type Path to GridAlignmentStartPoint
AxisY2D
.NumericScaleOptions .GridAlignmentStartPoint
AxisY3D
.NumericScaleOptions .GridAlignmentStartPoint
CircularAxisY2D
.NumericScaleOptions .GridAlignmentStartPoint
ZAxis3D
.NumericScaleOptions .GridAlignmentStartPoint

Remarks

The example below illustrates the use of the GridAlignmentStartPoint property.

When you select the NumericStartPoint.Zero property value, the x-axis scale alignment starts at zero:

Align the scale from the zero point

When you select NumericStartPoint.MinRangeValue property value, the x-axis scale alignment starts at the specified Range.MinValue property value. The MinValue property of the chart below is set to 1.

Align the scale from the min range value

The following code configures the axis scale settings to resemble the chart above:

using System;
using System.Collections.ObjectModel;
using System.Windows;

namespace WpfApp {

    public partial class MainWindow : Window {

        public ObservableCollection<Point> Data { get; }

        public MainWindow() {
            InitializeComponent();
            Data = GenerateData(20);
            DataContext = this;
        }

        private void Button_Click(object sender, RoutedEventArgs e) {
            CNSO.GridAlignmentStartPoint = DevExpress.Xpf.Charts.NumericStartPoint.MinRangeValue;
        }

        private void Button_Click_1(object sender, RoutedEventArgs e) {
             CNSO.GridAlignmentStartPoint = DevExpress.Xpf.Charts.NumericStartPoint.Zero;
        }
        ObservableCollection<Point> GenerateData(int pointCount) {
            ObservableCollection<Point> res = new ObservableCollection<Point>();
            Random generator = new Random(0);
            for(int i = 0; i < pointCount; ++i)
                res.Add(new Point((i), generator.Next(10)));
            return res;
        }
    }
}
<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:WpfApp10"
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" x:Class="WpfApp.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <dxc:ChartControl>
            <dxc:XYDiagram2D>
                <dxc:XYDiagram2D.AxisX>
                    <dxc:AxisX2D x:Name="AX">
                        <dxc:AxisX2D.WholeRange>
                            <dxc:Range MinValue="1" StartSideMargin="0" EndSideMargin="0"/>
                        </dxc:AxisX2D.WholeRange>
                        <dxc:AxisX2D.NumericScaleOptions>
                            <dxc:ContinuousNumericScaleOptions x:Name="CNSO" AutoGrid="False" GridSpacing="1" GridAlignment="1.31"/>
                        </dxc:AxisX2D.NumericScaleOptions>
                    </dxc:AxisX2D>
                </dxc:XYDiagram2D.AxisX>
                <dxc:BarSideBySideSeries2D DataSource="{Binding Data}" ArgumentDataMember="X" ValueDataMember="Y"/>
            </dxc:XYDiagram2D>
        </dxc:ChartControl>
        <Button Content="MinRangeValue" HorizontalAlignment="Left" Margin="80,0,0,0" VerticalAlignment="Top" Width="107" Click="Button_Click"/>
        <Button Content="Zero" HorizontalAlignment="Left" Margin="231,0,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1" RenderTransformOrigin="-2.68,-4.142"/>
    </Grid>
</Window>
See Also