Skip to main content

HorizontalAlignment Enum

Lists the horizontal alignment options.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public enum HorizontalAlignment

Members

Name Description
Center

Center alignment.

Left

Left alignment.

Right

Right alignment.

Remarks

The HorizontalAlignment values define how to horizontally align the linked element to the target element. See the following examples:

  • Set an axis title’s HorizontalAlignment property to Right to align the title’s right edge to the right edge of the corresponding axis.

    <DxChart Data="SalesData"
             Width="100%">
        <DxChartTitle Text="Sales amount" />
        <DxChartLegend Position="RelativePosition.Outside"/>
        <DxChartArgumentAxis>
            <DxChartAxisTitle Text="Cities"
                              HorizontalAlignment="HorizontalAlignment.Right" />
        </DxChartArgumentAxis>
        <DxChartValueAxis>
            <DxChartAxisLabel Format="ChartElementFormat.Percent()" />
        </DxChartValueAxis>
        <DxChartValueAxis Name="TotalAxis" Alignment="ChartAxisAlignment.Far">
        </DxChartValueAxis>
        <DxChartSplineSeries Name="Total"
                             SummaryMethod="Enumerable.Sum"
                             ArgumentField="@((SaleInfo s) => s.City)"
                             ValueField="@(s => s.Amount)"
                             Axis="TotalAxis" />
    </DxChart>
    
    @code {
        IEnumerable<SaleInfo> SalesData;
    
        protected override async Task OnInitializedAsync() {
            SalesData = await Sales.GetSalesAsync();
        }
    }
    

    DxChartAxisTitle - Horizontal alignment

  • Set the Alignment property to Left to align left edges of series labels to corresponding series points.

    <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"
                                Alignment="HorizontalAlignment.Left">
            </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();
        }
    
        protected void PreparePointLabel(ChartSeriesPointCustomizationSettings pointSettings) {
            DateTime argument = (DateTime)pointSettings.Point.Argument;
            if (argument.Date.Month == 5)
                pointSettings.PointLabel.Visible = true;
        }
    }
    

    DxChartSeriesLabel - Alignment

See Also