Reputation: 709
I have written a python class that is capable of live plotting data in different graphs. It is based on python bokeh. Basically it is an abstraction of embedding bokeh server as a library and it is capable to dynamically add and remove figures and line glyphs during runtime. To make this happen in a non-blocking manner the main class extends multithreading.Thread. All codes can be found here.
An issue I encountered is that figures are not always rendered correctly. Often Title and Toobar of the figures are not rendered, as shown here (click on it to have a larger view on the gif):
Following javascript Error is thrown in the debug console of the browser (google chrome):
Uncaught TypeError: Cannot read property 'draw_legend' of undefined
To add figures during runtim I am using the code bellow, where fig is a dictionary, which contains all figure objects in my projects and cds is a dictionary of all corresponding ColumnDataSource objects:
if not fig_name in fig:
print('add fig ' + fig_name)
# create plot
TOOLS="pan,wheel_zoom,box_zoom,reset, save, tap, hover"
fig[fig_name]=figure(plot_width=900, plot_height=280, tools=TOOLS, toolbar_location='right', logo=None, title=(fig_name), name=str(fig_name))
cds[fig_name]=ColumnDataSource(data=dict(x=np.array([])), name=(fig_name+'_cds'))
plt_col=doc.get_model_by_name('plt_ui_col').children
plt_col.append( fig[fig_name] )
Is this a bug of bokeh?
Am I missing something? (Maybe the creation of some classes, that the figures depend on?)
I am using python3.6 and bokeh 0.12.16.
Upvotes: 1
Views: 646
Reputation: 34568
This is probably https://github.com/bokeh/bokeh/issues/7497 I'd suggest you add any detailed information you can there.
Upvotes: 2