Skip to content

Commit b7a2750

Browse files
Feat: Amélioration de la lisibilité des camemberts (#54)
- Agrandissement des camemberts - Suppressions des imports inutiles
1 parent 2ae79b0 commit b7a2750

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

app/export/exporteur.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from os.path import abspath, isdir, join
66
from json import dump
7-
from altair import Chart
7+
from altair import Chart, Theta, Color
88
from pandas import DataFrame
99

1010

@@ -110,15 +110,20 @@ def export_vers_html_camembert(self,
110110
# Exportation
111111
try:
112112
chemin_fichier = join(self._chemin_sortie, nom_fichier)
113-
camembert = Chart(axes).mark_arc().encode(
114-
theta='y:Q',
115-
color='x:N',
113+
base = Chart(axes).encode(
114+
theta=Theta(field="y", type="quantitative"),
115+
color=Color(field="x", type="nominal"),
116116
tooltip=['x:N', 'y:Q']
117117
)
118-
camembert.save(chemin_fichier)
118+
camembert = base.mark_arc(outerRadius=200)
119+
graphique = (camembert).properties(
120+
width=400,
121+
height=400
122+
)
123+
graphique.save(chemin_fichier)
119124
except Exception as ex:
120125
raise ExportationCamembertHtmlException("Erreur lors de l'exportation "
121-
f"du camembert {nom_fichier}.") from ex
126+
f"du camembert {nom_fichier} {ex}.") from ex
122127

123128

124129
class ExportationException(Exception):

0 commit comments

Comments
 (0)