Skip to content

Sparklines on dashboard widgets - #16

Merged
almokhtarbr merged 1 commit into
mainfrom
widget-sparkline
Sep 7, 2026
Merged

almokhtarbr merged 1 commit into
mainfrom
widget-sparkline

Conversation

@almokhtarbr

Copy link
Copy Markdown
Owner

Follow-up to #11 / #14. Each count-shaped widget now shows a tiny trend under its headline number.

  • WidgetMetric::Result gains a series — daily counts grouped from the rollups and zero-filled for every day in the window.
  • DashboardsHelper#sparkline renders a normalised <polyline> in an inline SVG. No JS, no charting dependency. Returns nil (nothing drawn) for a flat-zero or single-point series.

Specs: WidgetMetric series length/values/zero-fill; helper nil-cases, point count, and that the max sits nearest the top. Suite 305 green, rubocop clean, brakeman 0. No migration.

WidgetMetric now also returns a zero-filled daily series across the
widget's window, and the card draws it as a small inline-SVG polyline
(no JS, no charting library). The sparkline is skipped for a flat-zero or
single-point series.

- WidgetMetric::Result gains :series; #call groups rollups by date and
  zero-fills every day in start_date..today
- DashboardsHelper#sparkline normalises the series to a polyline
@almokhtarbr
almokhtarbr merged commit fcf33d2 into main Sep 7, 2026
2 checks passed
@almokhtarbr
almokhtarbr deleted the widget-sparkline branch September 7, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant