We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide Data Labels?

Thread ID:

Created:

Updated:

Platform:

Replies:

145408 Jun 19,2019 04:52 PM UTC Jun 20,2019 11:24 AM UTC WinForms 3
loading
Tags: Presentation
Yuri Kuleshov
Asked On June 19, 2019 04:52 PM UTC

Hi everybody,

how can I turn off data labels with SyncFusion.XlsIO in PowerPoint while working with a chart?




Vijayasurya Anandhan [Syncfusion]
Replied On June 20, 2019 09:51 AM UTC

Hi Yuri,

Thank you for contacting Syncfusion support.

It is not possible to turn off data labels of the chart in the PowerPoint using Essential XlsIO (Syncfusion.XlsIO). We request you to use our Essential PowerPoint library to create or modify the charts in PowerPoint.

It is possible to achieve your requirement (Turn off data labels of the chart in PowerPoint) using our Essential PowerPoint library. Please use the below code snippet to achieve your requirement.


 
//Opens a Presentation 
IPresentation presentation = Presentation.Open(@"Chart.pptx"); 
 
//Gets the first slide 
ISlide slide = presentation.Slides[0]; 
 
//Gets the chart in slide 
IPresentationChart chart = slide.Charts[0]; 
 
//Iterate each series in the chart 
for (int i = 0; i < chart.Series.Count; i++) 
{ 
    //Get or set a value indicates whether to display a chart data label values 
    chart.Series[i].DataPoints.DefaultDataPoint.DataLabels.IsValue = false; 
} 

//Save the PowerPoint presentation 
presentation.Save("Output.pptx"); 
 

We have also created a sample to meet your requirement which can be downloaded from the below link.
https://www.syncfusion.com/downloads/support/forum/145408/ze/ChartSample1529177798.zip

To know more details about working with charts in our Essential PowerPoint library, we request to visit our UG documentation page using the below link.
https://help.syncfusion.com/file-formats/presentation/working-with-charts#editing-the-chart-data

Please let us know if you need further assistance in this.

Regards,
Vijayasurya A
 


Yuri Kuleshov
Replied On June 20, 2019 10:15 AM UTC

Hi Vijayasurya,

thanks for such the quick response. I got the point. The only question left is: am I right that DataLabels.IsValue = true|false just does nothing in XlsIO.base? I am asking because I see the API but could never get it worked. Neither with default, not with custom value labels.

Thanks

Vijayasurya Anandhan [Syncfusion]
Replied On June 20, 2019 11:24 AM UTC

Hi Yuri,

Thank you for your update.

We suspect that you have used custom value labels in the chart. It is also possible to remove the custom data labels from the PowerPoint using our Essential Powerpoint library.

We suggest you to use the below code snippet which removes both the default and custom data labels from the PowerPoint.


 
//Opens a Presentation 
IPresentation presentation = Presentation.Open(@"Chart.pptx"); 
 
//Gets the first slide 
ISlide slide = presentation.Slides[0]; 
 
//Gets the chart in slide 
IPresentationChart chart = slide.Charts[0]; 
 
//Iterate each series in the chart 
for (int i = 0; i < chart.Series.Count; i++) 
{ 
    //Get or set a value indicates whether to display a chart data label values 
    chart.Series[i].DataPoints.DefaultDataPoint.DataLabels.IsValue = false;

   
//Gets each DataPoint from the DataPoint collection  
   foreach(IOfficeChartDataPoint dataPoint in chart.Series[i].DataPoints) 
   { 
          //Get or set a value indicates whether to display a chart data label values 
          dataPoint.DataLabels.IsValue = false; 
   } 
} 

//Save the PowerPoint presentation 
presentation.Save("Output.pptx"); 
 

To meet your requirement, we have also created a sample which can be downloaded from the below location.
https://www.syncfusion.com/downloads/support/forum/145408/ze/ChartSample-1620425612.zip

Note:
If you need to remove the data labels of the chart in an Excel document, we request you to use the same highlighted code snippet. We suggest you to use our Essential Powerpoint library to create, edit or modify PowerPoint documents and Essential XlsIO library to create, edit or modify Excel documents. Please use our below UG documentation link to know more details about our Essential Powerpoint and Essential XlsIO library.

PowerPoint: https://help.syncfusion.com/file-formats/presentation/working-with-charts
 
Excel: https://help.syncfusion.com/file-formats/xlsio/working-with-charts


Regards,
Vijayasurya A


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon