Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Fix Color Coding Pie Chart Legend (#34)
Browse files- Add color mapping for categories (fb0b7743b1ac8f8501890e21bf638d0dce444127)
- src/components.py +13 -2
src/components.py
CHANGED
@@ -7,6 +7,17 @@ from src.utils import parse_gg_sheet
|
|
7 |
|
8 |
import plotly.express as px
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
def id_review_submission(api: HfApi):
|
12 |
"""Id review submission form"""
|
@@ -143,7 +154,7 @@ def show_charts():
|
|
143 |
.dropna()
|
144 |
.astype("category")
|
145 |
)
|
146 |
-
interv_fig = px.pie(supply_data, names="supplies_category")
|
147 |
interv_fig.update_layout(
|
148 |
autosize=True,
|
149 |
legend=dict(
|
@@ -170,7 +181,7 @@ def show_charts():
|
|
170 |
need_data = (
|
171 |
requests_processed_df["need_category"].str.split(",").explode().str.strip("[] '").dropna().astype("category")
|
172 |
)
|
173 |
-
req_fig = px.pie(need_data, names="need_category")
|
174 |
req_fig.update_layout(
|
175 |
autosize=True,
|
176 |
legend=dict(
|
|
|
7 |
|
8 |
import plotly.express as px
|
9 |
|
10 |
+
PIE_CHART_COLOR_MAP = {
|
11 |
+
"REFUGE / SHELTER": "#83C9FD",
|
12 |
+
"COUVERTURES / COVERS": "#FFABAB",
|
13 |
+
"OTHER": "#7FEFA5",
|
14 |
+
"SECOURS / RESCUE": "#FFD171",
|
15 |
+
"KITCHEN TOOLS / USTENSILES DE CUISINE": "#FF8718",
|
16 |
+
"ALIMENTATION ET EAU / FOOD AND WATER": "#0068C7",
|
17 |
+
"ASSISTANCE MÉDICALE / MEDICAL ASSISTANCE": "#2CB09E",
|
18 |
+
"VÊTEMENTS / CLOTHES": "#FF2B2B",
|
19 |
+
"PHARMACEUTICALS / MEDICAMENTS": "#6D40BD"
|
20 |
+
}
|
21 |
|
22 |
def id_review_submission(api: HfApi):
|
23 |
"""Id review submission form"""
|
|
|
154 |
.dropna()
|
155 |
.astype("category")
|
156 |
)
|
157 |
+
interv_fig = px.pie(supply_data, names="supplies_category", color='supplies_category', color_discrete_map=PIE_CHART_COLOR_MAP)
|
158 |
interv_fig.update_layout(
|
159 |
autosize=True,
|
160 |
legend=dict(
|
|
|
181 |
need_data = (
|
182 |
requests_processed_df["need_category"].str.split(",").explode().str.strip("[] '").dropna().astype("category")
|
183 |
)
|
184 |
+
req_fig = px.pie(need_data, names="need_category", color='need_category', color_discrete_map=PIE_CHART_COLOR_MAP)
|
185 |
req_fig.update_layout(
|
186 |
autosize=True,
|
187 |
legend=dict(
|