Skip to main content
All docs
V25.1
  • IChartSeriesLabel.Texts Property

    Specifies text content for series labels.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    string[] Texts { get; set; }

    Property Value

    Type Description
    String[]

    An array of text strings.

    Remarks

    IChartSeriesLabel properties allow you to configure point label settings. To access these settings, use the PointLabel property in a CustomizeSeriesPoint event handler.

    The Texts property allows you to specify the series label text. The length of the array depends on series type:

    • Two strings for range series
    • One string for other series types

    Range Series Example

    The following code snippet displays labels for the specified series point and customizes label text:

    Chart - Customize Range Series Label Text

    <DxChart Data="@weatherForecasts"
             CustomizeSeriesPoint = "@PreparePointLabel"
             Width="100%">
        <DxChartTitle Text="Annual Temperature" />
        <DxChartRangeBarSeries ValueField="@((DetailedWeatherSummary  i) => i.AverageTemperatureF)"
                               ArgumentField="@(i => new DateTime(2000, i.Date.Month, 1))"
                               Name="New York"
                               Filter="@((DetailedWeatherSummary  i) => i.City == "NEW YORK")">
        </DxChartRangeBarSeries>
        @* ... *@
    </DxChart>
    
    @code {
        IEnumerable<DetailedWeatherSummary> weatherForecasts;
    
        protected override async Task OnInitializedAsync() {
            weatherForecasts = await WeatherSummaryDataProvider.GetDataAsync();
        }
    
        protected void PreparePointLabel(ChartSeriesPointCustomizationSettings pointSettings) {
            if (pointSettings.Point is ChartRangeSeriesPoint point) {
                var endValue = (double)point.EndValue;
                var startValue = (double)point.StartValue;
                DateTime dateTime = (DateTime)point.Argument;
                if (dateTime.Month == 5)
                    pointSettings.PointLabel.Visible = true;
                    pointSettings.PointLabel.Texts = new string[] { $"{startValue}, °F", $"{endValue}, °F" };
            }
        }
    }
    

    Line Series Example

    The following code snippet customizes label text for visible series points:

    Chart - Customize Line Series Label Text

    <DxChart Data="@WeatherForecasts"
             CustomizeSeriesPoint="@PreparePointLabel"
             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")" />
        @* ... *@
    </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;
                pointSettings.PointLabel.Texts = new string[] { $"{Math.Round(value, 2)} °F" };
        }
    }
    
    See Also