File size: 1,689 Bytes
b7289c6 ffd811b b7289c6 7a766b7 b7289c6 ffd811b 7a766b7 ffd811b 7a766b7 b7289c6 7a766b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import streamlit as st
import pandas as pd
import numpy as np
import re
import altair as alt
from session import get_partie_prenante
import os
from streamlit_vertical_slider import vertical_slider
def display_viz():
st.header("")
st.title("Visualisation des parties prenantes")
partie_prenante = get_partie_prenante()
if partie_prenante is None:
st.write("Veuillez entrer l'url dans l'onglet partie prenante avant de visualiser les parties prenantes")
else:
alphabet = [ pp[0] for pp in partie_prenante]
pouvoir = [ 50 for _ in range(len(partie_prenante))]
df = pd.DataFrame({'partie_prenante': partie_prenante, 'pouvoir': pouvoir, 'code couleur': partie_prenante})
c = (
alt.Chart(df)
.mark_circle(size=300)
.encode(x="partie_prenante", y=alt.Y("pouvoir",scale=alt.Scale(domain=[0,100])), color="code couleur",legend=None)
)
number_of_sliders = len(partie_prenante)
st.write("Modifiez le pouvoir des parties prenantes en utilisant les sliders ci-dessous")
bar = st.columns(number_of_sliders)
for i in range(number_of_sliders):
with bar[i]:
df["pouvoir"][i] = vertical_slider(
label=partie_prenante[i],
height=100,
key=partie_prenante[i],
default_value=50,
thumb_color= "orange", #Optional - Defaults to Streamlit Red
step=1,
min_value=0,
max_value=100,
value_always_visible=False,
)
st.altair_chart(c, use_container_width=True) |