Category / Section
How to add watermark in WPF Chart (SfChart)?
1 min read
WPF Chart (SfChart) provides watermark support to add text or images to the chart area. You can add the text to chart background using the Content property of Watermark. If you want to set watermark inside the plot area, you can use the HorizontalAlignment and VerticalAlignment properties.
XAML
<!--Adds Watermark to Chart--> <syncfusion:SfChart.Watermark> <syncfusion:Watermark HorizontalAlignment="Center" VerticalAlignment="Center"> <syncfusion:Watermark.Content> <TextBlock Text="Temperature Report" FontSize="60" Foreground="Gray"/> </syncfusion:Watermark.Content> </syncfusion:Watermark> </syncfusion:SfChart.Watermark>
C#
private void MyChart() { SfChart chart = new SfChart(); chart.Watermark.HorizontalAlignment = HorizontalAlignment.Center; chart.Watermark.VerticalAlignment = VerticalAlignment.Center; chart.Watermark.Content = "Temperature Report"; chart.Watermark.FontSize = 60; chart.Watermark.Foreground = new SolidColorBrush(Colors.Gray); }