Files
school_compare/nextjs-app/components/PerformanceChart.module.css
T
Tudor Sitaru d569a2afda
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 15s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 53s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 12s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s
feat(chart): mobile-only single-metric chip selector for Results Over Time
The Results Over Time chart on the school detail page was overcrowded
on phones — 5-item legend wrapping over the plot area, a hidden right
y-axis still rendered for the (collapsed) progress series, fixed
0–100 percentage scale that flattened all variation, angled x-axis
labels eating vertical space.

At ≤640px the chart now renders one metric at a time, selected via a
chip strip above the plot. No more legend. No more dual y-axis. The
y-axis auto-tightens around the actual data range so variation is
visible (a school sitting in the 70–90% band now uses a 65–95 axis
instead of squashing onto a 0–100 line). A small subtitle above the
chips sets the subject context ("KS2 SATs · Reading, Writing & Maths"
or "GCSE results · Year 11") so chip labels can describe the *view*
rather than re-stating the subject.

Chip labels are spelled out in parent-facing language — no internal
shorthand like "RWM":

  Primary  (KS2):  At expected level (default)
                   Above expected level
                   Pupil progress         (shows 3 series + mini-legend)

  Secondary (KS4): Attainment 8 (default)
                   English & Maths grade 4+
                   Progress 8

Chips disable themselves (greyed, with a "No data for this school"
title) when the underlying series has no data points. Desktop
behaviour is unchanged — the full multi-series chart with dual y-axis
still renders >640px.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 12:49:19 +01:00

127 lines
2.5 KiB
CSS

.chartOuter {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.trendSummary {
font-size: 0.875rem;
font-weight: 600;
color: var(--text-secondary, #5c564d);
padding: 0.5rem 0.875rem;
background: var(--bg-secondary, #f3ede4);
border-left: 3px solid var(--accent-teal, #2d7d7d);
border-radius: 0 4px 4px 0;
align-self: flex-start;
}
.chartWrapper {
width: 100%;
height: 100%;
position: relative;
}
.covidNote,
.chartHint {
font-size: 0.75rem;
color: var(--text-muted, #8a847a);
margin: 0;
font-style: italic;
}
/* ── Mobile chip selector ────────────────────────────────────────────
Hidden on desktop. Replaces the in-chart legend on phones — one
metric at a time so the line variation is actually readable. */
.mobileChips {
display: none;
}
.mobileSubtitle {
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--text-muted, #6d685f);
margin-bottom: 0.4rem;
}
.chipRow {
display: flex;
flex-wrap: wrap;
gap: 0.375rem;
}
.chip {
border: 1px solid var(--border-color, #e5dfd5);
background: var(--bg-card, #fff);
color: var(--text-secondary, #5c564d);
padding: 0.4rem 0.75rem;
border-radius: 999px;
font-size: 0.8125rem;
font-weight: 500;
font-family: inherit;
cursor: pointer;
white-space: nowrap;
transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
-webkit-tap-highlight-color: transparent;
}
.chip:active {
background: var(--bg-secondary, #f3ede4);
}
.chip:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.chipActive {
background: var(--accent-coral, #e07256);
color: white;
border-color: var(--accent-coral, #e07256);
font-weight: 600;
}
.chipActive:active {
background: var(--accent-coral-dark, #c45a3f);
}
.miniLegend {
display: flex;
gap: 0.875rem;
font-size: 0.75rem;
color: var(--text-secondary, #5c564d);
margin-top: -0.25rem;
}
.miniLegend span {
display: inline-flex;
align-items: center;
gap: 0.3rem;
}
.miniDot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
}
@media (max-width: 768px) {
.chartWrapper {
font-size: 0.875rem;
}
}
@media (max-width: 640px) {
.mobileChips {
display: block;
}
/* The desktop "click the legend to show progress" hint is irrelevant
once the chip row is the disclosure mechanism. */
.chartHint {
display: none;
}
}