A progress ring goal chart for Bootstrap 5 with three concentric SVG rings for move, exercise and stand goals, inspired by fitness app activity rings. Next to the circular progress chart, a legend lists the current value, the goal and what is left, and a last 7 days selector switches the rings, which makes this widget a good fit for fitness apps, health dashboards and habit trackers.
How it works
The root is section.prg with a Bootstrap card. script.js starts with two arrays: GOALS (name, unit, goal, Bootstrap Icons class and color for each ring) and DAYS (seven entries, oldest first, today last). On DOMContentLoaded, drawRings() creates a track circle and a progress circle per goal inside svg.prg-svg, and setRing() turns each ratio into a stroke-dashoffset. Above 100% a darker .prg-lap arc draws the second lap, so overachieved goals stay visible.
The day selector in [data-prg-days] is built from native btn-check radios. Their dates are computed from today, shown as weekday and day number without a year, and each label carries a mini version of the rings. Choosing a day re-renders the rings, the .prg-item legend buttons, the date line and the [data-prg-badge] badge ("1 of 3 closed"). Hovering or focusing a legend item, or tapping a ring, dims the other rings and shows that goal's percentage in .prg-center. The footer summarises how many days all rings were closed and the average move value.
Customization
GOALSinscript.js: change a goal, its unit or its icon, e.g.goal: 600for a higher move target.DAYSinscript.js: replace the sample values with your tracker data; dates are always computed from today.--prg-move,--prg-exerciseand--prg-standon.prg: recolor the rings, the mini rings and the legend; they override thecolorvalues inGOALS.--prg-ring-sizeon.prg: makes the main ring chart larger or smaller.BIG.widthandBIG.radiiinscript.js: thicker or thinner rings..prg-badge.is-open: restyle the badge shown while goals are still open.
Use cases
- Fitness and wellness apps: daily move, exercise and stand goals at a glance.
- Habit trackers: three habits per day with a week of history.
- Corporate wellbeing portals: step, activity and break goals for employees.
- Learning platforms: lessons, minutes and quiz goals per day.
Accessibility
The SVG is decorative (aria-hidden); the same numbers are in the legend buttons, each with an aria-label such as "Exercise: 33 of 30 min, 110%". Tab reaches each goal and the day radios, arrow keys move between days, and a visually hidden polite live region announces the percentages after a day change. Escape clears the ring highlight. Focus outlines are visible and ring animations are disabled with prefers-reduced-motion: reduce.
Usage notes
Requires Bootstrap 5.3 CSS and Bootstrap Icons. Several .prg widgets can share one page because radio names and ids are generated per instance.