Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxChartConstantLine.PaddingTopBottom Property

Specifies the padding between the top/bottom side of a constant line and its label.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(10)]
[Parameter]
public double PaddingTopBottom { get; set; }

#Property Value

Type Default Description
Double 10

The padding in pixels.

#Remarks

Based on the VerticalAlignment property value, the PaddingTopBottom property moves the constant line label up or down.

The following example uses spin editors to change top/bottom and left/right paddings for the constant line label:

razor
<div ...>
    <label>PaddingLeftRight</label>
    <DxSpinEdit @bind-Value="@PaddingLeftRight" />
    <label>PaddingTopBottom</label>
    <DxSpinEdit @bind-Value="@PaddingTopBottom" />
</div>

<DxChart T="GlobalTemperatureIndexInfo"
         Data="Data"
         Width="100%"
         Height="500px">
    <DxChartArgumentAxis TickInterval="10">
        <DxChartAxisTitle Text="Year" />
        <DxChartAxisLabel Format="ChartElementFormat.Decimal()" />
    </DxChartArgumentAxis>
    <DxChartValueAxis>
        <DxChartAxisTitle Text="Temperature Anomaly, °C" />
        <DxChartConstantLine Value="0"
                             Width="1"
                             PaddingLeftRight=@PaddingLeftRight
                             PaddingTopBottom=@PaddingTopBottom>
            <DxChartConstantLineLabel Text="Zero Level"
                                      Position="RelativePosition.Inside"
                                      VerticalAlignment="VerticalAlignment.Top"
                                      HorizontalAlignment="HorizontalAlignment.Right">
            </DxChartConstantLineLabel>
        </DxChartConstantLine>
    </DxChartValueAxis>
    <DxChartLineSeries T="GlobalTemperatureIndexInfo"
                        TArgument="int"
                        TValue="double"
                        ArgumentField="info=>info.Year"
                        ValueField="info=>info.Value"
                        Color="@(System.Drawing.Color.FromArgb(150, 130, 130, 130))"
                        Name="Annual mean">
        <DxChartSeriesPoint Visible="false" />
    </DxChartLineSeries>
    @* ... *@
</DxChart>

@code {
    IEnumerable<GlobalTemperatureIndexInfo> Data;
        @inject IGlobalTemperatureIndexDataProvider DataProvider

    int PaddingLeftRight { get; set; } = 10;
    int PaddingTopBottom { get; set; } = 10;

    protected override async Task OnInitializedAsync() {
        Data = await DataProvider.GetDataAsync();
    }
}

DxChartConstantLine - Label paddings

See Also