Skip to main content

Constant Lines

  • 2 minutes to read

This topic describes how to display a constant line, and customize its appearance and position across an axis. Before you proceed with this section, you may wish to review the following help topic on axis fundamentals: Axes.

A Constant line displays a line that is perpendicular to the axis to which it belongs. It can be drawn in front of or behind the diagram‘s series.

ConstantLines_0

To create a constant line and add it to an axis at design time, locate the axis in the Properties window, and click the ellipsis button for the Axis2D.ConstantLines property.

ConstantLinesCollection

This invokes the Constant Line Collection Editor.

ConstantLineEditor

Click Add to create a constant line, and define its properties.

The key property of a constant line is the ConstantLine.AxisValue property, which determines the value on the axis across which the constant line is drawn. This value should fall into the range defined for the current axis, in order for the constant line to be visible on a diagram.

Also note that this value should match the axis scale type (see the images below).

AxisValue = 10 AxisValue = “D”
AxisValue_10 AxisValue_D

You can control whether a constant line should be drawn behind or in front of a chart’s series. To do this, use the ConstantLine.ShowBehind property. Note that this property does not affect the position of the constant line’s title.

ShowBehind = False ShowBehind = True
ShowBehind_false.png ShowBehind_true.png

You can display a constant line’s titles in both the diagram and the legend.

You can also specify various appearance options for a constant line such as color, dash style and line thickness. See the corresponding property descriptions for details.

Use the ConstantLine.Visible property to hide a constant line while maintaining it in an axis collection.

See Also