nouamanetazi HF staff commited on
Commit
c713636
1 Parent(s): cb82fdf

fix mobile view

Browse files
Files changed (1) hide show
  1. src/components.py +38 -4
src/components.py CHANGED
@@ -132,16 +132,50 @@ def show_charts():
132
  # interventions_categories
133
  interventions_processed_df = cached_parse_gg_sheet(INTERVENTIONS_PROCESSED_URL)
134
  supply_data = interventions_processed_df["supplies_category"].str.split(",").explode().str.strip('[] \'').dropna().astype("category")
135
- interv_fig = px.pie(supply_data, names='supplies_category', title=_('Supplies Categories'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  with col1:
137
- st.plotly_chart(interv_fig)
 
138
 
139
  # requests_categories
140
  requests_processed_df = cached_parse_gg_sheet(VERIFIED_REQUESTS_PROCESSED_URL)
141
  need_data = requests_processed_df["need_category"].str.split(",").explode().str.strip('[] \'').dropna().astype("category")
142
- req_fig = px.pie(need_data, names='need_category', title=_('Needs Categories'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  with col2:
144
- st.plotly_chart(req_fig)
 
145
 
146
 
147
 
 
132
  # interventions_categories
133
  interventions_processed_df = cached_parse_gg_sheet(INTERVENTIONS_PROCESSED_URL)
134
  supply_data = interventions_processed_df["supplies_category"].str.split(",").explode().str.strip('[] \'').dropna().astype("category")
135
+ interv_fig = px.pie(supply_data, names='supplies_category')
136
+ interv_fig.update_layout(
137
+ autosize=True,
138
+ legend=dict(
139
+ orientation="h",
140
+ # entrywidth=40,
141
+ yanchor="bottom",
142
+ y=1.02,
143
+ xanchor="right",
144
+ x=1,
145
+ font=dict(
146
+ # family="Courier",
147
+ # size=10,
148
+ # color="black"
149
+ ),
150
+ itemwidth=100
151
+ ))
152
  with col1:
153
+ st.subheader(_("Supplies Categories"))
154
+ st.plotly_chart(interv_fig, use_container_width=True)
155
 
156
  # requests_categories
157
  requests_processed_df = cached_parse_gg_sheet(VERIFIED_REQUESTS_PROCESSED_URL)
158
  need_data = requests_processed_df["need_category"].str.split(",").explode().str.strip('[] \'').dropna().astype("category")
159
+ req_fig = px.pie(need_data, names='need_category')
160
+ req_fig.update_layout(
161
+ autosize=True,
162
+ legend=dict(
163
+ orientation="h",
164
+ # entrywidth=40,
165
+ yanchor="bottom",
166
+ y=1.02,
167
+ xanchor="right",
168
+ x=1,
169
+ font=dict(
170
+ # family="Courier",
171
+ # size=10,
172
+ # color="black"
173
+ ),
174
+ itemwidth=100
175
+ ))
176
  with col2:
177
+ st.subheader(_("Needs Categories"))
178
+ st.plotly_chart(req_fig, use_container_width=True)
179
 
180
 
181