hblim commited on
Commit
9adea2d
Β·
1 Parent(s): cb1126c

fixed legend text color

Browse files
Files changed (1) hide show
  1. frontend/app.py +10 -12
frontend/app.py CHANGED
@@ -234,9 +234,6 @@ legend_df = pd.DataFrame({
234
  "shape": ["circle", "square"],
235
  })
236
 
237
- # Retrieve the current theme's text color so legend text adapts to light/dark mode
238
- text_color = st.get_option("theme.textColor") or "#000000"
239
-
240
  legend_points = (
241
  alt.Chart(legend_df)
242
  .mark_point(size=100, filled=True)
@@ -251,7 +248,7 @@ legend_points = (
251
 
252
  legend_text = (
253
  alt.Chart(legend_df)
254
- .mark_text(align="left", baseline="middle", dx=15, color=text_color)
255
  .encode(
256
  y="row:O",
257
  x=alt.value(0),
@@ -261,16 +258,17 @@ legend_text = (
261
 
262
  manual_legend = (
263
  legend_points + legend_text
264
- ).properties(height=60)
265
 
266
- # Concatenate chart and manual legend vertically
267
- final_chart = alt.vconcat(
268
- manual_legend,
269
- hover_chart,
270
- spacing=0
271
- ).configure_view(strokeWidth=0)
272
 
273
- st.altair_chart(final_chart, use_container_width=True)
 
274
 
275
  # ── Bar chart for post counts by subreddit (side-by-side) ────────────────────
276
  st.subheader("Daily Post Counts by Subreddit")
 
234
  "shape": ["circle", "square"],
235
  })
236
 
 
 
 
237
  legend_points = (
238
  alt.Chart(legend_df)
239
  .mark_point(size=100, filled=True)
 
248
 
249
  legend_text = (
250
  alt.Chart(legend_df)
251
+ .mark_text(align="left", baseline="middle", dx=15, color="black")
252
  .encode(
253
  y="row:O",
254
  x=alt.value(0),
 
258
 
259
  manual_legend = (
260
  legend_points + legend_text
261
+ ).properties(height=50, background="white",width=170)
262
 
263
+ # # Concatenate chart and manual legend vertically
264
+ # final_chart = alt.vconcat(
265
+ # manual_legend,
266
+ # hover_chart,
267
+ # spacing=0
268
+ # ).configure_view(strokeWidth=0)
269
 
270
+ st.altair_chart(manual_legend, use_container_width=False)
271
+ st.altair_chart(hover_chart, use_container_width=True)
272
 
273
  # ── Bar chart for post counts by subreddit (side-by-side) ────────────────────
274
  st.subheader("Daily Post Counts by Subreddit")