Skip to main content

DxChartConstantLine Class

Specifies an axis constant line.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

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

Remarks

Use the DxChartConstantLine component to mark an individual axis value. To set the value, use the DxChartConstantLine.Value property. A constant line’s label initially displays this value. Use the DxChartConstantLineLabel.Text property to change label text.

If the constant line is outside the visible axis range, use the ExtendAxis property to extend the axis so that the constant line becomes visible.

You can add multiple constant lines for the chart’s argument and value axes.

<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.Center"
                                      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.

Inheritance

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