Bokeh chart is disappearing on Mouse hover

Bokeh chart is disappearing on Mouse hover on line plot
Libraries used -

Sample code-

import streamlit as st
from bokeh.models import HoverTool, ColumnDataSource,DateFormatter, NumberFormatter
from bokeh.plotting import figure, output_file, show
from numpy import source
import pandas as pd
import numpy as np

if __name__ == '__main__':
    year = [1960, 1970, 1980, 1990, 2000, 2010]
    pop_pakistan = [44.91, 58.09, 78.07, 107.7, 138.5, 170.6]
    pop_india = [449.48, 553.57, 696.783, 870.133, 1000.4, 1309.1]
    output_file('line.html', mode='inline')
    plot = figure(title='Population Graph of Sweden and Austria', x_axis_label='Year',
                  y_axis_label='Population in million')

    source_pk = ColumnDataSource(data=dict(

    source_in = ColumnDataSource(data=dict(

    hover = HoverTool()
    hover.tooltips = """
    <div style=padding=5px>Year:@year</div>
    <div style=padding=5px>Population:@population</div>

    plot.line('year', 'population', line_width=2, line_color='green', legend_label='Sweden', source=source_pk)'year', 'population', fill_color="green", line_color='green', size=8, source=source_pk)

    plot.line('year', 'population', line_width=2, line_color='orange', legend_label='Austria', source=source_in)'year', 'population', fill_color="orange", line_color='orange', size=8, source=source_in)

Would appreciate help!

Many thanks!

Have you tried the latest library versions:


@Franky1 Streamlit 1.8.1 only supports Bokeh version 2.4.1…
Hence with the set of library versions mentioned here, getting compatibility issue

You’re right, I didn’t find the dependency and i think that BokehJS is baked right into streamlit.

However, I don’t quite understand what the original problem should be. The line in the plot only disappears on a mouse over when you are on a support point and the associated popup pops up. So the behavior could even be intentional. So what is the problem? Was this different in other versions of Bokeh?


For below set of versions, app is working as expected on hover functionality
Streamlit 0.76
Bokeh 2.0.2

However, with below set of versions, it’s not working properly
Streamlit 1.7.0
Bokeh 2.4.1