Skip to content

Instantly share code, notes, and snippets.

@ivanliu
Created March 26, 2017 23:03
Show Gist options
  • Save ivanliu/cef5e4e1d922a2712073f556a57029fc to your computer and use it in GitHub Desktop.
Save ivanliu/cef5e4e1d922a2712073f556a57029fc to your computer and use it in GitHub Desktop.
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
xAxis = {"categories": ['xAxis Data1', 'xAxis Data2', 'xAxis Data3']}
yAxis = {"title": {"text": 'yAxis Label'}}
return render_template('index.html', chartID=chartID, chart=chart, series=series, title=title, xAxis=xAxis, yAxis=yAxis)
if __name__ == "__main__":
app.run(debug = True, host='0.0.0.0', port=8080, passthrough_errors=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment