Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving labels off the pie chart

I am trying to move the labels OFF of the pie chart using the canned chart control from VS2010 (mvc, ef and asp.net)

Here is my code to display the piechart.

  string xx = activePhysicianID;
  ArrayList xValue = new ArrayList();
  ArrayList yValue = new ArrayList();
  XXXXX_MainEntities dbContext = new XXXXX_MainEntities();
  var results = dbContext.Payor.Where(rs => rs.PhysicianIdentity.Equals(xx));

  results.ToList().ForEach(rs => xValue.Add(rs.Identifier));
  results.ToList().ForEach(rs => yValue.Add(rs.Strength));

  var chart = new Chart(600, 300, ChartTheme.Blue);

  chart.AddSeries(chartType: "Pie", xValue: xValue, yValues: yValue);
  chart.AddTitle("Payor");
  chart.Write("png");

  return null;

The pie chart is rendered ok, but the labels are on the pie chart, and it is too hard to read. I would like to labels placed off the chart with lines pointing to the segment.

thanks

like image 351
Tony Farrell Avatar asked Nov 04 '22 20:11

Tony Farrell


1 Answers

Try this:

chart.Series["Pie"]["PieLabelStyle"] = "Outside";
like image 53
Dean Avatar answered Nov 15 '22 01:11

Dean