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. Image for the cookie policy date

add values to charts on slides

I have multiple slides with a chart in my presentation.  I would like to put the value associated with each section on the pie charts (see piechart.png) or each column on the column charts (see image1.jpg) and for those that display a percentage, I need the percentage sign % next to the numbers on the y axis as well as the value as a percentage (see columnchart.png).  How does one go about doing that?   I thought it might be something like is used in excel charts but that is not working.   

 



Attachment: BigTex_Test_db2e4431.zip

5 Replies

KK Kumaravel Kulandai Samy Syncfusion Team October 5, 2017 06:58 AM UTC

Hi Miranda, 
Please find the code snippet for displaying the axis values in Percentage format 
For Pie Chart: 
IPresentationChart chart = slide.Charts.AddChart(stream, 1, value.AddressLocal, new RectangleF(100, 10, 700, 500));       
chart.ChartTitle = "Chart Title";               
chart.ChartType = OfficeChartType.Pie;  
IOfficeChartSerie serieOne = chart.Series[0]; 
serieOne.DataPoints.DefaultDataPoint.DataLabels.Position =       OfficeDataLabelPosition.Center; 
serieOne.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; 
serieOne.DataPoints.DefaultDataPoint.DataLabels.NumberFormat = "0%"; 

For Bar_Cluster chart: 
IPresentationChart chart = slide.Charts.AddChart(stream, 1, value.AddressLocal, new RectangleF(100, 10, 700, 500)); 
chart.ChartTitle = "Chart Title";                
chart.ChartType = OfficeChartType.Bar_Clustered; 
chart.PrimaryValueAxis.MinimumValue = 0; 
chart.PrimaryValueAxis.NumberFormat = "0%"; 

In additional we have created the sample for the displaying the ValueAxis value in percentage format for both chart type 
PieChart sample: 
Output document(Pie chart): 
Cluster_Bar chart sample:  
Output Document(Bar chart): 
Please let us know if you need any further assistance in this. 
Regards, 
Kumaravel 




MJ Miranda Johnson October 5, 2017 04:35 PM UTC

The 0 to 5 are not percentages.   It is a 1 to 5 rating scale    so nothing could ever actually go below 1

5 = Strongly Agree

4 = Agree

3 = Neither agree nor disagree

2 = Disagree

1 = Strongly Disagree


The only slides with percentage are the last 2 slides  #32 and #33.  The charts showing 0 to 100 scale.   I am able to display  a percent sign now  but it is way off.  

Instead of being  0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%

it is 0% 1000% 2000% 3000% 4000% 5000% 6000% 7000% 8000% 9000% 10000%  

and then of course the actual values being displayed are messed up too.   For slide 32 the first column should say 48%   instead it says 4800%

and on slide 33 instead of the last column saying 3.7879% it says 378.79%    I even tried this    NumberFormat = "0.00%";  and it did not work

So how do I get the last 2 slides to show actual percentages like image example  and not to show distorted percentage like presentation is displaying?   


Attachment: percentages_75ac0d12.zip


KK Kumaravel Kulandai Samy Syncfusion Team October 6, 2017 05:15 AM UTC

Hi Miranda, 
Please find the code snippet to display the value with percentage symbol without multiplying with 100. 
//Sets the display unit to 100 for value axis to avoid multiplication of hundred with the value 
chart.PrimaryValueAxis.DisplayUnit=OfficeChartDisplayUnit.Hundreds; 
 
//Gets chart first serie 
IOfficeChartSerie serieOne = chart.Series[0]; 
 
//Sets the datalable position in the serie 
serieOne.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Automatic; 
 
//Select the datalabel value from given value  
serieOne.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; 
 
//Sets the datalabel display format 
serieOne.DataPoints.DefaultDataPoint.DataLabels.NumberFormat = "0%"; 

In addition, we have attached the sample that meets your requirement. Please find the sample from below link 
Sample: 
Output document: 
Please let us know if you need any further assistance in this. 
Regards, 
Kumaravel 





MJ Miranda Johnson October 6, 2017 02:15 PM UTC

Thank you.  Now how do I remove the text hundreds that appears along the Y Axis???   This should not be on there since it is representing hundredths   not hundreds  



KK Kumaravel Kulandai Samy Syncfusion Team October 9, 2017 04:22 AM UTC

Hi Miranda, 
Please find the code snippet to avoid the hundredths label in Y-axis 
//To hide the label hudreds in y- axis 
chart.PrimaryValueAxis.HasDisplayUnitLabel = false; 

In addition, we have attached the sample that meets your requirement. Please find the sample from below link 
Sample: 
Output Document: 
Please let us know if you need any further assistance in this. 

Regards, 
Kumaravel 


Loader.
Up arrow icon