Summary
Add charting capabilities to views.rules so spending patterns can be visualized directly in HTML and TXT reports.
Motivation
Tables are great for detailed data, but some patterns are only visible through charts:
- Spending trends over time (increasing/decreasing)
- Category concentration (where does 80% go?)
- Seasonality and timing patterns
- Comparison across dimensions (weekday vs weekend, cardholder, etc.)
Proposed Syntax
[Food Delivery]
filter: category == "Food" and subcategory == "Delivery"
chart: trend # line chart over time
[Spending by Category]
filter: not is_excluded
chart: bar
group_by: category # aggregate by this field
limit: 10 # top N
[Monthly Bills]
filter: is_monthly
chart: stacked
group_by: subcategory
Chart Types
| Type |
HTML Render |
TXT Render |
trend |
SVG line chart (monthly) |
ASCII sparkline ▁▃▅▇▅▃▁ |
bar |
Horizontal SVG bars |
████████░░ $5,000 |
pie |
SVG donut chart |
Percentage table |
stacked |
Stacked bar by month |
Grouped ASCII bars |
heatmap |
Calendar grid |
ASCII calendar |
histogram |
Distribution bars |
Bucket counts |
Chart Properties
chart: trend | bar | pie | stacked | heatmap | histogram
group_by: category | subcategory | merchant | month | dayofweek | cardholder
limit: 10 # max items (default: 10)
sort_by: total | cv | count # ordering
period: month | week | day # x-axis grouping for trend
buckets: [0, 50, 100, 500] # for histogram
Example Queries (New Insights)
Spending Velocity
[Spending Acceleration]
description: Categories where spending is increasing month-over-month
filter: slope(sum(by("month"))) > 0.1
chart: trend
Weekend vs Weekday
[Weekend Splurge]
filter: dayofweek(date) in [6, 7]
chart: bar
group_by: category
Late Night Spending
[Late Night Spending]
filter: hour(time) >= 21 or hour(time) <= 5
chart: bar
group_by: subcategory
Subscription Creep
[Subscription Growth]
filter: category == "Subscriptions"
chart: stacked
group_by: month
Merchant Concentration
[Top 10 Concentration]
filter: total > 1000
chart: pie
group_by: merchant
limit: 10
Transaction Size Distribution
[Transaction Sizes]
filter: amount > 0
chart: histogram
buckets: [0, 25, 50, 100, 250, 500, 1000, 5000]
Family Member Comparison
[By Cardholder]
filter: not is_excluded
chart: stacked
group_by: cardholder
New Primitives Needed
| Primitive |
Description |
slope(list) |
Linear regression slope (is spending increasing?) |
dayofweek(date) |
1-7 for filtering/grouping |
hour(time) |
0-23 for time-of-day analysis |
cardholder |
Card member field from transactions |
HTML Output
Inline SVG, no external dependencies:
<section class="monthly-section">
<div class="section-header">...</div>
<div class="section-chart">
<svg viewBox="0 0 400 150">
<!-- pure SVG bars/lines, styled with CSS vars -->
</svg>
</div>
<div class="section-content">...</div>
</section>
TXT Output
[Monthly] $6,805/yr · $567/mo
├─ Pro Club ████████████████████ $6,805
├─ Augusta Lawn ████████████░░░░░░░░ $5,289
└─ Puget Sound ████████░░░░░░░░░░░░ $4,215
Trend: ▂▃▅▇▆▅▄▃▂▂▃▄ (Jan-Dec)
Value
| Query Type |
What It Reveals |
| Late Night Spending |
Hidden impulse purchases |
| Weekend Splurge |
Lifestyle vs necessity split |
| Spending Acceleration |
Habits getting out of control |
| Subscription Growth |
Creeping monthly commitments |
| Top 10 Concentration |
Dependency on few merchants |
| By Cardholder |
Family spending comparison |
Summary
Add charting capabilities to views.rules so spending patterns can be visualized directly in HTML and TXT reports.
Motivation
Tables are great for detailed data, but some patterns are only visible through charts:
Proposed Syntax
Chart Types
trend▁▃▅▇▅▃▁bar████████░░ $5,000piestackedheatmaphistogramChart Properties
Example Queries (New Insights)
Spending Velocity
Weekend vs Weekday
Late Night Spending
Subscription Creep
Merchant Concentration
Transaction Size Distribution
Family Member Comparison
New Primitives Needed
slope(list)dayofweek(date)hour(time)cardholderHTML Output
Inline SVG, no external dependencies:
TXT Output
Value