Hi guys,
In my project I am using Flask together with a Bokeh-server in order to use Bokeh-widgets, but in this case I need to update the plot depending on the employer name I get from a html form. Updating title and x_range as shown below works totally fine, but instead of replacing the old vbar I am just adding a new one.
Is there a way of removing the old vbar or changing the data of the old vbar directly?
Thank you very much for any help and if you need more information please let me know!
Best,
Johannes
bokeh == 1.1.0
flask == 1.0.2
OS == macOS 10.14.4
@app.route('/visits_chart', methods=['GET'])
def visits_chart():
employer_name = request.args.get('employer_name')
session = pull_session(url='http://' + config.bokeh_IP + ':5006/visits_plot')
script = server_session(session_id=session.id, url='http://' + config.bokeh_IP + ':5006/visits_plot')
employer_id = queries.get_employer_id(employer_name)
new_data = utils.get_value_dict('Number of Visits|' + str(employer_id), config.Visit.default_time_interval, '', '')
session.document.roots[0].children[0].x_range.factors = list(new_data['number_of_names'])
session.document.roots[0].children[0].title.text = employer_name
session.document.roots[0].children[0].vbar(x='number_of_names', top='count', width=0.5, bottom=0, color='#9ACD32',
source=ColumnDataSource(data=new_data))
push_session(document=session.document, session_id='v2sv9095MUCX01tmFcMgY0wX4GWx3oarRzgUhofVgiYH',
url='http://' + config.bokeh_IP + ':5006/visits_plot')
return render_template('visits_chart.html', script=script, template='Flask', employer_name=employer_name)