This is a migrated thread and some comments may be shown as answers.

PieChart legend not showing the name

4 Answers 157 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 03 Mar 2015, 06:26 PM
As you can see in my screen capture, the name is not showing in the legend of the pie chart.

    Here is the code : 

setup.NomSetup contain the string name
var serie = new PieSeries()
 {
     ShowLabels = true,
     RadiusFactor = 0.9f,
     Range = new Telerik.Charting.AngleRange(270, 360)
 };
 
  
 foreach(var setup in setups){
     serie.DataPoints.Add(new PieDataPoint(Convert.ToDouble(setup.SommeUseTime * 100 / timeclocks.First().SommeTempsStd), setup.nomsetup)
     {
         Name = "Test"
     });
 }
 
pieChart.Series.Clear();
 
pieChart.Series.Add(serie);
pieChart.ShowLegend = true;

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 04 Mar 2015, 01:10 PM
Hi Vincent,

Thank you for writing.

I have used the following code with our latest version and the labels are shown as expected on my end.
RadChartView pieChart = new RadChartView();
this.Controls.Add(pieChart);
 
var serie = new PieSeries()
{
    ShowLabels = true,
    RadiusFactor = 0.9f,
    Range = new Telerik.Charting.AngleRange(270, 360)
};
 
 
for (int i = 0; i < 5; i++)
{
    serie.DataPoints.Add(new PieDataPoint(Math.PI * i, "Slice " + i)
    {
        Name = "Test"
    });
}
 
pieChart.Series.Clear();
pieChart.AreaType = ChartAreaType.Pie;
pieChart.Series.Add(serie);
pieChart.ShowLegend = true;

You can see the result in the attached image. 

Since the code is pretty much the same, my guess is that the setup.nomsetup variable does not return a non-empty string. Can you please check that?

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vincent
Top achievements
Rank 1
answered on 04 Mar 2015, 02:01 PM
Hi, 

This is the chart I get if I use your part of the following code :

int i = 0;
foreach(var setup in setups){
    i++;
    serie.DataPoints.Add(new PieDataPoint(Math.PI * i, "Slice " + i)
    {
        Name = "Test"
    });
}

Please see the attached files... it's still not working.
0
Accepted
Stefan
Telerik team
answered on 06 Mar 2015, 06:58 AM
Hi Vincent,

Thank you for the clarification.

We had an issue causing this behavior, and this issue is already resolved in our latest version. I have tested with it, hence I did not observe the same behavior as you. Feel free to upgrade to our latest version in order to benefit from the fix.

If you are unable to upgrade, on the issue page we do have a workaround provided: http://feedback.telerik.com/Project/154/Feedback/Details/121076-fix-radchartview-pieseries-do-not-show-the-legend-properly-the-values-are-not.

I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vincent
Top achievements
Rank 1
answered on 09 Mar 2015, 03:51 PM
The update did the fix, thanks for the support!
Tags
ChartView
Asked by
Vincent
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Vincent
Top achievements
Rank 1
Share this question
or