Spaces:
Runtime error
Runtime error
James McCool
commited on
Commit
·
1cdf899
1
Parent(s):
1fac984
Refactor game rotation timeline plot with improved readability and comments
Browse files
app.py
CHANGED
@@ -694,16 +694,15 @@ with tab5:
|
|
694 |
check_rotation['Start'] = check_rotation['Start'].astype(float)
|
695 |
check_rotation['Finish'] = check_rotation['Finish'].astype(float)
|
696 |
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
|
|
702 |
|
703 |
fig.layout.xaxis.type = 'linear'
|
704 |
-
fig.
|
705 |
-
|
706 |
-
fig.update_yaxes(autorange="reversed")
|
707 |
|
708 |
# Create a color map for each unique player
|
709 |
player_colors = px.colors.qualitative.Plotly[:len(check_rotation['PLAYER_NAME'].unique())]
|
@@ -716,6 +715,11 @@ with tab5:
|
|
716 |
fig.add_vline(x=12, line_width=3, line_dash="dash", line_color="green")
|
717 |
fig.add_vline(x=24, line_width=3, line_dash="dash", line_color="green")
|
718 |
fig.add_vline(x=36, line_width=3, line_dash="dash", line_color="green")
|
|
|
|
|
|
|
|
|
|
|
719 |
# pages = pages.set_index('Player')
|
720 |
display.plotly_chart(fig, use_container_width=True)
|
721 |
stats_disp.dataframe(game_rot_stats.style.format(precision=2), hide_index=True, use_container_width = True)
|
|
|
694 |
check_rotation['Start'] = check_rotation['Start'].astype(float)
|
695 |
check_rotation['Finish'] = check_rotation['Finish'].astype(float)
|
696 |
|
697 |
+
fig = px.timeline(data_frame=check_rotation,
|
698 |
+
x_start='Start', # Column containing start times
|
699 |
+
x_end='Finish', # Column containing end times
|
700 |
+
y='Task', # Column containing player/shift labels
|
701 |
+
range_x=[0, check_rotation["Finish"].max()],
|
702 |
+
text='delta') # Show the duration as text
|
703 |
|
704 |
fig.layout.xaxis.type = 'linear'
|
705 |
+
fig.update_yaxes(autorange="reversed") # Reverse y-axis to show tasks top-to-bottom
|
|
|
|
|
706 |
|
707 |
# Create a color map for each unique player
|
708 |
player_colors = px.colors.qualitative.Plotly[:len(check_rotation['PLAYER_NAME'].unique())]
|
|
|
715 |
fig.add_vline(x=12, line_width=3, line_dash="dash", line_color="green")
|
716 |
fig.add_vline(x=24, line_width=3, line_dash="dash", line_color="green")
|
717 |
fig.add_vline(x=36, line_width=3, line_dash="dash", line_color="green")
|
718 |
+
|
719 |
+
st.write(check_rotation)
|
720 |
+
game_rot_stats = check_rotation.reindex(game_rot_cols,axis="columns")
|
721 |
+
game_rot_stats = game_rot_stats.drop_duplicates(subset='backlog_lookup')
|
722 |
+
|
723 |
# pages = pages.set_index('Player')
|
724 |
display.plotly_chart(fig, use_container_width=True)
|
725 |
stats_disp.dataframe(game_rot_stats.style.format(precision=2), hide_index=True, use_container_width = True)
|