I got a simple code from this site:
Now, I want to remove all the labels in the pie chart i.e. "a", "b","c","d".
I tried to do this:
Chart1.Series[0].IsValueShownAsLabel = false;
But it doesnt work..please help. I am Stuck
I got a simple code from this site:
Now, I want to remove all the labels in the pie chart i.e. "a", "b","c","d".
I tried to do this:
Chart1.Series[0].IsValueShownAsLabel = false;
But it doesnt work..please help. I am Stuck
In VB.Net that works fine:
Chart1.Series(0).IsVisibleInLegend = False
I know you don't search for VB.Net. But maybe that helps VB.net users.
You will need to set the PieLabelStyle
something like this
Chart1.Series[0]["PieLabelStyle"] = "Disabled";
Remove following code:
Chart1.Legends.Add(new Legend("Alphabet"));
Chart1.Legends["Alphabet"].Title = "Letters";
Chart1.Series[0].Legend = "Alphabet";
Update: and change
string[] xValues = { "A", "B", "C", "D" };
to
string[] xValues = { "", "", "", "" };
IsValueShownAsLabel determines whether the numerical value (y val) is used for the label rather than the x value. As a guess you probably need to manually set the Label property of each data point to an empty string.
Use IsVisibleInLegend
Chart1.Series[0].IsVisibleInLegend = false;