This is a migrated thread and some comments may be shown as answers.

Pie Chart - Connect Labels

3 Answers 235 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roman
Top achievements
Rank 1
Roman asked on 28 Mar 2012, 10:52 AM
Hello,

I have added a pie-chart to my report.  For each "pie-slice", I have added a label that appears just outside the slice.  This works fine.

However, I am unable to add a "connecting-line" from the pie-slice to its label.  Regardless of what code I add (in chart1_NeedDataSource), no LabelConnector appears.  Is there some problem connecting labels to "pie-slices" or am I doing something wrong?

Here is some of the code I use to make the connecting-line appear but nothing helps:

serie.Appearance.LabelAppearance.Visible =
true;
serie.Appearance.LabelAppearance.LabelConnectorStyle.Visible = true;
serie.Appearance.ShowLabels = true;
serie.Appearance.LabelAppearance.LabelConnectorStyle.PenStyle = System.Drawing.Drawing2D.DashStyle.Solid;
serie.Appearance.LabelAppearance.LabelConnectorStyle.Width = 2;

 


Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 28 Mar 2012, 05:09 PM
Hi Roman,

You need to set the visibility of the connectors in order to show them i.e.:

serie.Appearance.ShowLabelConnectors = true;

All the best,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Zhou
Top achievements
Rank 1
answered on 02 May 2012, 03:14 PM
Hi,I also have the problem!

I'm building a pie chart with 27 Series programmatically and having a few problems getting the labels to show the way I want.

            ChartSeries s = new ChartSeries();
            s.Type = ChartSeriesType.Pie;
            s.DefaultLabelValue = "#Y, (#%{#0.##%})";
            s.Appearance.ShowLabelConnectors = true;             
            s.Appearance.StartAngle = 30;             
            s.Appearance.LabelAppearance.Distance  = 60;
     otherwise the labels collide with each other.
some value is very samll,so the labels collide with each other . which isn't acceptable.
Also I can't get label connectors to work at all.
Am I missing something?

Thanks,
kany
0
Steve
Telerik team
answered on 02 May 2012, 03:29 PM
Hi Kany,

Judging by your screenshot your problem is not the same as the label connectors are successfully rendered, but as discussed in other threads, when you have so many small values right next to each other, it is possible to have their labels overlap. Generally you can influence this behavior by setting the chart AutoLayout property to True. It makes sure that no chart elements overlap whenever possible.
Another thing to try is setting the IntelligentLabelsEnabled property to True, which should try to arrange them in a manner that they do not overlap with each other or with the pie.
Other things that you've already set but you can play with are increasing the distance between the pie and the labels (chart1.Series[i].Appearance.LabelAppearance.Distance property) and the StartAngle property (try bigger value so that labels are shared at right and bottom and not only at right of the plot area. In this line of thoughts, you might consider increasing the margin of the plot area in order to increase the space and accommodate all labels.

All the best,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Roman
Top achievements
Rank 1
Answers by
Steve
Telerik team
Zhou
Top achievements
Rank 1
Share this question
or