I am using XlsxWriter to do create column charts with the y axis name showing horizontally at the top of the axis. The default orientation for the y axis name seems to be vertical, reading from bottom to top.
So I'm using the name font rotation to try to position it horizontally, reading from left to right. It all works fine for any rotation angle from -90 to 90, except for 0 (zero), which should be the horizontal orientation. It seems that when rotation is set to 0 (zero) it is simply disregarded and the name is shown vertically.
The workaround that achieves a visuaaly acceptable result is setting rotation to 1, or -1. This works for short names, but for longer names it starts to be noticeable that the text is not at 0 (zero) degrees - horizontal.
I am using Python version Python 3.8.3, xlsxwriter version 1.2.9, and Excel 365.
Here is some code that demonstrates the problem:
workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet()
chart = workbook.add_chart({'type': 'column'})
data = [
[1, 2, 3, 4, 5],
[2, 4, 6, 8, 10],
[3, 6, 9, 12, 15],
]
worksheet.write_column('A1', data[0])
worksheet.write_column('B1', data[1])
worksheet.write_column('C1', data[2])
chart.add_series({'values': '=Sheet1!$A$1:$A$5'})
chart.set_title({'name': 'Some Title',
'name_font': {'rotation': 0}})
chart.set_y_axis({'visible': False,
'name': 'Y Axis',
'name_font': {'size': 14, 'bold': False, 'italic': True, 'rotation': 0},
'name_layout': {'x': 0.025, 'y': 0.075}})
worksheet.insert_chart('E1', chart)
workbook.close()
Any ideas on how to show the y axis name horizontally?
