C#Excel.Chart条形图轴单元问题

制作带有百分比标签的条形图时,我正在使用这种方式。

Excel.DataLabel dl1 = (Excel.DataLabel)series.DataLabels(0); dl1.NumberFormat = "0.00%;-0.00%;"; 

通过使用这种格式,它将多次input100个值。 没事儿。 但问题是Axis的度量值显示如下:

在这里输入图像说明

我该如何解决? 或者用其他方式给值标签添加'%'? 谢谢。

您需要select图表的X轴,然后更改TickLabels.NumberFormat属性的格式:

  // 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%;";