当前位置:网站首页>【OA】Excel 文档生成器: Openpyxl 模块
【OA】Excel 文档生成器: Openpyxl 模块
2022-07-06 21:20:00 【Allen Moore】
Openpyxl 模块
1. 面积图 Area Chart
from openpyxl import Workbook
from openpyxl.chart import (
AreaChart,
Reference,
Series,
)
wb = Workbook()
ws = wb.active
rows = [
['序号', '批次 1', '批次 2'],
[2, 40, 30],
[3, 40, 25],
[4, 50, 30],
[5, 30, 10],
[6, 25, 5],
[7, 50, 10],
]
for row in rows:
ws.append(row)
chart = AreaChart()
chart.title = "区域图"
chart.style = 13
chart.x_axis.title = '测试'
chart.y_axis.title = '百分比'
cats = Reference(ws, min_col=1, min_row=1, max_row=7)
data = Reference(ws, min_col=2, min_row=1, max_col=3, max_row=7)
chart.add_data(data, titles_from_data=True)
chart.set_categories(cats)
ws.add_chart(chart, "A10")
wb.save("区域图样例.xlsx")
边栏推荐
- 未来发展路线确认!数字经济、数字化转型、数据...这次会议很重要
- Native MySQL
- [leetcode] 450 and 98 (deletion and verification of binary search tree)
- PHP 实现根据概率抽奖
- Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
- 自适应非欧表征广告检索系统AMCAD
- 运算放大器应用汇总1
- Preprocessing - interpolation
- tflite模型转换和量化
- SSL证书部署
猜你喜欢
随机推荐
It's too convenient. You can complete the code release and approval by nailing it!
[safe office and productivity application] Shanghai daoning provides you with onlyoffice download, trial and tutorial
【安全攻防】序列化与反序列,你了解多少?
再AD 的 界面顶部(菜单栏)创建常用的快捷图标
API data interface of A-share index component data
未来发展路线确认!数字经济、数字化转型、数据...这次会议很重要
1.19.11.SQL客户端、启动SQL客户端、执行SQL查询、环境配置文件、重启策略、自定义函数(User-defined Functions)、构造函数参数
Clock in during winter vacation
[leetcode] 450 and 98 (deletion and verification of binary search tree)
MySQL的索引
VHDL implementation of single cycle CPU design
NoSQL之Redis配置与优化
【mysql】mysql中行排序
Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
About Confidence Intervals
codeforces每日5题(均1700)-第七天
On file uploading of network security
[hcie TAC] question 3
【开发软件】 tilipa开发者软件
About Estimation Statistics