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

DxChartAxisLabel.Alignment Property

Specifies the horizontal alignment for axis labels.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public HorizontalAlignment Alignment { get; set; }

#Property Value

Type Description
HorizontalAlignment

A HorizontalAlignment enumeration value.

Available values:

Name Description
Center

Center alignment.

Left

Left alignment.

Right

Right alignment.

#Remarks

The Alignment property allows you to align axis labels relative to corresponding axis ticks. Center, Left, and Right alignment options are available.

The following example changes axis label alignment:

razor
<div style="display:flex;">
    <label>Alignment Mode:</label>
    <DxRadioGroup Items="@(Enum.GetValues(typeof(HorizontalAlignment)).Cast<HorizontalAlignment>())"
                  @bind-Value="@Alignment" />
</div>

<DxChart Data="@WeatherForecasts"
         Width="100%" >
    <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 Visible="false" />
    </DxChartLineSeries>
    <DxChartLegend Visible="false" />
    <DxChartValueAxis>
        <DxChartAxisTitle Text="Temperature, °F" />
    </DxChartValueAxis>
    <DxChartArgumentAxis>
        <DxChartAxisLabel Format="ChartElementFormat.Month"
                          Alignment=@Alignment/>
    </DxChartArgumentAxis>
</DxChart>

@code {
    IEnumerable<DetailedWeatherSummary> WeatherForecasts;

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

    HorizontalAlignment Alignment { get; set; } = HorizontalAlignment.Center;
}

See Also