user3296223
user3296223

Reputation: 23

How do i remove labels from MS Charts Pie chart?

the following image shows labels on a pie chart

Image of my PIE chart

As you can see the legend labels are on the pie chart and chart is not clear.

  1. How do I remove those label from the pie chart surface but not from the chart screen?

  2. How do I make the pies chart bigger in this case bigger diameter?

  3. As I change the size of pie chart, is it possible to change the size of all the other charts?

thanks

Upvotes: 0

Views: 2153

Answers (2)

Alice
Alice

Reputation: 1265

I'm not sure if I understand your fist question, do you mean you want to remove label form chart surface but still display the legend? If that so you could set Points.Label to be empty string and set Points.LegendText to be the label text.

Such the sample code below (You could adapt it to be fit your code, if it needed.):

chart1.Series[0].Points[0].Label = "";
chart1.Series[0].Points[0].LegendText = "2012";

chart1.Series[0].Points[1].Label = "";
chart1.Series[0].Points[1].LegendText = "2013";

Where my chart1 has only one series (Series[0]) with two piece of pie (Points[0] and Points[1])

The size of pie will be changed following the size of Chart, so if you want it to be bigger, then you have to set the size of chart.

Size size = new System.Drawing.Size(800, 600);
chart1.Size = size;

This will be the same for other chart types.

Upvotes: 2

COLD TOLD
COLD TOLD

Reputation: 13569

Youc can do like this

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

Upvotes: 3

Related Questions