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

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

One HTML file. Save it and open it in any browser.Open full screen

Example: Fernway Outfitters 2024 at a Glance, a year-over-year KPI infographic.

Six cards count up from last year's value to this year's as they scroll into view, while each 12-month sparkline draws itself in. Hover or touch a sparkline, or Tab to it and press the arrow keys, to read any month's value. Green and red badges respect lower-is-better metrics. Press Replay counters to run the animation again; with reduced motion on, final values appear instantly.

Written by AI from this prompt. Your results will vary.

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 in Infographics