We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting Chart data label shape

Hello,


Could someone tell me how to set the shape of a data label on a pie chart? For instance, I would like to use the rectangular callout standard shape for all of my data labels, but I cannot figure out how to do it through the API.

Thank you,
Brett

Hi Brett,


Thanks for inquiring Aspose.Slides.

I have observed the requirement shared and request you to please share the desired output presentation meeting the requirements so that I may explore the API for possible options to help you out.

Many Thanks,

Hi Mudassir,


I’ve attached an example of what I’m looking for. Notice that the data labels are using a rectangular callout shape, rather than just a plain rectangle.

This is quite easy to do directly in PowerPoint through the “Change Data Label Shapes” context menu.

Thanks,
Brett

Hi Brett,

I have observed the requirements shared by you and like to share that setting callouts for data labels of Pie chart is a new feature that comes with PowerPoint 2013. This is at present unavailable in Aspose.Slides and an issue with ID SLIDESNET-37152 has been created as new feature request to further investigate the possibility of implementing the requested support. This thread has been linked with the issue so that you may be automatically notified once the support will be available.

We are sorry for your inconvenience,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello,


I’ve followed the very small example in the release notes for this update, but still cannot get data labels to show as callouts.

Do you have a full, functional example of modifying an existing pie chart and using callout data labels?

In addition, when loading an existing .pptx file that has data label callouts, saving as a .pdf renders the labels as plain rectangles, not callouts.

Thanks,
Brett

Hi Brett,

I have observed your comments and suggest you to please try using the following sample code on your end to serve the purpose. I hope this will be helpful. Please share, if I may help you further in this regard.

using (Presentation pres = new Presentation())
{
IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.Pie, 50, 50, 500, 400);
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowLabelAsDataCallout = true;

chart.ChartData.Series[0].Labels[2].DataLabelFormat.ShowLabelAsDataCallout = false;

pres.Save(pptxFileName, SaveFormat.Pptx);
}

Many Thanks,

Hi Mudassir,


While this works, it doesn’t solve my problem. This example is creating a new presentation and a new chart.

I need to update a chart from an existing .pptx file, and I can’t make the callouts work in this case.

In addition, even in this example, the callouts don’t render properly in a PDF export.

Thanks,
Brett

Hi Brett,


I have observed your requirement of updating existing chart and like to share that whether you add a new chart or update the existing one, the feature will be supported. It’s matter of selecting the existing chart or adding a new one. Please try using the following example where I have loaded the existing chart and added callouts for chart labels.

public static void TestChartLabel()
{
String path = @“C:\Presentations”;

using (Presentation pres = new Presentation(path + “TemplateChart.pptx”))
{
IChart chart = (IChart)pres.Slides[0].Shapes[0];
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowLabelAsDataCallout =

true;
chart.ChartData.Series[0].Labels[2].DataLabelFormat.ShowLabelAsDataCallout =

false;
pres.Save(path+“GeneratedChart2.pptx”, SaveFormat.Pptx);
}
}

For your second observation regarding missing callouts in exported PDF, I like to share that this feature is currently not supported and an issue with ID SLIDESNET-37300 has been added as new feature request to provide support for rendering of charts callout. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

Many Thanks,