代码:
要在Excel工作表上使用用户定义的分段颜色绘制饼图,请使用add_series()
带有图表对象的points关键字参数的方法。
# import xlsxwriter module
import
xlsxwriter
# Workbook() takes one, non-optional, argument
# which is the filename that we want to create.
workbook =
xlsxwriter.Workbook('chart_doughnut2.xlsx')
# The workbook object is then used to add new
# worksheet via the add_worksheet() method.
worksheet =
workbook.add_worksheet()
# Create a new Format object to formats cells
# in worksheets using add_format() method .
# here we create bold format object .
bold =
workbook.add_format({'bold': 1})
# Add the worksheet data that the charts will refer to.
headings =
['Category', 'Values']
data =
[
['Glazed', 'Chocolate', 'Cream'],
[50, 35, 15],
]








暂无数据