Back to Devexpress

DxChartConstantLine.PaddingTopBottom Property

blazor-devexpress-dot-blazor-dot-dxchartconstantline-a2abe81c.md

latest3.2 KB
Original Source

DxChartConstantLine.PaddingTopBottom Property

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

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDefaultDescription
Double10

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();
    }
}

See Also

DxChartConstantLine Class

DxChartConstantLine Members

DevExpress.Blazor Namespace