)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to format the legend text?

Platform: WinRT |
Control: SfChart |
Published Date: April 24, 2015 |
Last Revised Date: June 27, 2019

Description

This article describes the available customization for chart legends.

Solution

You can format the legend text by using its default customization APIs as follows.

XAML

<chart:ChartLegend x:Name="Legend1" 
                        Header="Multiple Series"   
                        FontFamily="Bradley Hand ITC"
                        FontSize="20"
                        FontStretch="Expanded"
                        FontStyle="Italic"
                        FontWeight="ExtraBold"
                        Foreground="DarkGreen"/>

C#

            ChartLegend legend2 = new ChartLegend();
            legend2.Header = "Multiple Series";
            legend2.FontFamily = new FontFamily("Bradley Hand ITC");
            legend2.FontSize = 20;
            legend2.FontStretch = FontStretches.Expanded;
            legend2.FontStyle = FontStyles.Italic;
            legend2.FontWeight = FontWeights.ExtraBold;
            legend2.Foreground = Brushes.DarkGreen;
            this.chart1.Legend = legend2;

Output

The following screenshot illustrates the output for the formatted text of the legend.

Chart legend with formatted text in WPF

Figure 1: Formatted text of the legend.

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon