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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display Pie Chart legend?

Thread ID:





104500 Jul 24,2012 08:25 PM UTC Jul 30,2014 12:28 PM UTC Silverlight 4
Tags: Chart
Pierre-Alain GALTIER
Asked On July 24, 2012 08:25 PM UTC


I don't know why but I can't make a simple pie chart sample with a legend work.

I created a new business application projet and update the Home class constructor (in Home.xaml.cs file) as follow:


            this.Title = ApplicationStrings.HomePageTitle;

            Chart myChart = new Chart();         
            ChartArea area = new ChartArea();
            ChartSeries series = new ChartSeries();
            ChartAdornmentInfo adornment = new ChartAdornmentInfo();
            ChartLegend legend = new ChartLegend();           
            legend.DockPosition = ChartDock.Top;           

            series.Type = ChartTypes.Pie;
            series.Label = "Series1";
            series.IsIndexed = false;
            series.DataSource = new ObservableCollection<NamedValue>() {new NamedValue("Part 1", 40), new NamedValue("Part 2", 60)};
            series.BindingPathX = "Name";
            series.BindingPathsY = new List<string>() {"Value"};
            // Initialize the Adornment Information.
            adornment.Visible = true;
            adornment.HorizontalAlignment = HorizontalAlignment.Center;
            adornment.VerticalAlignment = VerticalAlignment.Top;           
            adornment.SegmentLabelContent = LabelContent.Percentage;
            adornment.SegmentLabelFontFamily = new FontFamily("Segoe UI");
            series.AdornmentsInfo = adornment;

            area.Legends = legend;           


and I added the following class

public class NamedValue
        public string Name{get;set;}       
        public double Value{get;set;}

        public NamedValue(string name, double value)
            Name = name;
            Value = value;


I don't know why but I have no legend in my chart.

Any Idea ?

Thank you

Rajkumar [Syncfusion]
Replied On July 26, 2012 05:32 AM UTC

Hi PierreAlainGaltier,
Thanks for your interest in Syncfusion products.
We are unable to reproduce the issue and the added code is sufficient enough to display Legends. Please try to set the visibility of Legends as in below code snippet and check whether the legend is visible or not.
Code Snippet:
legend.Visibility = System.Windows.Visibility.Visible;
If you are still having a problem in displaying Legends, please create a direct track incident regarding this issue. So that we can analyze more on this and provide a better solution.
Rajkumar B R

Scott Harner
Replied On July 30, 2014 01:09 AM UTC

I realize this is an old thread, but I am trying to get a legend to show with a pie chart using version and am also having no luck. I took the original poster's code and pasted it into a brand new windows phone 7.1 project. The chart shows, but the legend does not. I tried this on one box using vs 2010 express on windows vista and another box using vs 2012 express on windows 8. I notice that there is also no legend when I run the sample browser project that was provided despite the fact that there is legend xaml included with the pie chart.

Suresh S [Syncfusion]
Replied On July 30, 2014 10:48 AM UTC

Hi Scott,

We have introduced the new SfChart control  for Windows Phone from 11.1 version. Could you please upgrade to the latest version?

Suresh S

Scott Harner
Replied On July 30, 2014 12:28 PM UTC

It's good to hear that the issue has been addressed in a newer version. I had won a copy of Essential Studio at a user group meeting a while back, but didn't have a reason to use it during my year of support. I finally had a personal project where it made sense to give Essential Studio a try, by adding a pie chart, but unfortunately it is not working in the newest version that I had access to ( Regardless, thanks for the quick follow-up response.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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