当前位置:网站首页>【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")
边栏推荐
猜你喜欢
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
什么是 BA ?BA怎么样?BA和BI是什么关系?
Introduction to opensea platform developed by NFT trading platform (I)
Construction of Hisilicon universal platform: color space conversion YUV2RGB
海思万能平台搭建:颜色空间转换YUV2RGB
Kbone与小程序跨端开发的一些思考
Confirm the future development route! Digital economy, digital transformation, data This meeting is very important
Open3d mesh filtering
你心目中的数据分析 Top 1 选 Pandas 还是选 SQL?
[hcie TAC] question 3
随机推荐
你心目中的数据分析 Top 1 选 Pandas 还是选 SQL?
自适应非欧表征广告检索系统AMCAD
Ggplot facet detail adjustment summary
太方便了,钉钉上就可完成代码发布审批啦!
Construction of Hisilicon universal platform: color space conversion YUV2RGB
QT opens a file and uses QFileDialog to obtain the file name, content, etc
[hcie TAC] question 3
Hongmi K40S root gameplay notes
Baidu map JS development, open a blank, bmapgl is not defined, err_ FILE_ NOT_ FOUND
Mysql-数据丢失,分析binlog日志文件
HW notes (II)
[safe office and productivity application] Shanghai daoning provides you with onlyoffice download, trial and tutorial
使用 BR 恢复 GCS 上的备份数据
PHP lightweight Movie Video Search Player source code
[leetcode] 450 and 98 (deletion and verification of binary search tree)
map和set的实现
机器学习笔记 - 使用机器学习进行鸟类物种分类
About Estimation Statistics
1200.Minimum Absolute Difference
PIP download only, not install