Using Select and a CustomJS callback with complex AjaxDataSource

Hello everybody!

I am trying to have a nice front-end with Bottle and Bokeh. In order to reduce the complexity of my stack, I would avoid running a bokeh server.

So, I want to use a AjaxDataSource. The data is served as a json like

{‘x’:
some_data,
‘h’:
some_data,

}

``

and the python code look like

source = = AjaxDataSource(data_url=’/simulation/data’
polling_interval=500)
x = np.linspace(0, 1, 10)
fig = Figure()
line = fig.line(“x”, “h”, source=ajax_source)

callback = CustomJS(args={‘line’: line},
lang=‘coffeescript’,
code="""
new_field = cb_obj.get(‘value’);
line.glyph.attribute.y = new_field
“”")
select_plot = Select(
title=“Fonction:”, value=“h”, options=[‘h’, ‘q’],
callback=callback)
components = vform(select_plot, fig)
output_file(’/tmp/bokeh.html’)
show(components)

``

I want that the line plot use the column data according to the Select value. And I have a lot of difficulties doing that…

The bokeh figure is plotting the first field (‘h’), but nothing happen when the Select widget change.

Some idea?

Thanks!