Update app.py
Browse files
app.py
CHANGED
|
@@ -215,6 +215,7 @@ def main():
|
|
| 215 |
menu = st.radio("", menu_items, label_visibility="collapsed")
|
| 216 |
|
| 217 |
# Dashboard View
|
|
|
|
| 218 |
if menu == "🏠 Dashboard":
|
| 219 |
tasks = get_tasks()
|
| 220 |
if tasks:
|
|
@@ -231,6 +232,54 @@ def main():
|
|
| 231 |
fig = px.pie(df, names='status', hole=0.4,
|
| 232 |
color_discrete_sequence=px.colors.qualitative.Pastel1)
|
| 233 |
st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
else:
|
| 235 |
st.info("📭 No tasks found. Start by adding new tasks!")
|
| 236 |
|
|
|
|
| 215 |
menu = st.radio("", menu_items, label_visibility="collapsed")
|
| 216 |
|
| 217 |
# Dashboard View
|
| 218 |
+
|
| 219 |
if menu == "🏠 Dashboard":
|
| 220 |
tasks = get_tasks()
|
| 221 |
if tasks:
|
|
|
|
| 232 |
fig = px.pie(df, names='status', hole=0.4,
|
| 233 |
color_discrete_sequence=px.colors.qualitative.Pastel1)
|
| 234 |
st.plotly_chart(fig, use_container_width=True)
|
| 235 |
+
|
| 236 |
+
# New Timeline Visualization
|
| 237 |
+
with st.container(border=True):
|
| 238 |
+
st.subheader("⏳ Task Timeline")
|
| 239 |
+
timeline_df = df.copy()
|
| 240 |
+
|
| 241 |
+
# Convert date and create timeline visualization
|
| 242 |
+
timeline_df['date'] = pd.to_datetime(timeline_df['date'])
|
| 243 |
+
timeline_df['Start'] = timeline_df['date'] - pd.DateOffset(days=1) # Fake start date for visualization
|
| 244 |
+
timeline_df['Finish'] = timeline_df['date']
|
| 245 |
+
|
| 246 |
+
# Create Gantt-style timeline
|
| 247 |
+
fig = px.timeline(
|
| 248 |
+
timeline_df,
|
| 249 |
+
x_start="Start",
|
| 250 |
+
x_end="Finish",
|
| 251 |
+
y="task",
|
| 252 |
+
color="status",
|
| 253 |
+
color_discrete_map={
|
| 254 |
+
"Pending": "#FFE4B5",
|
| 255 |
+
"In Progress": "#87CEEB",
|
| 256 |
+
"Completed": "#98FB98"
|
| 257 |
+
},
|
| 258 |
+
title="Task Schedule Overview",
|
| 259 |
+
labels={"task": "Task", "date": "Due Date"},
|
| 260 |
+
hover_data=["project", "type"]
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
# Customize layout
|
| 264 |
+
fig.update_yaxes(autorange="reversed", title_text="Tasks")
|
| 265 |
+
fig.update_xaxes(title_text="Timeline")
|
| 266 |
+
fig.update_layout(
|
| 267 |
+
height=500,
|
| 268 |
+
showlegend=True,
|
| 269 |
+
hovermode="closest",
|
| 270 |
+
xaxis=dict(showgrid=True, tickformat="%b %d\n%Y"),
|
| 271 |
+
margin=dict(l=0, r=0, t=40, b=20)
|
| 272 |
+
)
|
| 273 |
+
|
| 274 |
+
# Add custom hover template
|
| 275 |
+
fig.update_traces(
|
| 276 |
+
hovertemplate="<b>%{y}</b><br>"
|
| 277 |
+
"Project: %{customdata[0]}<br>"
|
| 278 |
+
"Type: %{customdata[1]}<br>"
|
| 279 |
+
"Due Date: %{x|%b %d, %Y}"
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 283 |
else:
|
| 284 |
st.info("📭 No tasks found. Start by adding new tasks!")
|
| 285 |
|