Pritesh
Pritesh

Reputation: 3288

MSChart: Pie Chart Label Overlapping issue

I have used MSChart Control in my one VB.NET project. I have decided to display data as shown in below table in to Pie chart.

enter image description here

But labels are being overlapped on each other for getting rid of it I have tried “Smart Label” properties as shown below.

Chart1.Series("Default").SmartLabelStyle.Enabled = True
Chart1.Series("Default").SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.No

Chart1.Series("Default").SmartLabelStyle.CalloutLineAnchorCapStyle = LineAnchorCapStyle.None

Chart1.Series("Default").SmartLabelStyle.CalloutLineColor = Color.Red

Chart1.Series("Default").SmartLabelStyle.CalloutLineWidth = 1
Chart1.Series("Default").SmartLabelStyle.CalloutStyle = LabelCalloutStyle.None

But it doesn’t help me…though it shows me output as per below screen shot. enter image description here

Which are the properties i have to use for getting rid of it?......

EDIT:

If i do set Custom Property PieLabelStyle=Outside it doesn't make any difference as you can see in below screen shote.

enter image description here

Please help me..

Upvotes: 5

Views: 16463

Answers (2)

Alt-WN
Alt-WN

Reputation: 131

I tried both using Visual Studio designer as well as setting above instructions in the code. It didn't work.

In visual Studio designer go to Series1->CustomProperties. You can expand CustomProperties and set individual properties dependent on the chart type. But in the first line of CustomProperties there is a text representation of CustomProperties set in individual fields. Since my chart was converted from other ChartType it contained custom properties in this first line, but these properties were not applicable to Pie. And this was the reason for failing to respect CustomProperties settings. I deleted manually first line of CustomProperties and ...

PieLabelStyle=Outside

started to work! All labels became readable. I treat this as a bug of Chart designer. Upon changing ChartType it should automatically clean up old CustomProperties.

Upvotes: 0

APrough
APrough

Reputation: 2701

Change the PieLabelStyle CustomSettings to Outside. This should put all the labels around the chart, with lines pointing to the relevant sections.

for VB

Chart1.Series(0)("PieLabelStyle") = "Outside"
Chart1.ChartAreas(0).Area3DStyle.Enable3D = true
Chart1.ChartAreas(0).Area3DStyle.Inclination = 10

for C#

Chart1.Series[0]["PieLabelStyle"] = "Outside";
Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
Chart1.ChartAreas[0].Area3DStyle.Inclination = 10;

Upvotes: 17

Related Questions