Free Support Forum - aspose.com

Pie Chart leader line

Dear,


I am using using Aspose.slide 6.5 to generate a .pptx presentation that includes pie charts.
Ms Excel contains an option called “Show Leader Lines” in “Format Data Labels” which adds a line between a pie and its legend. (kindly find attached a snapshot that shows this line)
Is it possible to set this option in ASPose.slide? If yes could you please provide me with a code snippet that allows me to set that option.

Thank you in advance,
Sami Simon

Hi Sami Simon,


I have observed the support requested by you and like to share that currently the requested feature in unavailable in Aspose.Slide for .NET. I have created an issue with ID SLIDESNET-33622 as new feature request in our issue tracking system so that our development team may investigate and resolve the issue. We will share the information with you as soon as it will be resolved.

We are sorry for your inconvenience,

Dear,


Any news regarding the above request? Could you please give me an estimation on when this could be fixed.

I would like to apologize for my rush but I need to schedule my project according to this fix.

Regards,
Sami Simon

Hi Sami Simon,


I regret to share that the issue shared has not yet been resolved. However, I have raised the issue priority and have requested our development team to schedule the issue for investigation. I will be able to share the further updates with you as soon as it will be shared by our development team.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESNET-33622) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(9)

Dear,


I have tried the set the leader line in a pie chart but with no success. Here is the code I used:

private void CreateSlide()
{
SlideEx sld = pres.Slides[0];

Aspose.Slides.Pptx.ChartEx chart = sld.Shapes.AddChart(ChartTypeEx.Pie, 10, 60, 600, 400);
ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;

chart.HasLegend = false;

chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();

chart.ChartData.Categories.Add(fact.GetCell(0, 0, 0, “C1”));
chart.ChartData.Categories.Add(fact.GetCell(0, 1, 0, “C2”));
chart.ChartData.Categories.Add(fact.GetCell(0, 2, 0, “C3”));
chart.ChartData.Categories.Add(fact.GetCell(0, 3, 0, “C4”));
chart.ChartData.Categories.Add(fact.GetCell(0, 4, 0, “C5”));
chart.ChartData.Categories.Add(fact.GetCell(0, 5, 0, “C6”));
chart.ChartData.Categories.Add(fact.GetCell(0, 6, 0, “C7”));
chart.ChartData.Categories.Add(fact.GetCell(0, 7, 0, “C7”));
chart.ChartData.Categories.Add(fact.GetCell(0, 8, 0, “C8”));
chart.ChartData.Categories.Add(fact.GetCell(0, 9, 0, “C9”));
chart.ChartData.Categories.Add(fact.GetCell(0, 10, 0, “C10”));
chart.ChartData.Categories.Add(fact.GetCell(0, 11, 0, “C11”));
chart.ChartData.Categories.Add(fact.GetCell(0, 12, 0, “C12”));
chart.ChartData.Categories.Add(fact.GetCell(0, 13, 0, “C13”));

chart.ChartData.Series.Add(fact.GetCell(0, 0, 1, “Series 1”), chart.Type);

ChartSeriesEx series = chart.ChartData.Series[0];

series.Values.Add(fact.GetCell(0, 0, 1, 24));
AddLegentToSeries(series, "value \n percentage " + 24 + “%”, 0);
series.Values.Add(fact.GetCell(0, 1, 1, 74));
AddLegentToSeries(series, "value \n percentage " + 74 + “%”, 1);
series.Values.Add(fact.GetCell(0, 2, 1, 25));
AddLegentToSeries(series, "value \n percentage " + 25 + “%”, 2);
series.Values.Add(fact.GetCell(0, 3, 1, 73));
AddLegentToSeries(series, "value \n percentage " + 73 + “%”, 3);
series.Values.Add(fact.GetCell(0, 4, 1, 84));
AddLegentToSeries(series, "value \n percentage " + 84 + “%”, 4);
series.Values.Add(fact.GetCell(0, 5, 1, 65));
AddLegentToSeries(series, "value \n percentage " + 65 + “%”, 5);
series.Values.Add(fact.GetCell(0, 6, 1, 29));
AddLegentToSeries(series, "value \n percentage " + 29 + “%”, 6);
series.Values.Add(fact.GetCell(0, 7, 1, 24));
AddLegentToSeries(series, "value \n percentage " + 24 + “%”, 7);
series.Values.Add(fact.GetCell(0, 8, 1, 74));
AddLegentToSeries(series, "value \n percentage " + 74 + “%”, 8);
series.Values.Add(fact.GetCell(0, 9, 1, 25));
AddLegentToSeries(series, "value \n percentage " + 25 + “%”, 9);
series.Values.Add(fact.GetCell(0, 10, 1, 73));
AddLegentToSeries(series, "value \n percentage " + 73 + “%”, 10);
series.Values.Add(fact.GetCell(0, 11, 1, 84));
AddLegentToSeries(series, "value \n percentage " + 84 + “%”, 11);
series.Values.Add(fact.GetCell(0, 12, 1, 65));
AddLegentToSeries(series, "value \n percentage " + 65 + “%”, 12);
series.Values.Add(fact.GetCell(0, 13, 1, 29));
AddLegentToSeries(series, "value \n percentage " + 29 + “%”, 13);

series.Labels.ShowLeaderLines = true;
}

private void AddLegentToSeries(ChartSeriesEx series, string text, int id)
{
DataLabelEx lbl;
lbl = new DataLabelEx(series);
lbl.Position = LegendDataLabelPositionEx.OutsideEnd;
lbl.TextFrame.Text = text;
lbl.Id = id;
for (int i = 0; i < lbl.TextFrame.Paragraphs.Count; i++)
{
PortionFormatEx pt = lbl.TextFrame.Paragraphs[i].Portions[0].PortionFormat;
pt.LatinFont = new FontDataEx(“Century Gothic”);
pt.FontBold = NullableBool.False;
pt.FontHeight = 14;
pt.FillFormat.FillType = FillTypeEx.Solid;
pt.FillFormat.SolidFillColor.Color = Color.Black;
}
series.Labels.Add(lbl);
}

Could you please tell me where my mistake is?

Thanks you in advance,
Sami Simon

Hi,

Could you please send me code snippet for setting the chart leader lines, if it is getting resolved. I am also waiting for this for a long time.

Thanks,
Laxmikanta

Hi Laxmikanta,


Please visit this documentation link for your kind reference. I have updated the sample code to accommodate the Leader Lines and Pie chart slice rotation angle.

Many Thanks,

Dear,


Any updates regarding the code mentioned in my previous email? I have tried it as is and still the Leader Lines are not showing.

Thank you in advance,
Sami Simon

Hi Sami Simon,


I like to share that feature for share the feature for showing leader lines have been provided in Aspose.Slides for .NET 6.9.0. The following sample code is used to show the leader line.

//Showing Leader Lines for Chart
series.Labels.ShowLeaderLines = true;

Please visit this documentation link for complete example.

Many Thanks,

Dear,


I figured out what is causing the Leader Line not to show in the code I posted earlier. The fact of setting custom values to the chart labels causes the leader lines not to show. As a worked around I added the following code before setting the ShowLeaderLines to true:

series.Labels.ShowValue = true;

And now everything works great, I am able to set custom Labels for the cart yet the Leader Lines are showing.

Regards,
Sami Simon

Hi Sami,


That is really appreciable that you have been able to figure out the issue and able to use the property to set the leader line to become visible. Please share, if I may help you further in this regard.

Many Thanks,