如何自定义条形图标签?

How can I customize Bar Chart labels?

代码是我写的

chart2_values = Reference(sheet, min_col=6, min_row=1, max_col=10, max_row=13)
chart2_labels = Reference(sheet, min_col=5, min_row=2, max_row=3)
chart2 = BarChart(gapWidth=50,)
chart2.add_data(chart2_values, titles_from_data=True)
chart2.set_categories(chart2_labels)
chart2.title = "Ausgaben"
chart2.y_axis.scaling.orientation = "maxMin"
chart2.legend.position = "l"

chart2.style = 13
chart2.dataLabels = DataLabelList() 
chart2.dataLabels.showVal = True
chart2.height = 20 # default is 7.5
chart2.width = 50

sheet.add_chart(chart2, "K03")

为我的目的创建条形图。现在标签就在我的条形图的中间,这让整个事情有点混乱。 See this Image 其中 "January" 和 "February" 正好在横条上方。

是否可以将它们设置在条形下方或整个图表的顶部?

Here is the Data for the Bar Plot

干杯

拉菲

这实际上很容易做到,但我必须进行一些挖掘才能找到它:

chart2.x_axis.tickLblPos = "low" #this is actually at the top of the graph

将其添加到您的代码中会产生: