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
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
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 like this
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 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.
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 a Mitosis vs Meiosis Comparison Infographic in a Single HTML File
Get a ready-to-open infographic that lines up mitosis and meiosis phase by phase, with SVG cell diagrams and a toggle that highlights only the differences.
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.
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.