James McCool commited on
Commit
b821708
·
1 Parent(s): b0051d3

Refactor game rotation timeline to use time segments and improve visualization

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -700,12 +700,30 @@ with tab5:
700
  game_rot_stats = check_rotation.reindex(game_rot_cols,axis="columns")
701
  game_rot_stats = game_rot_stats.drop_duplicates(subset='backlog_lookup')
702
 
703
- fig = px.timeline(data_frame=check_rotation, x_start='Start', x_end='Finish', y='Resource', range_x=[0,check_rotation["Finish"].max()], text='Task')
 
 
 
 
 
 
 
 
 
 
 
 
 
704
 
705
  fig.layout.xaxis.type = 'linear'
706
- fig.data[0].x = check_rotation.delta.tolist()
707
- fig.data[0].y = check_rotation.Task.tolist()
708
- fig.update_yaxes(autorange="reversed")
 
 
 
 
 
709
 
710
  # Create a color map for each unique player
711
  player_colors = px.colors.qualitative.Plotly[:len(check_rotation['PLAYER_NAME'].unique())]
 
700
  game_rot_stats = check_rotation.reindex(game_rot_cols,axis="columns")
701
  game_rot_stats = game_rot_stats.drop_duplicates(subset='backlog_lookup')
702
 
703
+ # Create proper time segments
704
+ check_rotation['TimeSegment'] = check_rotation.apply(
705
+ lambda row: {
706
+ 'Start': row['Start'],
707
+ 'Total': row['Finish'] - row['Start']
708
+ }, axis=1
709
+ )
710
+
711
+ fig = px.timeline(data_frame=check_rotation,
712
+ x_start='Start',
713
+ x_end='Finish',
714
+ y='Resource',
715
+ range_x=[0, 48], # Full game length
716
+ text='Task')
717
 
718
  fig.layout.xaxis.type = 'linear'
719
+ fig.update_yaxes(categoryorder='category ascending')
720
+
721
+ # Update traces to show proper time segments
722
+ for i in range(len(fig.data)):
723
+ fig.data[i].x = [
724
+ (seg['Start'], seg['Start'] + seg['Total'])
725
+ for seg in check_rotation['TimeSegment']
726
+ ]
727
 
728
  # Create a color map for each unique player
729
  player_colors = px.colors.qualitative.Plotly[:len(check_rotation['PLAYER_NAME'].unique())]