We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
While running world_obesity.ipynb on local python, not using docker, I got the following error:
Only JavaScript callbacks may be used with standalone output. For more information on JavaScript callbacks with Bokeh, see: https://docs.bokeh.org/en/latest/docs/user_guide/interaction/callbacks.html
How to update the Custom JS callback js_on_change for update_plot function:
# Define the callback function: def update_plot(attr, old, new): yr = slider.value new_data = json_data(yr) geosource.geojson = new_data p.title.text = 'Share of adults who are obese, %d' %yr slider = Slider(title = 'Year',start = 1975, end = 2016, step = 1, value = 2016) slider.on_change('value', update_plot)
and the function it is calling: def json_data(selectedYear): yr = selectedYear df_yr = df[df['year'] == yr] merged = gdf.merge(df_yr, left_on = 'country_code', right_on = 'code', how = 'left') merged.fillna('No data', inplace = True) merged_json = json.loads(merged.to_json()) json_data = json.dumps(merged_json) return json_data
def json_data(selectedYear): yr = selectedYear df_yr = df[df['year'] == yr] merged = gdf.merge(df_yr, left_on = 'country_code', right_on = 'code', how = 'left') merged.fillna('No data', inplace = True) merged_json = json.loads(merged.to_json()) json_data = json.dumps(merged_json) return json_data
The text was updated successfully, but these errors were encountered:
Try adding this in your ipynb notebook:-
from bokeh.resources import INLINE import bokeh.io bokeh.io.output_notebook(INLINE)
Sorry, something went wrong.
No branches or pull requests
While running world_obesity.ipynb on local python, not using docker, I got the following error:
Only JavaScript callbacks may be used with standalone output. For more
information on JavaScript callbacks with Bokeh, see: https://docs.bokeh.org/en/latest/docs/user_guide/interaction/callbacks.html
How to update the Custom JS callback js_on_change for update_plot function:
# Define the callback function: def update_plot(attr, old, new): yr = slider.value new_data = json_data(yr) geosource.geojson = new_data p.title.text = 'Share of adults who are obese, %d' %yr slider = Slider(title = 'Year',start = 1975, end = 2016, step = 1, value = 2016) slider.on_change('value', update_plot)
and the function it is calling:
def json_data(selectedYear): yr = selectedYear df_yr = df[df['year'] == yr] merged = gdf.merge(df_yr, left_on = 'country_code', right_on = 'code', how = 'left') merged.fillna('No data', inplace = True) merged_json = json.loads(merged.to_json()) json_data = json.dumps(merged_json) return json_data
The text was updated successfully, but these errors were encountered: