Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22 onglet data ameliorations #29

Merged
merged 28 commits into from
Jul 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fb186a5
[tg] - valeurs par défaut des filtres et optimisation du layout des f…
tgazagnes May 22, 2024
2ad8ba5
[tg] - convert liters to m3
tgazagnes May 22, 2024
47049af
[tg] - wording sous onglet matériaux
tgazagnes May 22, 2024
1c9d037
[tg] - classement par ordre alphabétique dans les filtres
tgazagnes May 22, 2024
b941905
[tg] - wording sous-onglet top déchets
tgazagnes May 22, 2024
c19f74b
[tg] - top déchets : passage rayon en log2
tgazagnes May 23, 2024
55e4894
[tg] - chart labels templates
tgazagnes May 23, 2024
5c17732
[tg] - amélioration format nombres utilisant locale.set_locale
tgazagnes May 24, 2024
042e133
[tg] - bug corrigé
tgazagnes May 24, 2024
f224645
[tg] - note méthodo et exclusion des 100%Autres
tgazagnes May 24, 2024
e1c7a80
[tg} - infobulles dans les graphiques en langage naturel
tgazagnes May 27, 2024
dc7a302
[tg] - onglet matériaux : tableau avec nb collectes par milieu
tgazagnes May 27, 2024
34b0996
[tg] - onglet matériaux - améliorations table nb déchets
tgazagnes May 27, 2024
9f1b0e4
[tg] - séparateurs décimaux et milliers dans les graphiques
tgazagnes May 29, 2024
0835d03
[tg] - sous-onglet matériaux : filtrer sur milieux avec plus de 3 col…
tgazagnes May 29, 2024
9225aea
[tg] - ajout des filtres sur top10 déchets
tgazagnes May 29, 2024
3f24729
[tg] inversion graphs marques et REP
tgazagnes May 29, 2024
5334ee7
[tg] - sous-onglet 3 : filtre sur niveaux 4 (secteurs/REP) et 2à4 (ma…
tgazagnes May 29, 2024
4c048eb
[tg] - retrait des VIDES et INDETERMINES dans les metrics de l'onglet 3
tgazagnes May 29, 2024
f7dc00c
[tg] - ajout %déchets dans graph par secteurs
tgazagnes May 29, 2024
fb43f53
[tg] - amélioration layout 3 onglets
tgazagnes Jun 6, 2024
a9ff5f1
[tg] - optimisation du code des filtres
tgazagnes Jun 6, 2024
858bb7a
[tg] Améliorations suite point Merterre
tgazagnes Jun 6, 2024
0c42b3b
[tg] Ajout détail données utilisées + rayon carto top déchets
tgazagnes Jun 18, 2024
9ddfbed
[tg] remove line from poetry.lock to solve precommit fail
tgazagnes Jun 19, 2024
ba83666
[tg] update poetry.lock to solve precommit conflicts
tgazagnes Jun 20, 2024
8cc6880
[tg] black reformat to hotspots.py
tgazagnes Jun 20, 2024
e919f14
[tg] corrections suite retours Kyllian
tgazagnes Jun 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[tg} - infobulles dans les graphiques en langage naturel
  • Loading branch information
tgazagnes committed May 27, 2024
commit e1c7a800a8382e72800460b229f99cf37e824b92
37 changes: 32 additions & 5 deletions dashboards/app/pages/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def french_format(x: int) -> str:
texttemplate="<b>%{label}</b><br>%{value:.1f} m³<br>%{percentRoot}",
textfont_size=16,
hovertemplate="<b>%{label} : %{value:.1f} m³ </b>"
+ "<br>%{percentRoot:.1%} % du volume total.",
+ "<br>%{percentRoot:.1%} du volume total",
)

with st.container(border=False):
Expand Down Expand Up @@ -692,6 +692,7 @@ def french_format(x: int) -> str:
)
# Preparation de la figure barplot
df_top10_dechets.reset_index(inplace=True)

# Création du graphique en barres avec Plotly Express

fig5 = px.bar(
Expand Down Expand Up @@ -733,6 +734,9 @@ def french_format(x: int) -> str:
textfont_size=18,
)

# Paramétrage de l'infobulle
fig5.update_traces(hovertemplate="<b>%{y} :</b> %{x:.0f} déchets")

# Suppression de la colonne categorie
del df_top10_dechets["Materiau"]

Expand Down Expand Up @@ -800,10 +804,23 @@ def french_format(x: int) -> str:
else:
radius = 0.001

# Format the value with commas as thousands separators
formatted_nb_dechet = locale.format_string(
"%.0f", row["nb_dechet"], grouping=True
)

folium.CircleMarker(
location=(row["LIEU_COORD_GPS_Y"], row["LIEU_COORD_GPS_X"]),
radius=radius, # Utilisation du rayon ajusté
popup=f"{row['NOM_ZONE']}, {row['LIEU_VILLE']}, {row['DATE']} : {row['nb_dechet']} {selected_dechet}",
popup=folium.Popup(
html=f"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce qu'on ne mettrait pas les html dans des fichiers dédiés ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça concerne un seul graphique pour tout l'onglet, tu penses que c'est nécessaire ?

Commune : <b>{row['LIEU_VILLE']}</b><br>
Zone : <b>{row['NOM_ZONE']}</b><br>
Quantité : <b>{formatted_nb_dechet} {selected_dechet}</b><br>
Date : <b>{row['DATE']}</b>
""",
max_width=150,
),
color="#3186cc",
fill=True,
fill_color="#3186cc",
Expand Down Expand Up @@ -1091,6 +1108,12 @@ def french_format(x: int) -> str:
showlegend=False,
yaxis_title=None,
)

# Paramétrage de l'infobulle
fig_secteur.update_traces(
hovertemplate="Secteur : <b>%{y}</b><br> Quantité : <b>%{x:.0f} déchets</b>"
)

with st.container(border=True):
st.plotly_chart(fig_secteur, use_container_width=True)

Expand Down Expand Up @@ -1144,6 +1167,10 @@ def french_format(x: int) -> str:
uniformtext_mode="hide",
yaxis_title=None,
)
# Paramétrage de l'infobulle
fig_marque.update_traces(
hovertemplate="Marque : <b>%{y}</b><br> Quantité : <b>%{x:.0f} déchets</b>"
)

with st.container(border=True):
st.plotly_chart(fig_marque, use_container_width=True)
Expand Down Expand Up @@ -1201,10 +1228,10 @@ def french_format(x: int) -> str:
margin=dict(t=50, l=25, r=25, b=25), autosize=True, height=600
)
figreptree.update_traces(
textinfo="label+value",
texttemplate="<b>%{label}</b><br>%{value:.0f} items",
textinfo="label+value+percent root",
texttemplate="<b>%{label}</b><br>%{value:.0f} déchets<br>%{percentRoot} du total",
textfont=dict(size=16),
hovertemplate="<b>%{label}</b><br>Nombre de déchets : %{value:.0f}",
hovertemplate="<b>%{label}</b><br>Quantité de déchets : %{value:.0f}",
)

with st.container(border=True):
Expand Down