Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Bokeh - Dynamic allocation of value to legend in streaming chart


I have a Streaming Chart where the scores are updated in realtime. I am plotting a graph to show the value as a line graph for Student X. I want the Legend to be updated dynamically(either show as legend in the chart or display the name of the student on mouseover). Below is the code which works perfectly fine without "legend" but when I try to add the legend I get the below error.

How can I show the value dynamically using legend or using mouseover event or if possible any other way?


p = figure(title="Low Percentage", x_axis_label='Time',
r1 = p.line(x = [], y = [], legend = [], color="firebrick", line_width=2)
ds1 = r1.data_source

def update(step):
test = pd.read_json('c:/scores.csv', orient='columns')
test2 = pd.read_json( (test['result']).to_json(), orient='index')
df2=df.sort_values(by='Low_Perc', ascending=False)
y = df2['Low_Perc'].iat[0]
name = df7['Name'].iat[0]
curdoc().add_periodic_callback(update, 30000)


Error thrown from periodic callback: KeyError('legend',)

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Bokeh - Dynamic allocation of value to legend in streaming chart


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription