Skip to main content

WholeRange Class

Contains the settings that define the whole range through which it’s possible to scroll an axis.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v23.2.dll

NuGet Package: DevExpress.Charts

Declaration

public class WholeRange :
    Range

The following members return WholeRange objects:

Remarks

An instance of the WholeRange class can be obtained via the AxisBase.WholeRange property.

When scrolling is enabled for an axis (the XYDiagram2D.EnableAxisXScrolling or XYDiagram2D.EnableAxisYScrolling property is set to true), you have the capability to specify the whole range of an axis through which it can be scrolled. So, apart from the capability to specify an axis’ visible range (via the AxisBase.VisualRange property), the main settings exposed via the properties of the WholeRange class allow you to specify the axis’ whole range.

By default, the whole range is automatically calculated based on a chart’s data. However, if the Range.Auto property is set to false, you can explicitly define the minimum and maximum axis values through which it’s possible to scroll an axis. You can specify these values in measurement units of an axis appropriate to its actual scale type (via the Range.MinValue and Range.MaxValue properties), or obtain values in internal floating representations of axis units with no regard to the scale type of an axis (via the Range.MinValueInternal and Range.MaxValueInternal properties).

For more information, refer to Visual Ranges and Whole Ranges and Zooming and Scrolling (2D XY-Charts).

Example

This example demonstrates how to use the AxisBase.VisualRange property to define the visible range of an axis, and the AxisBase.WholeRange property to define its whole range.

For more information on axis range, refer to Visual Ranges and Whole Ranges .

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

namespace WindowsFormsApplication1 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {

            // Create a chart control.
            ChartControl chartControl1 = new ChartControl();

            // Add the chart to the form.
            chartControl1.Dock = DockStyle.Fill;
            this.Controls.Add(chartControl1);

            // Create a bar series and add points to it.
            Series series1 = new Series("Series 1", ViewType.Bar);
            series1.Points.Add(new SeriesPoint("A", new double[] { 26.25 }));
            series1.Points.Add(new SeriesPoint("B", new double[] { 1.52 }));
            series1.Points.Add(new SeriesPoint("C", new double[] { 22.21 }));
            series1.Points.Add(new SeriesPoint("D", new double[] { 15.35 }));
            series1.Points.Add(new SeriesPoint("E", new double[] { 4.15 }));

            // Add the series to the chart.
            chartControl1.Series.Add(series1);

            // Cast the chart's diagram to the XYDiagram type, to access its axes.
            XYDiagram diagram = (XYDiagram)chartControl1.Diagram;

            // Enable the diagram's scrolling.
            diagram.EnableAxisXScrolling = true;
            diagram.EnableAxisYScrolling = true;

            // Define the whole range for the X-axis. 
            diagram.AxisX.WholeRange.Auto = false;
            diagram.AxisX.WholeRange.SetMinMaxValues("A", "D");

            // Disable the side margins 
            // (this has an effect only for certain view types).
            diagram.AxisX.VisualRange.AutoSideMargins = false;

            // Limit the visible range for the X-axis.
            diagram.AxisX.VisualRange.Auto = false;
            diagram.AxisX.VisualRange.SetMinMaxValues("B", "C");

            // Define the whole range for the Y-axis. 
            diagram.AxisY.WholeRange.Auto = false;
            diagram.AxisY.WholeRange.SetMinMaxValues(1, 26);
        }
    }
}

Inheritance

See Also