Skip to main content
All docs
V24.1

DxChartSeries.MaxLabelCount Property

Specifies the maximum number of point labels that the DxChartSeries displays.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public int MaxLabelCount { get; set; }

Property Value

Type Description
Int32

The number of series labels.

Remarks

If the number of labels exceeds the MaxLabelCount value, the series hides all labels. Use this property to avoid cluttered chart display.

The following example hides all series labels when their number exceeds a spin editor’s value:

<div style="display:flex; width:100%; align-items:center;">
    <label style="padding-right:5px;">Limit the number of series labels:</label>
    <DxSpinEdit @bind-Value="@LimitLabelCount" />
</div>

<DxChart Data="@WeatherForecasts"
         Width="100%">
    <DxChartTitle Text="Annual Weather in New York" />
    <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")"
                       MaxLabelCount=@LimitLabelCount>
        <DxChartSeriesLabel Visible="true"
                            Position="RelativePosition.Outside"
                            FormatPattern="{argument:MMMM}: {value:#.##} °F">
            <DxChartSeriesLabelConnector Visible="true"
                                         Width="3" />
        </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 LimitLabelCount { get; set; } = 15;
}

DxChartSeriesLabel - MaxLabelCount

See Also