wpf-devexpress-dot-xpf-dot-charts-dot-continuousnumericscaleoptions-7a14a064.md
Specifies the start point for aligning the scale along the x-axis.
Namespace : DevExpress.Xpf.Charts
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
public NumericStartPoint GridAlignmentStartPoint { get; set; }
Public Property GridAlignmentStartPoint As NumericStartPoint
| 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.
|
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
|
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:
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.
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;
}
}
}
Imports System
Imports System.Collections.ObjectModel
Imports System.Windows
Namespace WpfApp
Partial Public Class MainWindow
Inherits Window
Public ReadOnly Property Data() As ObservableCollection(Of Point)
Public Sub New()
InitializeComponent()
Data = GenerateData(20)
DataContext = Me
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
CNSO.GridAlignmentStartPoint = DevExpress.Xpf.Charts.NumericStartPoint.MinRangeValue
End Sub
Private Sub Button_Click_1(ByVal sender As Object, ByVal e As RoutedEventArgs)
CNSO.GridAlignmentStartPoint = DevExpress.Xpf.Charts.NumericStartPoint.Zero
End Sub
Private Function GenerateData(ByVal pointCount As Integer) As ObservableCollection(Of Point)
Dim res As New ObservableCollection(Of Point)()
Dim generator As New Random(0)
For i As Integer = 0 To pointCount - 1
res.Add(New Point((i), generator.Next(10)))
Next i
Return res
End Function
End Class
End Namespace
<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
ContinuousNumericScaleOptions Class