James McCool commited on
Commit
21bdc76
·
1 Parent(s): 1fb320e

Replace static color mapping with dynamic player-based color selection in game rotation timeline

Browse files
Files changed (1) hide show
  1. app.py +1 -23
app.py CHANGED
@@ -700,28 +700,6 @@ with tab5:
700
 
701
  # Create figure
702
  fig = go.Figure()
703
-
704
- distinct_colors = [
705
- '#1f77b4', # blue
706
- '#ff7f0e', # orange
707
- '#2ca02c', # green
708
- '#d62728', # red
709
- '#9467bd', # purple
710
- '#8c564b', # brown
711
- '#e377c2', # pink
712
- '#7f7f7f', # gray
713
- '#bcbd22', # yellow-green
714
- '#17becf', # cyan
715
- '#aec7e8', # light blue
716
- '#ffbb78', # light orange
717
- '#98df8a', # light green
718
- '#ff9896', # light red
719
- '#c5b0d5' # light purple
720
- ]
721
-
722
- # Create a mapping of unique tasks to colors
723
- unique_tasks = check_rotation['Task'].unique()
724
- color_map = dict(zip(unique_tasks, distinct_colors[:len(unique_tasks)]))
725
 
726
  # Add bars for each shift
727
  for idx, row in check_rotation.iterrows():
@@ -733,7 +711,7 @@ with tab5:
733
  text=f"{row['delta']:.1f} Minutes",
734
  textposition='inside',
735
  showlegend=False,
736
- marker_color=color_map[row['Task']] # Use mapped color for task
737
  ))
738
 
739
  # Update layout
 
700
 
701
  # Create figure
702
  fig = go.Figure()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
703
 
704
  # Add bars for each shift
705
  for idx, row in check_rotation.iterrows():
 
711
  text=f"{row['delta']:.1f} Minutes",
712
  textposition='inside',
713
  showlegend=False,
714
+ marker_color=px.colors.qualitative.Plotly[hash(row['PLAYER_NAME']) % len(px.colors.qualitative.Plotly)]
715
  ))
716
 
717
  # Update layout