none
How to prevent Overlapping Pie Labels?

    Question

  • I'm using the Chart Controls in VS2008. Can anyone please help with any advice as to how to avoid overlapping my pie labels? I can't use "Outside" labels because it makes the pie so tiny. I've tried the PieLabelOffset, which doesn't seem to make any difference:

    CustomProperties="PieLabelStyle=Inside, PieLabelOffset=5:5"  

    I've also read that SmartLabels are not supported for Pie charts so I'm not sure what I can do at this point.

    Thanks for any suggestions.
     

    Monday, December 29, 2008 4:00 PM

Answers

  •  

    These are a number of possibilities for keeping your labels from overlapping:

    • First try decreasing the font size, or increasing the size of your chart to allow more room for the labels.
    • Pie and Doughnut charts have the ability to collect smaller slices into one, We have samples that show how this is done: in our samples environment, go to Gallery >> ChartTypes >> Pie and Doughnut Charts, and see "Collecting Small Pie Segments" and "Supplemental Pie Charts" (in Windows Forms) or "Collecting Pie Slices" and "Pie Chart Small Segments" (in ASP.NET.)
    • If the above options do not work, or you would prefer not to change your chart in those ways, set the Series custom attribute PieLabelStyle to "Outside", so that point labels are positioned outside of the pie/doughnut with connecting lines. Right-click the Chart and choose Properties, open the properties for your series, and find the custom attributes. You can also use code like this:

    [C#]

    Chart1.Series[0]["PieLabelStyle"] = "Outside";

     

    [VB.NET]

    Chart1.Series(0)("PieLabelStyle") = "Outside";

    However, you may still find that your labels overlap:

    If your labels still overlap, you can spread them out by setting the ChartArea's Area3DStyle.Enable3D property to True, and adjust the Area3DStyle.XAngle property to 0 or a low value to make the Chart look 2D. You can do this in the wizards, from our properties settings, or with code:

    [C#]

    Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;

    Chart1.ChartAreas[0].Area3DStyle.XAngle = 10;

     

    [VB.NET]

    Chart1.ChartAreas(0).Area3DStyle.Enable3D = True

    Chart1.ChartAreas(0).Area3DStyle.XAngle = 10

     

    -Thank you,

    Lakshmi


    Reporting Services Team. This posting is provided "AS IS" with no warranties, and confers
    Friday, January 02, 2009 7:20 PM

All replies

  • To use the Outside label type, shouldn't you make the Chart picture bigger so it doesn't make the pie smaller?

    One question in return: I'm trying to make a pie chart like the one you're showing. I assume you retrieve this data out of a database? How do you bind the data and the legend to the chart? I do succeeded in getting the data in the chart, but not with a legend and the numbers shown in the chart.
    Could you show me your code?
    Tuesday, December 30, 2008 12:16 PM
  •  

    These are a number of possibilities for keeping your labels from overlapping:

    • First try decreasing the font size, or increasing the size of your chart to allow more room for the labels.
    • Pie and Doughnut charts have the ability to collect smaller slices into one, We have samples that show how this is done: in our samples environment, go to Gallery >> ChartTypes >> Pie and Doughnut Charts, and see "Collecting Small Pie Segments" and "Supplemental Pie Charts" (in Windows Forms) or "Collecting Pie Slices" and "Pie Chart Small Segments" (in ASP.NET.)
    • If the above options do not work, or you would prefer not to change your chart in those ways, set the Series custom attribute PieLabelStyle to "Outside", so that point labels are positioned outside of the pie/doughnut with connecting lines. Right-click the Chart and choose Properties, open the properties for your series, and find the custom attributes. You can also use code like this:

    [C#]

    Chart1.Series[0]["PieLabelStyle"] = "Outside";

     

    [VB.NET]

    Chart1.Series(0)("PieLabelStyle") = "Outside";

    However, you may still find that your labels overlap:

    If your labels still overlap, you can spread them out by setting the ChartArea's Area3DStyle.Enable3D property to True, and adjust the Area3DStyle.XAngle property to 0 or a low value to make the Chart look 2D. You can do this in the wizards, from our properties settings, or with code:

    [C#]

    Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;

    Chart1.ChartAreas[0].Area3DStyle.XAngle = 10;

     

    [VB.NET]

    Chart1.ChartAreas(0).Area3DStyle.Enable3D = True

    Chart1.ChartAreas(0).Area3DStyle.XAngle = 10

     

    -Thank you,

    Lakshmi


    Reporting Services Team. This posting is provided "AS IS" with no warranties, and confers
    Friday, January 02, 2009 7:20 PM
  • thanks
    Thursday, July 01, 2010 9:36 AM