Skip to main content

DxChartSeriesLabel.FormatPattern Property

Specifies a string pattern that formats series label text.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
[Parameter]
public string FormatPattern { get; set; }

Property Value

Type Default Description
String null

An LDML string that formats series label text.

Remarks

Format patterns can include placeholders and plain text. For example, "{argument:MMMM}: {value:#.##} °F", where:

  • {argument}, {value} - placeholders
  • MMMM, #.## - format specifiers
  • °F - plain text

Refer to the following section for a list of available placeholders: Text Format (Pattern).

The following example formats series label text:

A chart with formatted series labels

@inject IWeatherSummaryDataProvider WeatherSummaryDataProvider
<DxChart Data="@WeatherForecasts"
         CustomizeSeriesPoint="@PreparePointLabel"
         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 Position="RelativePosition.Outside"
                            FormatPattern="{argument:MMMM}: {value:#.##} °F">
            <DxChartSeriesLabelConnector Visible="true"
                                         Width="3" />
        </DxChartSeriesLabel>
    </DxChartLineSeries>
</DxChart>

@code {
    IEnumerable<DetailedWeatherSummary> WeatherForecasts;
    protected override async Task OnInitializedAsync() {
        WeatherForecasts = await WeatherSummaryDataProvider.GetDataAsync();
    }
    protected void PreparePointLabel(ChartSeriesPointCustomizationSettings pointSettings) {
        double value = (double)pointSettings.Point.Value;
        if (value > 50 && value < 70)
            pointSettings.PointLabel.Visible = true;
    }
}

Run Demo: Series Labels

See Also