0

How to set the 'Angle of first slice' on a doughnut chart in Python openpyxl?

For a simple doughnut chart like:

    chart = DoughnutChart()
    labels = Reference(WorkSheet, min_col=1, min_row=2, max_row=5)
    data = Reference(WorkSheet, min_col=1, min_row=1, max_row=5)
    chart.add_data(data, titles_from_data=True)
    chart.set_categories(labels)

I have a few slices like:

slices = [DataPoint(idx=i) for i in range(4)]
plain, jam, lime, chocolate = slices
chart.series[0].data_points = slices
plain.graphicalProperties.solidFill = "FAE1D0"
jam.graphicalProperties.solidFill = "BB2244"
lime.graphicalProperties.solidFill = "22DD22"
chocolate.graphicalProperties.noFill = True

How can a rotate the first slice or set the excel chart setting for "Angle of first slice". I don;t see anything like this in the openpyxl "Read the Docs".

Maybe something like:

chocolate.rot = "-270"

Can this be done with another library? (xlsxwriter)

Thanks!!

Mattman85208
  • 1,858
  • 2
  • 29
  • 51

0 Answers0