Files
archived-matedroid/app
Davide FerrariandClaude Opus 4.5 2a50ea7f94 perf(charts): optimize line charts with LTTB downsampling for smooth scrolling (#59)
* perf(charts): optimize line charts with LTTB downsampling for smooth scrolling

Long trips (>100km) and charging sessions could have hundreds or thousands
of data points, causing scroll stutter when rendering charts.

Changes:
- Add OptimizedLineChart component with LTTB (Largest Triangle Three Buckets)
  downsampling algorithm
- Reduce data points to max 150 while preserving visual shape
- Use Path-based drawing instead of individual line segments
- Cache computed values with remember() to prevent recalculation during scroll
- Support tap-to-show-tooltip functionality
- Support time labels on X-axis for charge detail charts

Both DriveDetailScreen and ChargeDetailScreen now use the optimized component.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(charts): add proper axis labels following chart guidelines

Apply chart guidelines from CLAUDE.md:

Y-axis labels:
- Show 4 labels at: 1st quarter (25%), half (50%), 3rd quarter (75%), end (100%)
- Skip the minimum (0%) label at top

X-axis time labels:
- Show 5 labels at: start (0%), 1st quarter (25%), half (50%), 3rd quarter (75%), end (100%)
- Added time label extraction for DriveDetailScreen charts
- Updated ChargeDetailScreen to use 5 labels instead of 4

Both screens now follow the standardized chart guidelines for consistent UX.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 11:01:52 +01:00
..