无法为反转图形填充颜色。
在XlsxWriter图表中,您可以使用invert_if_negative
系列属性(see docs)。例如:
import xlsxwriter
workbook = xlsxwriter.Workbook('chart.xlsx')
worksheet = workbook.add_worksheet()
# Create a new Chart object.
chart = workbook.add_chart({'type': 'column'})
# Write some data to add to plot on the chart.
worksheet.write_column('A1', [1, 3, -2, 1, -1])
# Configure the chart.
chart.add_series({'values': '=Sheet1!$A$1:$A$5',
'invert_if_negative': True})
# Insert the chart into the worksheet.
worksheet.insert_chart('C2', chart)
workbook.close()
输出:
我如何自定义y轴值。从文档中找不到任何帮助。