Back to Devexpress

How to: Make a Diagram Scrollable and Limit the Visual and Whole Range of Its Axis

windowsforms-6070-controls-and-libraries-chart-control-examples-end-user-interaction-how-to-make-a-diagram-scrollable-and-limit-the-visual-and-whole-range-of-its-axis.md

latest2.3 KB
Original Source

How to: Make a Diagram Scrollable and Limit the Visual and Whole Range of Its Axis

  • Jan 15, 2024
  • 2 minutes to read

This tutorial demonstrates how the axis whole and visible ranges can be limited, so that a user can access only a part of a chart’s underlying data.

To specify the visible range of an axis, do the following.

  • Create a new chart, or open an existing one. For this example, we’ll use a simple XY-chart shown in the following image.

  • Select the X-axis of your chart’s diagram, and in the Properties window, expand its AxisBase.VisualRange property.

  • Now, we can allow end users to scroll the diagram along the limited X-axis, to access the series points that are out of view. To do this, enable the XYDiagram2D.EnableAxisXScrolling property. After this, if the XYDiagramPaneBase.EnableAxisXScrolling property of the corresponding pane is also enabled (or, set to the default value), a scroll bar appears along the X-axis.

  • Finally, you can also restrict the whole range, making the points out of this range completely inaccessible by an end user.

If required, you can specify how the diagram can be scrolled (using the keyboard, mouse, or scroll bars), via the XYDiagram2D.ScrollingOptions property.

See Also

Axis Ranges

How to: Individually Adjust Axes Scrolling (Runtime Sample)

How to: Customize the Appearance of a Pane's Scroll Bar (Runtime Sample)