Bokeh chart is disappearing on Mouse hover

Bokeh chart is disappearing on Mouse hover on line plot
Libraries used -
streamlit==1.7.0
bokeh==2.4.1

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(
        year=year,
        population=pop_pakistan,
    ))

    source_in = ColumnDataSource(data=dict(
        year=year,
        population=pop_india,
    ))

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

    plot.line('year', 'population', line_width=2, line_color='green', legend_label='Sweden', source=source_pk)
    plot.circle('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)
    plot.circle('year', 'population', fill_color="orange", line_color='orange', size=8, source=source_in)
    st.bokeh_chart(plot)


Would appreciate help!

Many thanks!
John

Have you tried the latest library versions:

streamlit>=1.8.1
bokeh==2.4.2

@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?

@Franky1

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