ChartSeriesLabelModel.BackgroundColor Property

Specifies the label background color.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

Declaration

public Color BackgroundColor { get; set; }

Property Value

Type Description
Color

The background color.

Remarks

The PointLabel property returns instances of the ChartSeriesLabelModel class. Use this property in the CustomizeSeriesPoint event handler to specify the label color, position, connector, and visibility.

The BackgroundColor property specifies the background color for the visible point labels in a series.

<DxChart Data="@WeatherForecasts" CustomizeSeriesPoint="@PreparePointLabel">
    <DxChartLineSeries AggregationMethod="@(i => (int)i.Average())"
                       ValueField="@((WeatherForecast i) => i.TemperatureF)"
                       ArgumentField="@(i => i.Date.Date)"
                       Name="Temperature, F">
        <DxChartSeriesLabel Position="RelativePosition.Outside">
            <DxChartSeriesLabelConnector Visible="true" Width="3" />
        </DxChartSeriesLabel>
    </DxChartLineSeries>
    <DxChartLegend Position="RelativePosition.Outside" />
</DxChart>

@code {
    WeatherForecast[] WeatherForecasts;
    ...
    protected void PreparePointLabel(ChartSeriesPointCustomizationSettings pointSettings) {
        double value = (double)pointSettings.Point.Value;
        if(value > 25 && value < 75) {
            pointSettings.PointLabel.Visible = true;
            pointSettings.PointLabel.BackgroundColor = System.Drawing.Color.Red;
        }
    }
}

Chart Series Labels - Background Color

To specify a label connector's color, use the Color property.

Run Demo: Charts - Series Label Customization

See Also