A simple flask server && A simple html with webpack
@app.route('/opt/bar')
def bar():
chart = Echart('GDP', 'This is a fake chart')
chart.use(Bar('China', [2, 3, 4, 5]))
chart.use(Legend(['GDP']))
chart.use(Axis('category', 'bottom', data=['Nov', 'Dec', 'Jan', 'Feb']))
return jsonify(chart.json)// XHR callback
function callback () {
var chart = echarts.init(document.getElementById('main'));
chart.setOption(response.data)
}fetch('http://127.0.0.1:5000/opt/bar').then(resp => {
var chart = echarts.init(document.getElementById('main'));
chart.setOption(response.data)
})pip install -r requirements.txt
python -m index
sudo npm install
webpack
python -m SimpleHTTPServer
open http://localhost:8000/