Created
November 11, 2020 13:13
-
-
Save BitBernd/4cc06473d71de4a67ede607a618b0a83 to your computer and use it in GitHub Desktop.
Streamlit Bokeh Double Chart Bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a minimal example | |
# demonstrating the double | |
# bokeh chart generation | |
# https://discuss.streamlit.io/t/bokeh-produces-two-charts-when-deployed/5820 | |
import streamlit as st | |
from bokeh.plotting import figure | |
modelbuild_stats_dict = { | |
'modelbuild_number' : ['1','2','3','4','5','6','7','8'], | |
'passed' : [30,35,32,25,30,30,23,23], | |
'failed' : [5,0,3,10,5,0,0,0], | |
'not_run' : [0,0,0,0,0,5,12,12], | |
} | |
colors = ["#4ce074", "#f26d49", "#b0e5f5"] | |
p = figure( | |
x_range=modelbuild_stats_dict['modelbuild_number'], | |
plot_height=400, | |
toolbar_location='right', | |
tools="hover,box_zoom,reset,save", | |
tooltips="$name @$name" | |
) | |
keylist = [key for key in modelbuild_stats_dict.keys() ] | |
p.vbar_stack( | |
keylist[1:], x='modelbuild_number', | |
width=0.5, | |
color=colors, | |
source=modelbuild_stats_dict, | |
legend_label=keylist[1:] | |
) | |
p.y_range.start = 0 | |
p.x_range.range_padding = 0.1 | |
p.legend.location = "top_left" | |
""" | |
### Results by Buildnumber | |
""" | |
st.bokeh_chart(p, use_container_width=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment