tags:

views:

28

answers:

2

I'm creating a simple pie chart with three data points. The first and second data point are around 10% each while the last data point makes up the remaining 80% of the chart. This means that the labels for the small segments are by default placed quite close to each other near the center of the chart.

I'm trying to move the labels further towards the outside edge of my pie chart as that would make them easier to read. It seems however that no matter what values I use or where I use it, the PieLabelOffset attribute has no affect.

I've tried setting the attribute per data point like this:

DataPoint newDataPoint = new DataPoint();
newDataPoint.SetValueY(dataEntry.RunCount);
newDataPoint.Label = dataEntry.Name
newDataPoint.LegendText = dataEntry.Name + " (" + dataEntry.RunCount + ")";
newDataPoint["PieLabelOffset"] = "30:30";
myDataSeries.Points.Add(newDataPoint);

I've also tried setting the attribute for the entire series like this:

Series myDataSeries= new Series("Default");
myDataSeries.ChartType = SeriesChartType.Pie;
myDataSeries.BorderColor = System.Drawing.Color.White;
myDataSeries.LabelForeColor = System.Drawing.Color.White;
myDataSeries["PieStartAngle"] = "270";
myDataSeries["PieLabelOffset"] = "30:30";
myChart.Series.Add(myDataSeries);

Does anyone know if PieLabelOffset actually works? If so, can you give an example of how you use it?

A: 

Does this help at all

Matthew
That link would suggest that it should work, but even copying their code sample still does not have any affect on the chart
Stephen Edmonds
+1  A: 

Not exactly answering your question, but I had to handle the same problem. I also didn't manage to move the labels further from the center, and finally I've set the PieLabelStyle to Outside, so placing all the labels outside of the chart.

chrtPie.Series["Values"]["PieLabelStyle"] = "Outside";
Dan Dumitru