|
4 | 4 | "style": { |
5 | 5 | "css": [ |
6 | 6 | "body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 20px; background: #f8fafc; }", |
7 | | - "body { display: grid; grid-template-areas: 'header header' 'habits progress' 'stats stats'; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 1200px; margin: 0 auto; }", |
| 7 | + "body { display: grid; grid-template-areas: 'header header' 'controls controls' 'heatmap heatmap' 'habits progress' 'stats stats'; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 1200px; margin: 0 auto; }", |
8 | 8 | ".group { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border: 1px solid #e2e8f0; }", |
9 | 9 | "#header { grid-area: header; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; text-align: center; border-radius: 12px; }", |
| 10 | + "#controls { grid-area: controls; }", |
| 11 | + "#heatmap { grid-area: heatmap; }", |
10 | 12 | "#habits { grid-area: habits; }", |
11 | 13 | "#progress { grid-area: progress; }", |
12 | 14 | "#stats { grid-area: stats; }", |
|
94 | 96 | {"date": "2024-01-20", "habit_id": 2, "habit_name": "Read for 30min", "completed": false}, |
95 | 97 | {"date": "2024-01-20", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
96 | 98 | {"date": "2024-01-21", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
97 | | - {"date": "2024-01-22", "habit_id": 3, "habit_name": "Meditate", "completed": true} |
| 99 | + {"date": "2024-01-22", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 100 | + {"date": "2024-01-22", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 101 | + {"date": "2024-01-22", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 102 | + {"date": "2024-01-23", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 103 | + {"date": "2024-01-23", "habit_id": 4, "habit_name": "Write Journal", "completed": true}, |
| 104 | + {"date": "2024-01-24", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 105 | + {"date": "2024-01-24", "habit_id": 3, "habit_name": "Meditate", "completed": false}, |
| 106 | + {"date": "2024-01-25", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 107 | + {"date": "2024-01-25", "habit_id": 5, "habit_name": "Learn New Language", "completed": true}, |
| 108 | + {"date": "2024-01-26", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 109 | + {"date": "2024-01-26", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 110 | + {"date": "2024-01-27", "habit_id": 1, "habit_name": "Morning Exercise", "completed": false}, |
| 111 | + {"date": "2024-01-27", "habit_id": 4, "habit_name": "Write Journal", "completed": true}, |
| 112 | + {"date": "2024-01-28", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 113 | + {"date": "2024-01-28", "habit_id": 6, "habit_name": "Call Family", "completed": true}, |
| 114 | + {"date": "2024-02-01", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 115 | + {"date": "2024-02-01", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 116 | + {"date": "2024-02-01", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 117 | + {"date": "2024-02-02", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 118 | + {"date": "2024-02-02", "habit_id": 4, "habit_name": "Write Journal", "completed": true}, |
| 119 | + {"date": "2024-02-02", "habit_id": 5, "habit_name": "Learn New Language", "completed": true}, |
| 120 | + {"date": "2024-02-03", "habit_id": 2, "habit_name": "Read for 30min", "completed": false}, |
| 121 | + {"date": "2024-02-03", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 122 | + {"date": "2024-02-04", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 123 | + {"date": "2024-02-04", "habit_id": 6, "habit_name": "Call Family", "completed": true}, |
| 124 | + {"date": "2024-02-05", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 125 | + {"date": "2024-02-05", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 126 | + {"date": "2024-02-05", "habit_id": 4, "habit_name": "Write Journal", "completed": false}, |
| 127 | + {"date": "2024-02-06", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 128 | + {"date": "2024-02-06", "habit_id": 5, "habit_name": "Learn New Language", "completed": true}, |
| 129 | + {"date": "2024-02-07", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 130 | + {"date": "2024-02-07", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 131 | + {"date": "2024-02-08", "habit_id": 1, "habit_name": "Morning Exercise", "completed": false}, |
| 132 | + {"date": "2024-02-08", "habit_id": 4, "habit_name": "Write Journal", "completed": true}, |
| 133 | + {"date": "2024-02-09", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 134 | + {"date": "2024-02-09", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 135 | + {"date": "2024-02-10", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 136 | + {"date": "2024-02-10", "habit_id": 5, "habit_name": "Learn New Language", "completed": false}, |
| 137 | + {"date": "2024-03-01", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 138 | + {"date": "2024-03-01", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 139 | + {"date": "2024-03-02", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 140 | + {"date": "2024-03-02", "habit_id": 4, "habit_name": "Write Journal", "completed": true}, |
| 141 | + {"date": "2024-03-03", "habit_id": 1, "habit_name": "Morning Exercise", "completed": false}, |
| 142 | + {"date": "2024-03-03", "habit_id": 5, "habit_name": "Learn New Language", "completed": true}, |
| 143 | + {"date": "2024-03-04", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 144 | + {"date": "2024-03-04", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 145 | + {"date": "2024-03-04", "habit_id": 6, "habit_name": "Call Family", "completed": true}, |
| 146 | + {"date": "2024-03-05", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 147 | + {"date": "2024-03-05", "habit_id": 4, "habit_name": "Write Journal", "completed": false}, |
| 148 | + {"date": "2024-03-06", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 149 | + {"date": "2024-03-06", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 150 | + {"date": "2024-03-07", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 151 | + {"date": "2024-03-07", "habit_id": 5, "habit_name": "Learn New Language", "completed": true}, |
| 152 | + {"date": "2024-03-08", "habit_id": 2, "habit_name": "Read for 30min", "completed": false}, |
| 153 | + {"date": "2024-03-08", "habit_id": 4, "habit_name": "Write Journal", "completed": true}, |
| 154 | + {"date": "2024-03-09", "habit_id": 1, "habit_name": "Morning Exercise", "completed": true}, |
| 155 | + {"date": "2024-03-09", "habit_id": 3, "habit_name": "Meditate", "completed": true}, |
| 156 | + {"date": "2024-03-10", "habit_id": 2, "habit_name": "Read for 30min", "completed": true}, |
| 157 | + {"date": "2024-03-10", "habit_id": 6, "habit_name": "Call Family", "completed": true} |
98 | 158 | ] |
99 | 159 | } |
100 | 160 | ], |
101 | 161 | "variables": [ |
| 162 | + { |
| 163 | + "variableId": "selectedMonth", |
| 164 | + "type": "string", |
| 165 | + "initialValue": "2024-01", |
| 166 | + "input": { |
| 167 | + "type": "dropdown", |
| 168 | + "options": [ |
| 169 | + {"value": "All", "label": "All Months"}, |
| 170 | + {"value": "2024-01", "label": "January 2024"}, |
| 171 | + {"value": "2024-02", "label": "February 2024"}, |
| 172 | + {"value": "2024-03", "label": "March 2024"} |
| 173 | + ] |
| 174 | + } |
| 175 | + }, |
| 176 | + { |
| 177 | + "variableId": "filteredProgressData", |
| 178 | + "type": "object", |
| 179 | + "isArray": true, |
| 180 | + "initialValue": [], |
| 181 | + "calculation": { |
| 182 | + "dataSourceNames": ["progressDataTable"], |
| 183 | + "dataFrameTransformations": [ |
| 184 | + { |
| 185 | + "type": "filter", |
| 186 | + "expr": "selectedMonth === 'All' || slice(datum.date, 0, 7) === selectedMonth" |
| 187 | + } |
| 188 | + ] |
| 189 | + } |
| 190 | + }, |
102 | 191 | { |
103 | 192 | "variableId": "totalHabits", |
104 | 193 | "type": "number", |
|
113 | 202 | "isArray": true, |
114 | 203 | "initialValue": [], |
115 | 204 | "calculation": { |
116 | | - "dataSourceNames": ["progressDataTable"], |
| 205 | + "dataSourceNames": ["filteredProgressData"], |
117 | 206 | "dataFrameTransformations": [ |
118 | 207 | { |
119 | 208 | "type": "aggregate", |
|
143 | 232 | "isArray": true, |
144 | 233 | "initialValue": [], |
145 | 234 | "calculation": { |
146 | | - "dataSourceNames": ["progressDataTable"], |
| 235 | + "dataSourceNames": ["filteredProgressData"], |
147 | 236 | "dataFrameTransformations": [ |
148 | 237 | { |
149 | 238 | "type": "aggregate", |
|
169 | 258 | "isArray": true, |
170 | 259 | "initialValue": [], |
171 | 260 | "calculation": { |
172 | | - "dataSourceNames": ["progressDataTable"], |
| 261 | + "dataSourceNames": ["filteredProgressData"], |
173 | 262 | "dataFrameTransformations": [ |
174 | 263 | { |
175 | 264 | "type": "filter", |
|
201 | 290 | "Track your daily habits and build consistent routines for personal growth." |
202 | 291 | ] |
203 | 292 | }, |
| 293 | + { |
| 294 | + "groupId": "controls", |
| 295 | + "elements": [ |
| 296 | + "## 🎛️ Filters", |
| 297 | + "", |
| 298 | + "**Month:** {{selectedMonth}}" |
| 299 | + ] |
| 300 | + }, |
| 301 | + { |
| 302 | + "groupId": "heatmap", |
| 303 | + "elements": [ |
| 304 | + "## 🗓️ Habit Completion Heatmap", |
| 305 | + { |
| 306 | + "type": "vega-lite", |
| 307 | + "spec": { |
| 308 | + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", |
| 309 | + "data": {"name": "filteredProgressData"}, |
| 310 | + "mark": {"type": "rect", "stroke": "#f1f5f9", "strokeWidth": 1}, |
| 311 | + "encoding": { |
| 312 | + "x": { |
| 313 | + "field": "date", |
| 314 | + "type": "temporal", |
| 315 | + "title": "Date", |
| 316 | + "axis": {"format": "%b %d", "labelAngle": -45} |
| 317 | + }, |
| 318 | + "y": { |
| 319 | + "field": "habit_name", |
| 320 | + "type": "nominal", |
| 321 | + "title": "Habit", |
| 322 | + "sort": null |
| 323 | + }, |
| 324 | + "color": { |
| 325 | + "field": "completed", |
| 326 | + "type": "nominal", |
| 327 | + "scale": { |
| 328 | + "domain": [true, false], |
| 329 | + "range": ["#22c55e", "#ef4444"] |
| 330 | + }, |
| 331 | + "legend": { |
| 332 | + "title": "Completed", |
| 333 | + "values": [true, false], |
| 334 | + "labelExpr": "datum.value ? 'Yes' : 'No'" |
| 335 | + } |
| 336 | + }, |
| 337 | + "tooltip": [ |
| 338 | + {"field": "date", "type": "temporal", "title": "Date"}, |
| 339 | + {"field": "habit_name", "type": "nominal", "title": "Habit"}, |
| 340 | + {"field": "completed", "type": "nominal", "title": "Completed"} |
| 341 | + ] |
| 342 | + }, |
| 343 | + "width": "container", |
| 344 | + "height": 200, |
| 345 | + "background": "transparent" |
| 346 | + } |
| 347 | + } |
| 348 | + ] |
| 349 | + }, |
204 | 350 | { |
205 | 351 | "groupId": "habits", |
206 | 352 | "elements": [ |
|
230 | 376 | { |
231 | 377 | "groupId": "progress", |
232 | 378 | "elements": [ |
233 | | - "## 📈 Recent Progress", |
| 379 | + "## 📈 Progress (Filtered by Month)", |
234 | 380 | { |
235 | 381 | "type": "tabulator", |
236 | 382 | "dataSourceName": "progressData", |
|
0 commit comments