Skip to content

Instantly share code, notes, and snippets.

@dradecic
Created August 25, 2019 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dradecic/dc55f1586921c1f4895e7cdd4d38e103 to your computer and use it in GitHub Desktop.
Save dradecic/dc55f1586921c1f4895e7cdd4d38e103 to your computer and use it in GitHub Desktop.
Python-Bokeh - Gist 12: Route final
@app.route('/', methods=['GET', 'POST'])
def chart():
selected_class = request.form.get('dropdown-select')
if selected_class == 0 or selected_class == None:
survived_chart, title_chart, hist_age = redraw(1)
else:
survived_chart, title_chart, hist_age = redraw(selected_class)
script_survived_chart, div_survived_chart = components(survived_chart)
script_title_chart, div_title_chart = components(title_chart)
script_hist_age, div_hist_age = components(hist_age)
return render_template(
'index.html',
div_survived_chart=div_survived_chart,
script_survived_chart=script_survived_chart,
div_title_chart=div_title_chart,
script_title_chart=script_title_chart,
div_hist_age=div_hist_age,
script_hist_age=script_hist_age,
selected_class=selected_class
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment