Hide labels in pie charts (MS Chart for .Net)

Found the answer here: http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/32ccd993-5f43-47a3-bcbc-e772a13a87fe

It turns out there is an obscure DataPointCustomProperty called PieLabelStyle that governs label visibility in pie charts. Worse still, the property must be set on each data point.

for (var i = 0; i < chart.Series.Count; i++) 
    for (var j = 0; j < chart.Series[i].Points.Count; j++)
        chart.Series[i].Points[j]["PieLabelStyle"] = "Disabled";

This can also be done in the UI by

  1. Opening the Series editor window (ellipsis button in the main properties panel)
  2. Selecting the wanted series
  3. Expanding the CustomProperties property
  4. Choosing Disabled

Example


Changing chart custom properties will do the trick as well and no coding is needed

<asp:Series Name="Series1" ChartType="Pie" CustomProperties="PieLabelStyle=Disabled">

Chart1.Series[i]["PieLabelStyle"] = "Disabled";

works too, and doesn't need to be set for each datapoint.