Search code examples
.netvb.netvisual-studiomschart

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..


Solution

  • 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;