Spaces:
Running
Running
if possible make the performance trend graph a line graph where the completed ,pending and in progress compete with each others
Browse files- reports.html +89 -47
- style.css +45 -1
reports.html
CHANGED
|
@@ -25,19 +25,19 @@
|
|
| 25 |
</div>
|
| 26 |
</div>
|
| 27 |
<div class="grid grid-cols-3 gap-4 mb-4 text-center">
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
<canvas id="performanceChart" height="300"></canvas>
|
| 42 |
</div>
|
| 43 |
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
|
@@ -129,20 +129,19 @@
|
|
| 129 |
|
| 130 |
// Calculate stats
|
| 131 |
const totalCompleted = recentTasks.filter(t => t.status === 'completed').length;
|
| 132 |
-
|
| 133 |
-
const
|
| 134 |
-
const
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
| 138 |
|
| 139 |
// Update stats displays
|
| 140 |
-
document.getElementById('avgCompletion').textContent = `${
|
| 141 |
-
document.getElementById('
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
// Create or update chart
|
| 146 |
const ctx = document.getElementById('performanceChart').getContext('2d');
|
| 147 |
|
| 148 |
if (performanceChart) {
|
|
@@ -158,36 +157,44 @@
|
|
| 158 |
labels: dates,
|
| 159 |
datasets: [
|
| 160 |
{
|
| 161 |
-
label: '
|
| 162 |
-
data: createdData,
|
| 163 |
-
borderColor: '#6366f1',
|
| 164 |
-
backgroundColor: 'rgba(99, 102, 241, 0.1)',
|
| 165 |
-
borderWidth: 2,
|
| 166 |
-
tension: 0.3,
|
| 167 |
-
pointRadius: 4
|
| 168 |
-
},
|
| 169 |
-
{
|
| 170 |
-
label: 'Tasks Completed',
|
| 171 |
data: completedData,
|
| 172 |
borderColor: '#10b981',
|
| 173 |
backgroundColor: 'rgba(16, 185, 129, 0.1)',
|
| 174 |
-
borderWidth:
|
| 175 |
-
tension: 0.
|
| 176 |
-
pointRadius:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
},
|
| 178 |
{
|
| 179 |
-
label: '
|
| 180 |
data: pendingData,
|
| 181 |
borderColor: '#f59e0b',
|
| 182 |
backgroundColor: 'rgba(245, 158, 11, 0.1)',
|
| 183 |
-
borderWidth:
|
| 184 |
-
tension: 0.
|
| 185 |
-
pointRadius:
|
|
|
|
|
|
|
| 186 |
}
|
| 187 |
]
|
| 188 |
},
|
| 189 |
options: {
|
| 190 |
responsive: true,
|
|
|
|
| 191 |
interaction: {
|
| 192 |
mode: 'index',
|
| 193 |
intersect: false,
|
|
@@ -195,6 +202,10 @@
|
|
| 195 |
scales: {
|
| 196 |
y: {
|
| 197 |
beginAtZero: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
grid: {
|
| 199 |
drawBorder: false
|
| 200 |
}
|
|
@@ -202,17 +213,34 @@
|
|
| 202 |
x: {
|
| 203 |
grid: {
|
| 204 |
display: false
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
}
|
| 206 |
}
|
| 207 |
},
|
| 208 |
plugins: {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
tooltip: {
|
| 210 |
callbacks: {
|
| 211 |
footer: (context) => {
|
| 212 |
const date = context[0].label;
|
| 213 |
-
const
|
| 214 |
-
|
| 215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
}
|
| 217 |
}
|
| 218 |
},
|
|
@@ -220,12 +248,26 @@
|
|
| 220 |
position: 'top',
|
| 221 |
labels: {
|
| 222 |
usePointStyle: true,
|
| 223 |
-
pointStyle: 'circle'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
}
|
| 225 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
}
|
| 227 |
}
|
| 228 |
-
|
| 229 |
}
|
| 230 |
};
|
| 231 |
|
|
|
|
| 25 |
</div>
|
| 26 |
</div>
|
| 27 |
<div class="grid grid-cols-3 gap-4 mb-4 text-center">
|
| 28 |
+
<div class="bg-green-100 p-2 rounded-lg">
|
| 29 |
+
<p class="text-sm text-gray-600">Completed</p>
|
| 30 |
+
<p class="font-bold" id="avgCompletion">0/day</p>
|
| 31 |
+
</div>
|
| 32 |
+
<div class="bg-blue-100 p-2 rounded-lg">
|
| 33 |
+
<p class="text-sm text-gray-600">In Progress</p>
|
| 34 |
+
<p class="font-bold" id="inProgressAvg">0/day</p>
|
| 35 |
+
</div>
|
| 36 |
+
<div class="bg-yellow-100 p-2 rounded-lg">
|
| 37 |
+
<p class="text-sm text-gray-600">Pending</p>
|
| 38 |
+
<p class="font-bold" id="pendingAvg">0/day</p>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
<canvas id="performanceChart" height="300"></canvas>
|
| 42 |
</div>
|
| 43 |
<div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
|
|
|
|
| 129 |
|
| 130 |
// Calculate stats
|
| 131 |
const totalCompleted = recentTasks.filter(t => t.status === 'completed').length;
|
| 132 |
+
// Calculate averages
|
| 133 |
+
const totalInProgress = createdData.reduce((sum, created, i) => sum + (created - completedData[i] - pendingData[i]), 0);
|
| 134 |
+
const totalPending = pendingData.reduce((sum, val) => sum + val, 0);
|
| 135 |
+
|
| 136 |
+
const avgCompleted = (totalCompleted / days).toFixed(1);
|
| 137 |
+
const avgInProgress = (totalInProgress / days).toFixed(1);
|
| 138 |
+
const avgPending = (totalPending / days).toFixed(1);
|
| 139 |
|
| 140 |
// Update stats displays
|
| 141 |
+
document.getElementById('avgCompletion').textContent = `${avgCompleted}/day`;
|
| 142 |
+
document.getElementById('inProgressAvg').textContent = `${avgInProgress}/day`;
|
| 143 |
+
document.getElementById('pendingAvg').textContent = `${avgPending}/day`;
|
| 144 |
+
// Create or update chart
|
|
|
|
|
|
|
| 145 |
const ctx = document.getElementById('performanceChart').getContext('2d');
|
| 146 |
|
| 147 |
if (performanceChart) {
|
|
|
|
| 157 |
labels: dates,
|
| 158 |
datasets: [
|
| 159 |
{
|
| 160 |
+
label: 'Completed',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
data: completedData,
|
| 162 |
borderColor: '#10b981',
|
| 163 |
backgroundColor: 'rgba(16, 185, 129, 0.1)',
|
| 164 |
+
borderWidth: 3,
|
| 165 |
+
tension: 0.4,
|
| 166 |
+
pointRadius: 5,
|
| 167 |
+
pointHoverRadius: 7,
|
| 168 |
+
fill: false
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
label: 'In Progress',
|
| 172 |
+
data: createdData.map((created, i) => created - completedData[i] - pendingData[i]),
|
| 173 |
+
borderColor: '#3b82f6',
|
| 174 |
+
backgroundColor: 'rgba(59, 130, 246, 0.1)',
|
| 175 |
+
borderWidth: 3,
|
| 176 |
+
tension: 0.4,
|
| 177 |
+
pointRadius: 5,
|
| 178 |
+
pointHoverRadius: 7,
|
| 179 |
+
fill: false,
|
| 180 |
+
borderDash: [5, 5]
|
| 181 |
},
|
| 182 |
{
|
| 183 |
+
label: 'Pending',
|
| 184 |
data: pendingData,
|
| 185 |
borderColor: '#f59e0b',
|
| 186 |
backgroundColor: 'rgba(245, 158, 11, 0.1)',
|
| 187 |
+
borderWidth: 3,
|
| 188 |
+
tension: 0.4,
|
| 189 |
+
pointRadius: 5,
|
| 190 |
+
pointHoverRadius: 7,
|
| 191 |
+
fill: false
|
| 192 |
}
|
| 193 |
]
|
| 194 |
},
|
| 195 |
options: {
|
| 196 |
responsive: true,
|
| 197 |
+
maintainAspectRatio: false,
|
| 198 |
interaction: {
|
| 199 |
mode: 'index',
|
| 200 |
intersect: false,
|
|
|
|
| 202 |
scales: {
|
| 203 |
y: {
|
| 204 |
beginAtZero: true,
|
| 205 |
+
title: {
|
| 206 |
+
display: true,
|
| 207 |
+
text: 'Number of Tasks'
|
| 208 |
+
},
|
| 209 |
grid: {
|
| 210 |
drawBorder: false
|
| 211 |
}
|
|
|
|
| 213 |
x: {
|
| 214 |
grid: {
|
| 215 |
display: false
|
| 216 |
+
},
|
| 217 |
+
title: {
|
| 218 |
+
display: true,
|
| 219 |
+
text: 'Date'
|
| 220 |
}
|
| 221 |
}
|
| 222 |
},
|
| 223 |
plugins: {
|
| 224 |
+
title: {
|
| 225 |
+
display: true,
|
| 226 |
+
text: 'Task Completion Race',
|
| 227 |
+
font: {
|
| 228 |
+
size: 16,
|
| 229 |
+
weight: 'bold'
|
| 230 |
+
}
|
| 231 |
+
},
|
| 232 |
tooltip: {
|
| 233 |
callbacks: {
|
| 234 |
footer: (context) => {
|
| 235 |
const date = context[0].label;
|
| 236 |
+
const created = dateMap[date]?.created || 0;
|
| 237 |
+
const completed = dateMap[date]?.completed || 0;
|
| 238 |
+
const inProgress = created - completed - (dateMap[date]?.pending || 0);
|
| 239 |
+
return [
|
| 240 |
+
`Progress: ${Math.round((completed/created)*100)}%`,
|
| 241 |
+
`Leads: ${completed > inProgress && completed > pendingData[context[0].dataIndex] ? 'Completed' :
|
| 242 |
+
inProgress > pendingData[context[0].dataIndex] ? 'In Progress' : 'Pending'}`
|
| 243 |
+
];
|
| 244 |
}
|
| 245 |
}
|
| 246 |
},
|
|
|
|
| 248 |
position: 'top',
|
| 249 |
labels: {
|
| 250 |
usePointStyle: true,
|
| 251 |
+
pointStyle: 'circle',
|
| 252 |
+
padding: 20,
|
| 253 |
+
font: {
|
| 254 |
+
size: 12,
|
| 255 |
+
weight: 'bold'
|
| 256 |
+
}
|
| 257 |
}
|
| 258 |
}
|
| 259 |
+
},
|
| 260 |
+
animation: {
|
| 261 |
+
duration: 1000,
|
| 262 |
+
easing: 'easeOutQuart'
|
| 263 |
+
},
|
| 264 |
+
elements: {
|
| 265 |
+
line: {
|
| 266 |
+
tension: 0.4
|
| 267 |
+
}
|
| 268 |
}
|
| 269 |
}
|
| 270 |
+
});
|
| 271 |
}
|
| 272 |
};
|
| 273 |
|
style.css
CHANGED
|
@@ -50,12 +50,56 @@ body {
|
|
| 50 |
background-color: #d1fae5;
|
| 51 |
color: #065f46;
|
| 52 |
}
|
| 53 |
-
/*
|
| 54 |
.time-period-btn.active {
|
| 55 |
background-color: #6366f1 !important;
|
| 56 |
color: white !important;
|
| 57 |
}
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
/* Animation for task completion */
|
| 60 |
@keyframes fadeIn {
|
| 61 |
from { opacity: 0; transform: translateY(10px); }
|
|
|
|
| 50 |
background-color: #d1fae5;
|
| 51 |
color: #065f46;
|
| 52 |
}
|
| 53 |
+
/* Enhanced chart styles */
|
| 54 |
.time-period-btn.active {
|
| 55 |
background-color: #6366f1 !important;
|
| 56 |
color: white !important;
|
| 57 |
}
|
| 58 |
|
| 59 |
+
.chart-container {
|
| 60 |
+
position: relative;
|
| 61 |
+
height: 300px;
|
| 62 |
+
width: 100%;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.chart-legend {
|
| 66 |
+
display: flex;
|
| 67 |
+
justify-content: center;
|
| 68 |
+
flex-wrap: wrap;
|
| 69 |
+
margin-top: 1rem;
|
| 70 |
+
gap: 1rem;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.legend-item {
|
| 74 |
+
display: flex;
|
| 75 |
+
align-items: center;
|
| 76 |
+
font-size: 0.875rem;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.legend-color {
|
| 80 |
+
width: 1rem;
|
| 81 |
+
height: 1rem;
|
| 82 |
+
margin-right: 0.5rem;
|
| 83 |
+
border-radius: 2px;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.legend-completed {
|
| 87 |
+
background-color: #10b981;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.legend-inprogress {
|
| 91 |
+
background-color: #3b82f6;
|
| 92 |
+
opacity: 0.7;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.legend-pending {
|
| 96 |
+
background-color: #f59e0b;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.tooltip-title {
|
| 100 |
+
font-weight: bold;
|
| 101 |
+
margin-bottom: 0.25rem;
|
| 102 |
+
}
|
| 103 |
/* Animation for task completion */
|
| 104 |
@keyframes fadeIn {
|
| 105 |
from { opacity: 0; transform: translateY(10px); }
|