I'm trying to create excel pie charts with xlsxwriter in python. I have the following script
def add_pie_slice(workbook, sheet, subtotal_cell, rest_cell, rotation, color, cell,width, height):
piechart = workbook.add_chart({'type': 'pie'})
piechart.add_series(
{
'values': f"={sheet.name}!{subtotal_cell}:{rest_cell}",
'points': [
{'fill': {'color': color}},
{'fill': {'color': 'gray'}},
],
}
)
piechart.set_rotation(rotation)
piechart.set_size({'width': width, 'height': height})
piechart.set_legend({'none': True})
sheet.insert_chart(cell, piechart, {'x_offset': 0, 'y_offset': 0})
It works of I set the rotation as a number, but I want to set it as a reference to a cell in the workbook. When I try to do this, i get the following TypeError:
TypeError: '<' not supported between instances of 'str' and 'int'
Is there a workaround to give a reference to a cell as a parameter?