Skip to main content
All docs
V23.2

NumericScaleOptions.GridAlignmentStartPoint Property

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

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v23.2.dll

NuGet Package: DevExpress.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
AxisBase
.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 the x-axis scale alignment starts at the specified Range.MinValue property value:

Align the scale from the min range value

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

using DevExpress.XtraCharts;
using System;
using System.Windows.Forms;

namespace ApplicationSample {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }
            private void Form1_Load(object sender, EventArgs e) {
            chart.Series.Add(GenerateSeries(20));

            XYDiagram diagram = chart.Diagram as XYDiagram;
            if (diagram == null) return;

            diagram.AxisX.NumericScaleOptions.ScaleMode = ScaleMode.Manual;
            diagram.AxisX.NumericScaleOptions.AutoGrid = false;
            diagram.AxisX.WholeRange.MinValue = 1;
            diagram.AxisX.NumericScaleOptions.CustomGridAlignment = 1.31;
            diagram.AxisX.NumericScaleOptions.GridAlignment = NumericGridAlignment.Custom;
            diagram.AxisX.WholeRange.SideMarginsValue = 0;
            diagram.AxisY.WholeRange.AlwaysShowZeroLevel = true;
        }
        Series GenerateSeries(int pointCount) {
            Series series = new Series  {
                Name = "Random data",
                View = new SideBySideBarSeriesView()
            };
            Random generator = new Random();
            for (int i = 0; i < pointCount; ++i) {
                series.Points.Add(new SeriesPoint((i), generator.Next(10)));
            }
            return series;
        }

        private void startFromZero_Click(object sender, EventArgs e){
            XYDiagram diagram = chart.Diagram as XYDiagram;
            diagram.AxisX.NumericScaleOptions.GridAlignmentStartPoint = NumericStartPoint.Zero;
        }

        private void startFromMinValue_Click(object sender, EventArgs e){
            XYDiagram diagram = chart.Diagram as XYDiagram;
            diagram.AxisX.NumericScaleOptions.GridAlignmentStartPoint = NumericStartPoint.MinRangeValue;
        }
    }
}
See Also