当前位置:网站首页>【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")
边栏推荐
- Hongmi K40S root gameplay notes
- 使用Thread类和Runnable接口实现多线程的区别
- 复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
- 10 ways of interface data security assurance
- map和set的实现
- [hcie TAC] question 3
- Allow public connections to local Ruby on Rails Development Server
- 25. (ArcGIS API for JS) ArcGIS API for JS line modification line editing (sketchviewmodel)
- 【DPDK】dpdk样例源码解析之三:dpdk-l3fwd_001
- Antd Comment 递归循环评论
猜你喜欢
Kotlin Android environment construction
ABAP 动态内表分组循环
Force buckle ----- path sum III
力扣------路径总和 III
Operational amplifier application summary 1
Huawei and Xiaomi "copy each other"
24. (ArcGIS API for JS) ArcGIS API for JS point modification point editing (sketchviewmodel)
codeforces每日5题(均1700)-第七天
QT 使用QToolTip 鼠标放上去显示文字时会把按钮的图片也显示了、修改提示文字样式
Hisilicon 3559 universal platform construction: RTSP real-time playback support
随机推荐
Vernacular high concurrency (2)
【安全攻防】序列化與反序列,你了解多少?
维护万星开源向量数据库是什么体验
Kotlin Android environment construction
使用Thread类和Runnable接口实现多线程的区别
Kbone与小程序跨端开发的一些思考
2022年上半年HIT行业TOP50
手机号国际区号JSON格式另附PHP获取
What is the experience of maintaining Wanxing open source vector database
你心目中的数据分析 Top 1 选 Pandas 还是选 SQL?
Delete data in SQL
First understand the principle of network
Class常量池与运行时常量池
One of oscp tools: dirsearch usage Encyclopedia
Arduino droplet detection
1200.Minimum Absolute Difference
R data analysis: how to predict Cox model and reproduce high score articles
[safe office and productivity application] Shanghai daoning provides you with onlyoffice download, trial and tutorial
二叉搜索树的实现
C task expansion method