我想创建一个饼图,我有以下代码,但是在图例(标签)上不起作用,它仅显示2个图例(标签),应该有6个
def function1(x,y,cell_title,where_to_add):
pie = PieChart()
labels = Reference(ws, min_row=3, min_col=x, max_col=y)
data = Reference(ws, min_row=39, min_col=x, max_col=y)
pie.add_data(data, titles_from_data=True)
pie.set_categories(labels)
pie.title = ws[cell_title].value+' (%)'
pie.dLbls = DataLabelList()
pie.dLbls.showVal = True
ws1.add_chart(pie, where_to_add)
function1(6, 11,'F2','U1')
任何想法为何?也许有帮助吗? :d谢谢!