Skip to main content

DxChartConstantLine Class

Specifies an axis constant line.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public class DxChartConstantLine :
    DxComplexSettingsComponent<DxChartConstantLine, ChartConstantLineModel>,
    IModelProvider<ChartConstantLineLabelModel>

Remarks

Use DxChartConstantLine objects to customize constant line settings in the following components:

DxChart<T>
A control that visualizes bound data as graphs: bar, area, line, and others.
DxPolarChart<T>
A control that visualizes bound data as graphs in polar coordinates.

Use the DxChartConstantLine component to mark an individual axis value (Value). A constant line label initially displays this value. Use the Text property to change label text. Each axis can contain multiple constant lines.

If the created constant line is outside the visible axis range, use the ExtendAxis property to extend the axis and include the constant line into the visible axis range.

The following example creates two constant lines for the value axis and one line for the argument axis:

<DxChart Data="@forecasts">
    <DxChartArgumentAxis>
        <DxChartConstantLine Value="@("2020-May-14")">
            <DxChartConstantLineLabel Text="Current Date"
                                      VerticalAlignment="VerticalAlignment.Center"
                                      Position="RelativePosition.Inside" />
        </DxChartConstantLine>
    </DxChartArgumentAxis>
    <DxChartValueAxis>
        <DxChartConstantLine Value="18">
            <DxChartConstantLineLabel Text="Average"
                                      HorizontalAlignment="HorizontalAlignment.Left"
                                      Position="RelativePosition.Inside" />
        </DxChartConstantLine>
        <DxChartConstantLine Value="25" />
    </DxChartValueAxis>
    @* ... *@
</DxChart>

Constant Line

Use the following properties to configure a constant line’s position and appearance:

Color
Specifies the color of the constant line.
DashStyle
Specifies the dash style of the constant line.
DisplayBehindSeries
Specifies whether to display the constant line behind series.
PaddingLeftRight
Specifies the padding between the left/right side of a constant line and its label.
PaddingTopBottom
Specifies the padding between the top/bottom side of a constant line and its label.
Width
Specifies the constant line width.

Run Demo: Charts - Constant Lines

To customize font settings of a constant line label, use the DxChartFont object. Refer to Font Customization for more information.

Refer to the following section for more information about constant line customization: Constant Lines.

Inheritance

Object
ComponentBase
DxSettingsComponent<DevExpress.Blazor.Internal.ChartConstantLineModel>
DxComplexSettingsComponent<DxChartConstantLine, DevExpress.Blazor.Internal.ChartConstantLineModel>
DxChartConstantLine
See Also