Spaces:
Sleeping
Sleeping
shamimjony1000
commited on
Commit
•
459d4ec
1
Parent(s):
727ba37
Update task_visualization.py
Browse files- task_visualization.py +8 -5
task_visualization.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
-
|
|
|
5 |
|
6 |
class TaskVisualizer:
|
7 |
def plot_performance(self):
|
@@ -18,8 +17,7 @@ class TaskVisualizer:
|
|
18 |
plt.tight_layout()
|
19 |
st.pyplot(plt)
|
20 |
|
21 |
-
def plot_category_performance(self, timeframe):
|
22 |
-
task_manager = TaskManager() # Use the imported TaskManager class
|
23 |
report = task_manager.generate_report(timeframe)
|
24 |
if not report.empty:
|
25 |
category_times = report.groupby('Category')['Total Duration'].sum()
|
@@ -47,3 +45,8 @@ class TaskVisualizer:
|
|
47 |
plt.xticks(rotation=45)
|
48 |
plt.tight_layout()
|
49 |
st.pyplot(plt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import matplotlib.pyplot as plt
|
2 |
+
import pandas as pd
|
3 |
+
import streamlit as st
|
4 |
|
5 |
class TaskVisualizer:
|
6 |
def plot_performance(self):
|
|
|
17 |
plt.tight_layout()
|
18 |
st.pyplot(plt)
|
19 |
|
20 |
+
def plot_category_performance(self, timeframe, task_manager):
|
|
|
21 |
report = task_manager.generate_report(timeframe)
|
22 |
if not report.empty:
|
23 |
category_times = report.groupby('Category')['Total Duration'].sum()
|
|
|
45 |
plt.xticks(rotation=45)
|
46 |
plt.tight_layout()
|
47 |
st.pyplot(plt)
|
48 |
+
|
49 |
+
def download_report(self):
|
50 |
+
df = pd.DataFrame(st.session_state.tasks)
|
51 |
+
csv = df.to_csv(index=False)
|
52 |
+
st.download_button("Download CSV", data=csv, file_name="task_report.csv", mime='text/csv')
|