INNER CODE UNIT · Python
max_col
fzumstein/python-for-excel · sales_report_openpyxl.py:124
max_col=startcol + ncols - 1,
)
categories = Reference(
sheet, min_col=startcol, min_row=startrow + 1, max_row=startrow + nrows - 1
)
chart.add_data(data, titles_from_data=True)
chart.set_categories(categories)
anchor_cell = sheet.cell(row=startrow + nrows + 2, column=startcol)
sheet.add_chart(chart=chart, anchor=anchor_cell.coordinate)
# Chart formatting
chart.y_axis.title = "Sales"
chart.x_axis.title = summary.index.name
# Hide y-axis line: spPR stands for ShapeProperties
chart.y_axis.spPr = GraphicalProperties(ln=LineProperties(noFill=True))