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
82e9a4c1
Commit
82e9a4c1
authored
Dec 08, 2020
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
html转pdf去掉中间文件
parent
840e95b9
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
14 additions
and
11 deletions
+14
-11
USER_INFO15914346866762_202009281545001_20201109_monthly_return_performance.png
...2_202009281545001_20201109_monthly_return_performance.png
+0
-0
backimg.png
app/html/img/backimg.png
+0
-0
logo-blue.png
app/html/img/logo-blue.png
+0
-0
logo.png
app/html/img/logo.png
+0
-0
scene.png
app/html/img/scene.png
+0
-0
target-back.png
app/html/img/target-back.png
+0
-0
team.png
app/html/img/team.png
+0
-0
cover-back.png
app/html/v2/img/cover-back.png
+0
-0
logo.png
app/html/v2/img/logo.png
+0
-0
scene.png
app/html/v2/img/scene.png
+0
-0
team.png
app/html/v2/img/team.png
+0
-0
jinjia2html.py
app/utils/jinjia2html.py
+0
-1
radar_chart.py
app/utils/radar_chart.py
+14
-10
No files found.
app/html/img/USER_INFO15914346866762_202009281545001_20201109_monthly_return_performance.png
deleted
100644 → 0
View file @
840e95b9
55.8 KB
app/html/img/backimg.png
deleted
100644 → 0
View file @
840e95b9
598 KB
app/html/img/logo-blue.png
deleted
100644 → 0
View file @
840e95b9
17.5 KB
app/html/img/logo.png
deleted
100644 → 0
View file @
840e95b9
26.9 KB
app/html/img/scene.png
deleted
100644 → 0
View file @
840e95b9
This diff is collapsed.
Click to expand it.
app/html/img/target-back.png
deleted
100644 → 0
View file @
840e95b9
36 KB
app/html/img/team.png
deleted
100644 → 0
View file @
840e95b9
321 KB
app/html/v2/img/cover-back.png
deleted
100644 → 0
View file @
840e95b9
257 KB
app/html/v2/img/logo.png
deleted
100644 → 0
View file @
840e95b9
6.92 KB
app/html/v2/img/scene.png
deleted
100644 → 0
View file @
840e95b9
285 KB
app/html/v2/img/team.png
deleted
100644 → 0
View file @
840e95b9
109 KB
app/utils/jinjia2html.py
View file @
82e9a4c1
...
...
@@ -243,7 +243,6 @@ class DataIntegrate:
# template = env.get_template('monthReport.html') # 获取一个模板文件
template
=
env
.
get_template
(
'/v2/monthReportV2.html'
)
# 获取一个模板文件
monthReport_html
=
template
.
render
(
data
)
# 渲染
# 保存 monthReport_html
# save_file = "app/html/monthReport.html"
# with open(save_file, 'w', encoding="utf-8") as f:
...
...
app/utils/radar_chart.py
View file @
82e9a4c1
...
...
@@ -6,7 +6,10 @@
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
import
base64
import
os
import
time
from
io
import
BytesIO
import
imgkit
...
...
@@ -15,6 +18,7 @@ from pyecharts.charts import Radar, Bar
import
uuid
import
cv2
from
app.api.engine
import
work_dir
import
numpy
as
np
def
gen_radar_chart
(
radar_chart_data
):
...
...
@@ -24,7 +28,6 @@ def gen_radar_chart(radar_chart_data):
目前无法实现的功能:
1、雷达图周围的图例的 textStyle 暂时无法设置背景颜色
"""
# v1 = [[4300, 10000, 28000, 35000, 50000]]
radar_chart
=
radar_chart_data
[
'data'
][
0
:
5
]
v1
=
[[
data
[
'data'
]
for
data
in
radar_chart
]]
radar
=
Radar
(
...
...
@@ -70,21 +73,22 @@ def gen_radar_chart(radar_chart_data):
}),
legend_opts
=
opts
.
LegendOpts
(
selected_mode
=
False
,
is_show
=
False
)
)
html_name
=
work_dir
+
'/app/html/'
+
str
(
uuid
.
uuid4
())
+
'.html'
img_name
=
work_dir
+
'/app/html/img/radar_chart_'
+
str
(
uuid
.
uuid4
())
+
'.png'
radar
.
render
(
html_name
)
imgkit
.
from_file
(
html_name
,
img_name
)
html
=
radar
.
render_embed
()
start
=
time
.
time
()
image_bin
=
imgkit
.
from_string
(
html
,
None
)
print
(
'propose_fund cost'
,
time
.
time
()
-
start
)
# 读取图片
img
=
cv2
.
imread
(
img_name
)
img1
=
np
.
frombuffer
(
image_bin
,
np
.
uint8
)
img
=
cv2
.
imdecode
(
img1
,
cv2
.
IMREAD_ANYCOLOR
)
# 获取宽度和高度
height
=
len
(
img
)
width
=
len
(
img
[
0
])
img
=
img
[
0
:
height
,
160
:
750
]
cv2
.
imwrite
(
img_name
,
img
)
os
.
popen
(
'rm -f {}'
.
format
(
html_name
))
return
img_name
img_bin
=
cv2
.
imencode
(
".png"
,
img
)[
1
]
.
tobytes
()
img_content
=
'data:image/png;base64,'
+
base64
.
b64encode
(
img_bin
)
.
decode
(
'utf-8'
)
return
img_content
if
__name__
==
'__main__'
:
gen_radar_chart
()
\ No newline at end of file
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