I am rendering multiple bokeh charts using FLASK currently and everything is working great. I render the charts with
@app.route("/")
def Maestro():
Configure resources to include BokehJS inline in the document.
For more details see:
http://bokeh.pydata.org/en/latest/docs/reference/resources_embedding.html#bokeh-embed
For more details see:
http://bokeh.pydata.org/en/latest/docs/user_guide/embedding.html#components
html = flask.render_template(
‘embed.html’,
vioAll_script=vioAllScript,
vioClin_script=vioClinScript,
vioCoh_script=vioCohScript,
vioAll_div=vioAlldiv,
vioClin_div=vioClindiv,
vioCoh_div=vioCohdiv,
barAll_script=barAllScript,
barClin_script=barClinScript,
barCoh_script=barCohScript,
barAll_div=barAlldiv,
barClin_div=barClindiv,
barCoh_div=barCohdiv,
js_resources=js_resources,
css_resources=css_resources,
)
return encode_utf8(html)
``
However, I now have a POST request in FLASK that handles some input and recalculates charts to regraph. I am wondering what is the appropriate way to do this. My code is below.
@app.route("/refresh", methods=[“GET”, “POST”])
def Refresh():
message = None
startDate = request.form[“mydata”].encode(‘utf8’)
vioAll = refreshViolinPlot(startDate)
tabsAll = buildTabs(tabvioAll, tabBarAll)
vioAllScript, vioAlldiv = components(vioAll, tabsAll, INLINE)
result = (encode_utf8(vioAllScript))
resp = make_response(result)
html = flask.render_template(
‘embed.html’,
vioAll_script=vioAllScript,
vioAll_div=vioAlldiv,
js_resources=js_resources,
css_resources=css_resources
)
return resp
return encode_utf8(html)
``
I am trying to update only one bokeh chart with this POST method but I feel as if this attempt is wrong somewhere…