Reputation: 409
When making a Bar chart with percentage label, I am using this way.
Excel.DataLabel dl1 = (Excel.DataLabel)series.DataLabels(0);
dl1.NumberFormat = "0.00%;-0.00%;";
By putting this format, it would multyply 100 to input values. That is fine. But the problem is the Axis measure values show like:
How can I fix it? Or any other ways to add '%' to value labels? Thanks.
Upvotes: 1
Views: 641
Reputation: 1466
You'll need to select the X axis of the chart and then change the format of the TickLabels.NumberFormat
property:
// Select the X axis
var xAxis = (Axis)yourChart.Axes(XlAxisType.xlCategory, XlAxisGroup.xlPrimary);
// Update the format of the tick labels
xAxis.TickLabels.NumberFormat = "0.00%;";
Upvotes: 1