views:

1188

answers:

2

ugly pie chart

I can't seem to find the property that controls visibility of labels in pie charts. I need to turn the labels off as the information is available in the legend.

Anyone know what property I can use in code behind?

I tried setting the series labels to nothing Chart1.Series[i].Label = string.Empty; but the labels seem to show up anyway.

+3  A: 

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";
grenade
A: 

objChart.ChartAreas[0].AxisY.LabelStyle.Enabled = false;

Suman Modi
Have you tested this with pie charts? It is valid for most chart types but back in February it did not affect pie charts. Has this changed?
grenade