Skip to content

Commit

Permalink
add web
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Nov 28, 2023
1 parent 641c880 commit ab2d805
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 78 deletions.
157 changes: 79 additions & 78 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/resources/resource.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<file>icons/search.svg</file>
<file>icons/word.svg</file>
<file>version_list.json</file>
<file>icons/logo.ico</file>
<file>icons/logo.png</file>
</qresource>
<qresource prefix="/data">
<file>version_list.json</file>
Expand Down
Empty file added app/web_ui/__init__.py
Empty file.
48 changes: 48 additions & 0 deletions app/web_ui/web.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from flask import Flask, render_template
from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.globals import ThemeType

app = Flask(__name__)


@app.route("/")
def index():
# 创建一个简单的柱状图
bar = (
Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT))
.add_xaxis(["A", "B", "C", "D", "E"])
.add_yaxis("Series", [5, 20, 36, 10, 75])
.set_global_opts(title_opts=opts.TitleOpts(title="Flask and Pyecharts Interaction"))
)

# 将图表转换成 HTML
chart_html = bar.render_embed()

# 渲染模板,并传递图表的 HTML 到模板中
return render_template("index.html", chart_html=chart_html)


@app.route("/index")
def index0():
return render_template("index.html")


@app.route('/home')
def home():
data = {
'sub_title': '二零二三年度报告',
'avatar_path': "static/my_resource/avatar.png",
'nickname': '司小远',
'first_time': '2023-09-18 20:39:08',
}
return render_template('home.html', **data)


@app.route('/message_num')
def one():
return "1hello world"


if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0')

0 comments on commit ab2d805

Please sign in to comment.