Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
31d5610a
Commit
31d5610a
authored
Nov 19, 2020
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils
parent
d9d3e5a5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
draw.py
app/utils/draw.py
+44
-0
html_to_pdf.py
app/utils/html_to_pdf.py
+27
-0
No files found.
app/utils/draw.py
0 → 100644
View file @
31d5610a
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name : draw.py
# @Time : 2020/11/19 上午10:51
# @Author : X. Peng
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
import
numpy
as
np
import
matplotlib.pyplot
as
plt
def
draw_stacked_column_chart
():
"""堆叠柱状图"""
plt
.
title
(
'Scores by group and gender'
)
N
=
13
ind
=
np
.
arange
(
N
)
# [ 0 1 2 3 4 5 6 7 8 9 10 11 12]
plt
.
xticks
(
ind
,
(
'G1'
,
'G2'
,
'G3'
,
'G4'
,
'G5'
,
'G6'
,
'G7'
,
'G8'
,
'G9'
,
'G10'
,
'G11'
,
'G12'
,
'G13'
))
plt
.
ylabel
(
'Scores'
)
plt
.
yticks
(
np
.
arange
(
0
,
81
,
20
))
Bottom
=
(
52
,
49
,
48
,
47
,
44
,
43
,
41
,
41
,
40
,
38
,
36
,
31
,
29
)
Center
=
(
38
,
40
,
45
,
42
,
48
,
51
,
53
,
54
,
57
,
59
,
57
,
64
,
62
)
Top
=
(
10
,
11
,
7
,
11
,
8
,
6
,
6
,
5
,
3
,
3
,
7
,
5
,
9
)
d
=
[]
for
i
in
range
(
0
,
len
(
Bottom
)):
sum
=
Bottom
[
i
]
+
Center
[
i
]
d
.
append
(
sum
)
width
=
0.35
# 设置条形图一个长条的宽度
p1
=
plt
.
bar
(
ind
,
Bottom
,
width
,
color
=
'blue'
)
p2
=
plt
.
bar
(
ind
,
Center
,
width
,
bottom
=
Bottom
,
color
=
'green'
)
p3
=
plt
.
bar
(
ind
,
Top
,
width
,
bottom
=
d
,
color
=
'red'
)
plt
.
legend
((
p1
[
0
],
p2
[
0
],
p3
[
0
]),
(
'Bottom'
,
'Center'
,
'Top'
),
loc
=
3
)
plt
.
show
()
if
__name__
==
'__main__'
:
draw_stacked_column_chart
()
app/utils/html_to_pdf.py
0 → 100644
View file @
31d5610a
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name : html_to_pdf.py
# @Time : 2020/11/19 上午11:07
# @Author : X. Peng
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
import
pdfkit
def
html_to_pdf
():
options
=
{
'encoding'
:
"utf-8"
,
# 'page-size': 'A5',
'page-width'
:
'300mm'
,
'page-height'
:
'[200mm,100mm,50mm]'
,
'margin-top'
:
'0mm'
,
'margin-right'
:
'0mm'
,
'margin-bottom'
:
'0mm'
,
'margin-left'
:
'0mm'
}
pdfkit
.
from_url
(
'https://www.taobao.com'
,
'/Users/pengxiong/Desktop/out.pdf'
,
options
=
options
)
if
__name__
==
'__main__'
:
html_to_pdf
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment