added bar graph

This commit is contained in:
Ayxan
2022-05-23 16:20:55 +04:00
parent 9e90b4a150
commit 1dfbee8bb1
2 changed files with 17319 additions and 281 deletions

View File

@ -43,20 +43,27 @@ df_line_graph = pd.DataFrame(
st.title('<h5>Azerbaijan Suicide Data (2000-2019)</h5>', 1) st.title('<h5>Azerbaijan Suicide Data (2000-2019)</h5>', 1)
st.dataframe(data_year_selection) st.dataframe(data_year_selection)
st.title('<h1>Dashboard</h1>', 1)
st.subheader('Averages') st.title('<h1>Dashboard</h1>', 1)
st.markdown(f'#### Average of Both Sexes: _{round(average_both_sexes, 2)}_') dashboard_column1, dashboard_column2 = st.columns([1, 2])
st.markdown(f'#### Average of Male: _{round(average_male, 2)}_')
st.markdown(f'#### Average of Female: _{round(average_female, 2)}_') with dashboard_column1:
st.subheader('Averages')
st.markdown(f'#### Average of Both Sexes: _{round(average_both_sexes, 2)}_')
st.markdown(f'#### Average of Male: _{round(average_male, 2)}_')
st.markdown(f'#### Average of Female: _{round(average_female, 2)}_')
with dashboard_column2:
if average_both_sexes > 0:
bar_graph = px.bar(x=['Both Sexes', 'Male', 'Female'], y=[average_both_sexes, average_male, average_female])
st.plotly_chart(bar_graph)
if len(df_line_graph) > 1: if len(df_line_graph) > 1:
st.title('<h1>Gender Line Graph</h1>', 1) st.title('<h1>Gender Line Graph</h1>', 1)
x, y = st.columns([1, 7]) line_graph_column1, line_graph_column2 = st.columns([1, 7])
with x: with line_graph_column1:
column_list = [] column_list = []
st.markdown('&nbsp;') st.markdown('&nbsp;')
# st.markdown('&nbsp;')
both_sexes_check_box = st.checkbox('Both Sexes', value=1) both_sexes_check_box = st.checkbox('Both Sexes', value=1)
male_check_box = st.checkbox('Male', value=1) male_check_box = st.checkbox('Male', value=1)
female_check_box = st.checkbox('Female', value=1) female_check_box = st.checkbox('Female', value=1)
@ -64,8 +71,17 @@ if len(df_line_graph) > 1:
if male_check_box: column_list.append('Male') if male_check_box: column_list.append('Male')
if female_check_box: column_list.append('Female') if female_check_box: column_list.append('Female')
with y: with line_graph_column2:
if column_list: if column_list:
line_graph = px.line(df_line_graph, x='Year', y=column_list) line_graph = px.line(df_line_graph, x='Year', y=column_list)
st.plotly_chart(line_graph) st.plotly_chart(line_graph)
hide_st_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
</style>
"""
st.markdown(hide_st_style, unsafe_allow_html=True)

File diff suppressed because it is too large Load Diff