James McCool commited on
Commit
523a249
·
1 Parent(s): 0982427

Modify game rotation timeline plot with task labels and linear x-axis

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -691,7 +691,6 @@ with tab5:
691
  display = st.container()
692
  stats_disp = st.container()
693
  check_rotation = team_backlog.sort_values(by=['GAME_DATE', 'Finish'], ascending=[False, True])
694
- check_rotation['Task'] = check_rotation['Task'] + ' - ' + check_rotation['Start'].astype(str) + ' - ' + check_rotation['Finish'].astype(str)
695
  check_rotation['Start'] = check_rotation['Start'].astype(float)
696
  check_rotation['Finish'] = check_rotation['Finish'].astype(float)
697
  check_rotation['Resource'] = check_rotation['PLAYER_NAME']
@@ -699,11 +698,11 @@ with tab5:
699
  game_rot_stats = check_rotation.reindex(game_rot_cols,axis="columns")
700
  game_rot_stats = game_rot_stats.drop_duplicates(subset='backlog_lookup')
701
 
702
- fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Resource", range_x=[0,check_rotation["Finish"].max()])
703
  fig.update_yaxes(autorange="reversed")
704
 
705
- # fig.layout.xaxis.type = 'linear'
706
- # fig.data[0].x = check_rotation.delta.tolist()
707
  # Create a color map for each unique player
708
  player_colors = px.colors.qualitative.Plotly[:len(check_rotation['PLAYER_NAME'].unique())]
709
  color_map = dict(zip(check_rotation['PLAYER_NAME'].unique(), player_colors))
 
691
  display = st.container()
692
  stats_disp = st.container()
693
  check_rotation = team_backlog.sort_values(by=['GAME_DATE', 'Finish'], ascending=[False, True])
 
694
  check_rotation['Start'] = check_rotation['Start'].astype(float)
695
  check_rotation['Finish'] = check_rotation['Finish'].astype(float)
696
  check_rotation['Resource'] = check_rotation['PLAYER_NAME']
 
698
  game_rot_stats = check_rotation.reindex(game_rot_cols,axis="columns")
699
  game_rot_stats = game_rot_stats.drop_duplicates(subset='backlog_lookup')
700
 
701
+ fig = px.timeline(check_rotation, x_start="Start", x_end="Finish", y="Task", range_x=[0,check_rotation["Finish"].max()], text='minutes')
702
  fig.update_yaxes(autorange="reversed")
703
 
704
+ fig.layout.xaxis.type = 'linear'
705
+ fig.data[0].x = check_rotation.delta.tolist()
706
  # Create a color map for each unique player
707
  player_colors = px.colors.qualitative.Plotly[:len(check_rotation['PLAYER_NAME'].unique())]
708
  color_map = dict(zip(check_rotation['PLAYER_NAME'].unique(), player_colors))