Skip to main content
All docs
V24.1

DxChartSeriesLabel.VerticalOffset Property

Specifies series label vertical offset.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public double VerticalOffset { get; set; }

Property Value

Type Description
Double

The offset in pixels.

Remarks

The VerticalOffset property value shifts series labels vertically from their initial positions. A positive value shifts labels down, a negative value shifts them up.

The following example shifts series labels horizontally or vertically based on the values of spin editors:

<div style="display:flex; width:100%; align-items:center;">
    <label style="padding-right:5px;">A label's horizontal offset:</label>
    <DxSpinEdit @bind-Value="@HorizontalOffset" />
    <label style="padding-right:5px; padding-left:5px;">A label's vertical offset:</label>
    <DxSpinEdit @bind-Value="@VerticalOffset" />
</div>
<DxChart Data="@WeatherForecasts"
         Width="100%"
         CustomizeSeriesPoint="@PreparePointLabel">
    <DxChartLineSeries SummaryMethod="@(i => i.Average())"
                       ValueField="@((DetailedWeatherSummary i) => i.AverageTemperatureF)"
                       ArgumentField="@(i => new DateTime(2000, i.Date.Month, 1))"
                       Name="Temperature, F"
                       Filter="@((DetailedWeatherSummary  i) => i.City == "NEW YORK")">
        <DxChartSeriesLabel Position="RelativePosition.Outside"
                            FormatPattern="{argument:MMMM}: {value:#.##} °F"
                            HorizontalOffset=@HorizontalOffset
                            VerticalOffset=@VerticalOffset>
        </DxChartSeriesLabel>
    </DxChartLineSeries>
    <DxChartLegend Visible="false" />
    <DxChartValueAxis>
        <DxChartAxisTitle Text="Temperature, °F" />
    </DxChartValueAxis>
    <DxChartArgumentAxis>
        <DxChartAxisLabel Format="ChartElementFormat.Month" />
    </DxChartArgumentAxis>
</DxChart>

@code {
    IEnumerable<DetailedWeatherSummary> WeatherForecasts;

    protected override async Task OnInitializedAsync() {
        WeatherForecasts = await WeatherSummaryDataProvider.GetDataAsync();
    }

    int HorizontalOffset { get; set; } = 0;
    int VerticalOffset { get; set; } = 0;

    protected void PreparePointLabel(ChartSeriesPointCustomizationSettings pointSettings) {
        DateTime argument = (DateTime)pointSettings.Point.Argument;
        if (argument.Date.Month == 5)
            pointSettings.PointLabel.Visible = true;
    }
}

DxChartSeriesLabel - Offset

See Also