1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| from flask import Flask from sklearn.externals import joblib from flask import Flask,render_template,url_for import pyecharts
server = Flask(__name__)
def render_test_1(): attr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3] v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] line = pyecharts.Line("Title1", "Title2") line.add("v1", attr, v1, mark_point=['average']) line.add("v2", attr, v2, mark_line=['average'], is_smooth=True) line.render('templates/bar01.html')
@server.route('/') def do_main(): render_test_1() return render_template('bar01.html')
if __name__ == '__main__': server.run(debug=True, port=9993, host="0.0.0.0")
|