Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Spending Heatmap Visualization
Summary
Adds a new Heatmap tab to the expense tracker that visualizes daily spending patterns in a monthly calendar view. Users can see at a glance which days had high spending (darker colors) vs low spending (lighter colors), navigate between months, and drill down to view specific transactions by clicking on a day.
Features
1. Calendar Heatmap Visualization
2. Month Navigation
3. Interactive Features
4. Repository Enhancements
Added three new data access methods to
TransactionRepository:get_daily_spending_for_month(year, month)- Aggregates expenses by day for heatmap displayget_transactions_for_date(target_date)- Retrieves all transactions for a specific dateget_months_with_expenses()- Returns list of months with expense dataExample Usage
Technical Implementation
Architecture
HeatmapTab(new) - Self-contained tab component inheriting fromtk.Framettk.Notebookcreate_rectangle()for reliable color displayKey Design Decisions
Canvas-based rendering instead of Label backgrounds
Percentile-based color gradient
Navigation through months with expenses only
Consistent cell sizing (90x70 pixels)
Files Modified
expense_tracker/core/repositories.py- Added 3 new methods (+65 lines)expense_tracker/gui/tabs/heatmap_tab.py- New file (277 lines)expense_tracker/gui/tabs/__init__.py- Export HeatmapTabexpense_tracker/gui/main_window.py- Added HeatmapTab to notebook, lazy loadingexpense_tracker/gui/tabs/transactions_tab.py- Added date filter capabilitytests/core/test_repository.py- Added 8 new tests for repository methodsTest Coverage
API Changes
New Public Methods
TransactionRepository
TransactionsTab
MainWindow
Performance
Future Enhancements
Consider for future iterations: