[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Collapse]Chart Control
   [Expand]Getting Started
   [Expand]Charting Basics
   [Expand]Series Views
   [Collapse]Chart Elements
     [Expand]Diagram Types
       Axis Scale Types
       Whole and Visual Axis Ranges
       Primary and Secondary Axes
       Grid Lines, Tickmarks and Interlacing
       Axis Appearance and Position
       Axis Titles
       Axis Labels
       Constant Lines
       Scale Breaks
     Chart Titles
   [Expand]Providing Data
   [Expand]Data Representation
   [Expand]Appearance Customization
   [Expand]End-User Features
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]Additional Resources
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Whole and Visual Axis Ranges

Whole and Visual axis ranges define the data that an axis displays. The whole range specifies the data source values the chart displays at the minimum zoom level. If whole range limits are not set, the whole range is calculated based on the data of all series associated with the axis. The visual range depends on the zoom level and is initially equal to the whole range. You can modify ranges of both x- and y-axes.

An x-axis's visual range is equal to a whole range (default) An x-axis's visual range is less than a whole range

This article consists of the following sections:

Expanded How End Users Can Change a Visual Range

Users can pan and zoom a chart to change the visual range. To allow users to scroll and zoom a chart, enable the following properties:

Refer to Zoom and Scroll in 2D XY-Charts and Zooming and Scrolling (3D Charts) for more information.

Expanded Configure Visual and Whole Ranges

The Range class provides base functionality for WholeRange and VisualRange. To access whole and visual range parameters, use the AxisBase.WholeRange and AxisBase.VisualRange properties.

Range limits are automatically calculated when the Range.Auto property is enabled. To specify range limits, use the Range.MinValue and Range.MaxValue properties. Alternatively, you can call the Range.SetMinMaxValues method to pass minimum and maximum range values. The following examples show how to configure a whole range for different axis types:

How to Limit the Numeric Axis Range

How to Limit the Date-Time Axis Range

How to Limit the Time-Span Axis Range

How to Limit the Qualitative Axis Range

The Chart Control recalculates the maximum and minimum range values as float numbers for Qualitative, DateTime, and TimeSpan axes (see Axis Scale Types for more information). These float equivalents are available via the Range.MinValueInternal and Range.MaxValueInternal properties.

Use the AxisBase.GetScaleValueFromInternal method to convert an internal numerical value to its equivalent for a DateTime, TimeSpan or Qualitative axis.

When you change an axis's MeasureUnit (DateTimeScaleOptions.MeasureUnit, TimeSpanScaleOptions.MeasureUnit or NumericScaleOptions.MeasureUnit) property, the range limits are reset to default values. For this reason, specify the MeasureUnit value first to configure the MeasureUnit and the range's limits.

Expanded Specify Diagram Side Margins

The Chart Control adds additional margins between the outermost series point and the diagram's edge. To configure the margins, specify the Range.SideMarginsValue property in axis units.

Property Value Example
WholeRange.SideMarginsValue = 200
WholeRange.SideMarginsValue = 0

When you use the SideMarginsValue property to specify side margins, this disables the Range.AutoSideMargins property.

Expanded Hide Zero Level on a Chart Value Axis

If you want your y-axis to start at the first value, disable the WholeRange.AlwaysShowZeroLevel property. In this case, a new minimum value is calculated for the y-axis based on the underlying data.

Property Value Example
AlwaysShowZeroLevel = false
AlwaysShowZeroLevel = true

Expanded Configure Y-Axis's Range Based on X-Axis's Visual Range

The y-axis visual range is determined based on the x-axis whole range. To make a y-axis calculate its range based on the x-axis visual range only, set the XYDiagram2D.DependentAxesYRange property to true.

Property Value Example
DependentAxesYRange = false
DependentAxesYRange = true

Expanded Track Range Changes

The Chart Control's ChartControl.AxisWholeRangeChanged and ChartControl.AxisVisualRangeChanged events track range changes. To obtain previous and new limits for a changed range, use the AxisRangeChangedEventArgs.MinChange and AxisRangeChangedEventArgs.MaxChange properties.

Expanded See Also

Is this topic helpful?​​​​​​​