[python]代码库
import xlsxwriter
workbook = xlsxwriter.Workbook("图表数据.xlsx")
worksheet = workbook.add_worksheet(name="")
data = [
["IOS岗位数", "Android岗位数", "Python岗位数", "物联网岗位数", "Go与区块链岗位数"],
[2000, 4000, 60000, 8000, 1000],
]
worksheet.write_column('A1', data[0])
worksheet.write_column('B1', data[1])
# Create a new Chart object.
chart = workbook.add_chart({'type': 'pie'})
chart.add_series({
'categories': '=Sheet1!$A$1:$A$5',
'values': '=Sheet1!$B$1:$B$5',
'line': {'color': 'red'},
'name': '各岗位数汇总',
})
chart.set_title({'name': '各岗位数汇总_图表'})
chart.set_style(10)
# Insert the chart into the worksheet.
worksheet.insert_chart('A7', chart)
workbook.close()