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.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
Act as a front-end developer and data-visualization designer who builds tools for teachers. Build Grade Lens, a one-page classroom grade distribution infographic for a single test or quiz. Store scores as an inline JavaScript array per class (no textarea, no forms). Include three realistic sample classes with 20-28 scores each, and switch between them with pill buttons. Compute everything from the array: 10-point bins (the lowest bin starts at the floor of the minimum score, the top bin is 90-100), mean, median, Q1 and Q3 using linear interpolation, range and standard deviation.
Rules:
- Draw an SVG histogram sized to its container and redrawn on resize. Put count labels on the bars and A-F band letters under the axis. Add a dashed coral mean line and a solid teal median line, and stagger their labels when they sit close together.
- Below the histogram, add a box plot on the same score scale showing low, Q1, median, Q3, high and a mean dot.
- Show stat cards and one plain-language summary sentence built from the numbers. It covers the average and its letter grade, the middle-half range, the most common band, whether low or high scores pull the mean, and how many students scored below 60.
- Make bars focusable. Hover, tap, Tab or arrow keys update a live readout with the count and percent for that band.
- Use a warm off-white background, navy ink, indigo bars and system fonts. Bars grow on load except under prefers-reduced-motion. The layout fits 360-1280px.
- Add a short note explaining how to replace the scores array.
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: Grade Lens, a one-page snapshot of how a class scored on one test.

The page opens on Period 2 Algebra I. Bars grow into a histogram of 10-point bands, with a dashed coral mean line (79.4) and a solid teal median line (80.5). A box plot underneath shows the middle half of the class. Hover, tap or Tab onto a bar, or use the arrow keys, to see its count and percent. Switch classes with the pill buttons and watch the summary sentence rewrite itself.

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

Tips and common edits

Why this works

  • Keeping scores in an inline array avoids forms and inputs, so the file runs in any sandbox and a teacher edits just one line.
  • Naming the quartile method and the bin edges stops the model from guessing, so the numbers come out consistent and checkable.
  • The summary sentence is generated from the computed stats, which turns the chart into something a parent or principal can read at a glance.

Paste into ChatGPT, Claude or Gemini. Save the code as grade-lens.html and open it in a browser, or use the chat's preview or canvas. To chart a real class, replace the numbers in the scores array.

Common edits

  • Change the bins to 5-point bands or switch the letter cutoffs to your school's scale (for example, an A starting at 93).
  • Add a target-score line, such as a 70% mastery threshold, and report how many students are above it.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Infographics