Build a Year-over-Year Growth Infographic with Animated Counters and Sparklines
A single HTML file KPI infographic where year-over-year numbers count up once on view, each metric carries an inline SVG sparkline, and reduced-motion users see static final values.
The prompt
Act as a senior data-visualization designer and front-end developer. Build "Fernway Outfitters: 2024 at a Glance", a year-over-year growth infographic for a fictional outdoor gear retailer. Show six KPI cards: net revenue, active members, average order value, repeat purchase rate, return rate and fulfillment time. Each card shows the 2024 value, the 2023 value, a colored change badge and a 12-month inline SVG sparkline. Rules: 1) Counters animate once, from the 2023 value to the 2024 value with an ease-out curve, when each card scrolls into view (IntersectionObserver); a Replay button reruns them. 2) Under prefers-reduced-motion, show final numbers immediately with no count-up or line draw, and say so on the Replay button. 3) Sparklines draw in with a stroke animation; hovering, touching or using arrow keys on a focused sparkline shows the month and value in a small readout. 4) Some metrics are lower-is-better: color the badge green when the move is good and red when it is bad, mark those cards, and show a legend plus a summary line counting improved metrics. 5) Use a warm off-white background, deep navy text, one blue accent, tabular numbers, a responsive card grid from 360 to 1280px and visible focus rings. 6) Give each card one realistic context sentence. Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Counting from last year's value to this year's makes the change itself the animation, so the motion carries meaning instead of decoration.
- Fixing the six KPIs, the lower-is-better logic and the color rules up front stops the model from inventing vague metrics or mislabeling a good drop.
- Naming IntersectionObserver and prefers-reduced-motion gets a once-only, accessible animation on the first try.
Paste into ChatGPT, Claude or Gemini. Save the returned code as growth.html and open it in any browser, or view it in the chat's preview/canvas. Scroll to trigger counters and hover the sparklines.
Common edits
- Swap in your own company name, KPIs and twelve monthly values, keeping the prior and current figures for each card.
- Change the accent and good/bad colors, or ask for quarterly sparklines with a toggle between monthly and quarterly views.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build a Monthly KPI Dashboard One-Pager with RAG Status and Sparklines in HTML
A single HTML file that shows six business KPIs as cards with targets, red/amber/green status, SVG sparklines, a month stepper and editable one-line commentary.
Build a 100-Person Icon Array Demographic Infographic in One HTML File
You get a single HTML file that shows a fictional town as 100 SVG person icons, with tabs for commute, age and housing and an interactive legend that highlights each group.
Build a Classroom Grade Distribution Infographic with Histogram and Quartiles
A single HTML file that turns an inline array of class scores into a histogram with mean and median markers, a box plot, stat cards and a plain-language summary.
Build a Gantt-Style Project Timeline Infographic with Milestones in Pure SVG
A single HTML file that draws a project Gantt chart in pure SVG, with progress bars, dependency arrows, milestone diamonds, a Today marker and hover tooltips.
Build an Accessible Market Share Donut Chart Infographic With Legend in HTML
A prompt that builds a single-file SVG donut chart of competitor market share, with a ranked legend, keyboard navigation, tap focus and an automatic Other bucket.
Build an Interactive Team Org Chart One-Pager with Contact Cards in HTML
Get a single HTML file with an expandable SVG org chart, department color coding, clickable contact cards and a search box that highlights matching people.