Build a Before-and-After Statistics Infographic With Color-Coded Change Arrows

A single HTML infographic comparing two years across nine metrics, showing old and new values, absolute and percent change, and arrows colored by whether up is good.

The prompt

Prompt
Act as a senior information designer and front-end developer. Build a single-page infographic called 'Harbor City Bike Share: Two Years of Change' that compares 2022 with 2024 across nine metrics: annual rides, active members, cost per ride, empty-dock hours per week, collisions per 100k rides, repair turnaround, CO2 avoided, monthly complaints and app rating. Each metric card shows the old value, the new value, the absolute change and the percent change. Rules: 1) Keep all metrics in one data array where each item says whether up is good or down is good. Compute the status from that, so rising cost shows red and falling collisions show green. Arrows point in the real direction, and unchanged metrics show a gray dash. 2) Never rely on color alone. Add an Improved, Worsened or Unchanged badge and a full screen-reader label to every card. 3) Add a summary strip with the improved, worsened and unchanged counts plus the biggest improvement. Add pill buttons that filter by status and sort by biggest change, using aria-pressed. 4) Give each card paired before and after bars that grow on load, and skip that animation under prefers-reduced-motion. 5) Use a responsive card grid from 360 to 1280px, a warm off-white background, navy text, green, red and gray status colors, system fonts and no external assets. 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: Harbor City Bike Share, a 2022 vs 2024 before-and-after infographic.

Nine metric cards show the old value crossed out beside the new one, followed by the absolute and percent change. Arrows point the way the number moved and turn green or red depending on whether that direction is good. Cost per ride rising is red, and collisions falling is green. Use the pills to show only Improved or Worsened metrics, or sort by biggest change. Bars animate on load, and Replay runs the animation again.

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

Tips and common edits

Why this works

  • A per-metric 'up is good' flag lets the code decide colors, so arrows stay honest while red and green reflect real impact.
  • Badges plus screen-reader labels repeat the status in words, so the chart works without color.
  • One data array drives the cards, summary and filters, so editing numbers updates everything at once.

Paste into ChatGPT, Claude or Gemini. Save the returned code as an .html file and open it in any browser, or view it in the chat's preview or canvas. Swap in your own numbers by editing the data array.

Common edits

  • Replace the data array with your own metrics, years and units, setting good to 'up' or 'down' for each one.
  • Change the status colors or add a third time period by adding a column to each card.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Infographics