Skip to main content
All docs
V24.1

DxChartConstantLine.PaddingLeftRight Property

Specifies the padding between the left/right side of a constant line and its label.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(10)]
[Parameter]
public double PaddingLeftRight { get; set; }

Property Value

Type Default Description
Double 10

The padding in pixels.

Remarks

Based on the HorizontalAlignment property value, the PaddingLeftRight property moves the constant line label to the left or right.

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

<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