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%"; |
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%"; |
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?
//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%"; |
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
//To hide the label hudreds in y- axis
chart.PrimaryValueAxis.HasDisplayUnitLabel = false; |