Tony Farrell
Tony Farrell

Reputation: 69

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

Upvotes: 5

Views: 2718

Answers (1)

Dean
Dean

Reputation: 4594

Try this:

chart.Series["Pie"]["PieLabelStyle"] = "Outside";

Upvotes: 2

Related Questions