Show scale results as average next to a donut chart
Average and distribution now sit side by side: a big average figure with its gauge or stars, and the distribution as a donut (CSS conic-gradient, shades of one colour, legend with percent and count). A single dropdown setting scale_view (both, average only, chart only) replaces the two checkboxes; a single part is centred. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bf16ac0d3b
commit
b3c80ab79f
8 files changed
+185
-192
No files matched your search
+34
-41
@@ -309,8 +309,6 @@ textarea { resize: vertical; }
|
||||
.export-choice legend, .scale-style legend { font-weight: 600; margin-bottom: 4px; }
|
||||
.export-choice label, .scale-style label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; }
|
||||
.export-choice label:has(input:checked), .scale-style label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
|
||||
.scale-parts { border: 0; padding: 0; margin: 0 0 12px; }
|
||||
.scale-parts legend { font-weight: 600; margin-bottom: 4px; }
|
||||
.export-choice input, .scale-style input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
|
||||
.export-choice strong { display: block; }
|
||||
.export-choice .hint { display: block; margin: 2px 0 0; }
|
||||
@@ -435,36 +433,37 @@ textarea { resize: vertical; }
|
||||
.bar--c4 .bar__fill { background: var(--c4); }
|
||||
.bar--c5 .bar__fill { background: var(--c5); }
|
||||
|
||||
.columns { display: flex; gap: 8px; align-items: stretch; height: 180px; }
|
||||
.column { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
|
||||
.column__count { font-size: .85rem; color: var(--muted); }
|
||||
.column__track { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
|
||||
.column__fill { width: 100%; background: var(--c3); transition: height .6s ease; }
|
||||
.column__label { font-weight: 700; }
|
||||
.column--avg .column__fill { background: var(--c1); }
|
||||
.column--avg .column__label { color: var(--c1); }
|
||||
.average { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; margin: 0 0 20px; padding: 16px 20px; background: var(--surface-2); border-radius: 14px; }
|
||||
.average__figure { display: flex; flex-direction: column; line-height: 1.1; }
|
||||
/* scale results: average and distribution (donut) side by side, one alone is centred */
|
||||
.scale-results__row { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 16px; }
|
||||
.scale-results__row > * { flex: 1 1 300px; min-width: 0; }
|
||||
.scale-results__row--single > * { flex: 0 1 640px; }
|
||||
.average { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px 20px; background: var(--surface-2); border-radius: 14px; text-align: center; line-height: 1.1; }
|
||||
.average__label { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 700; color: var(--muted); }
|
||||
.average__value { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.average__value strong { font-size: 3.2rem; font-weight: 800; color: var(--c1); }
|
||||
.average__of { font-size: 1.4rem; font-weight: 600; color: var(--muted); }
|
||||
.average__value strong { font-size: 4rem; font-weight: 800; color: var(--c1); }
|
||||
.average__of { font-size: 1.6rem; font-weight: 600; color: var(--muted); }
|
||||
.average__count { font-size: .85rem; color: var(--muted); }
|
||||
.average__gauge { flex: 1 1 200px; }
|
||||
.average__gauge { align-self: stretch; margin: 8px 0 4px; }
|
||||
.average__track { position: relative; height: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--bg), var(--c1)); box-shadow: inset 0 0 0 1px var(--border); }
|
||||
.average__marker { position: absolute; top: 50%; width: 1.6em; height: 1.6em; margin: -.8em 0 0 -.8em; border-radius: 50%; background: var(--c1); border: .25em solid var(--bg); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); transition: left .6s ease; }
|
||||
.average__ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: .85rem; font-weight: 700; color: var(--muted); }
|
||||
/* star rating results: average as partly filled stars, bars from most to fewest stars */
|
||||
.star-meter { position: relative; display: inline-block; font-size: 2.6rem; line-height: 1; letter-spacing: .08em; white-space: nowrap; }
|
||||
.average__ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: .85rem; font-weight: 700; color: var(--muted); }
|
||||
.star-meter { position: relative; display: inline-block; max-width: 100%; font-size: 2.6rem; line-height: 1; letter-spacing: .08em; white-space: nowrap; }
|
||||
.star-meter__base { color: var(--star-empty); }
|
||||
.star-meter__fill { position: absolute; top: 0; left: 0; overflow: hidden; color: var(--star); transition: width .6s ease; }
|
||||
.bar--star .bar__fill { background: var(--star); }
|
||||
.stars-legend { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }
|
||||
.average .stars-legend { flex-basis: 100%; margin: 0; }
|
||||
/* parts hidden per slide (show_average/show_distribution): only the number of ratings remains */
|
||||
.scale-count { margin: 0 0 10px; font-size: .85rem; font-weight: 700; color: var(--muted); }
|
||||
.scale-total { display: flex; flex-direction: column; align-items: center; gap: .2em; padding: 16px 20px; background: var(--surface-2); border-radius: 14px; color: var(--muted); }
|
||||
.scale-total strong { font-size: 3em; font-weight: 800; line-height: 1; color: var(--c1); font-variant-numeric: tabular-nums; }
|
||||
.donut { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px 28px; padding: 16px 20px; background: var(--surface-2); border-radius: 14px; }
|
||||
.donut__chart { position: relative; flex: none; display: grid; place-items: center; width: 180px; aspect-ratio: 1; }
|
||||
/* the hole is masked out, so the card background shows through (gaps between slices are transparent too) */
|
||||
.donut__ring { position: absolute; inset: 0; border-radius: 50%; -webkit-mask: radial-gradient(farthest-side, transparent 60%, #000 calc(60% + 1px)); mask: radial-gradient(farthest-side, transparent 60%, #000 calc(60% + 1px)); }
|
||||
.donut__ring--empty { background: var(--border); }
|
||||
.donut__count { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; margin: 0; line-height: 1.1; color: var(--muted); font-size: .8rem; }
|
||||
.donut__count strong { font-size: 2.2em; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
|
||||
.donut__legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
|
||||
.donut__legend--wide { grid-template-columns: repeat(2, auto); column-gap: 24px; }
|
||||
.donut__item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
|
||||
.donut__item.is-empty { opacity: .5; }
|
||||
.donut__swatch { width: .9em; height: .9em; border-radius: 3px; }
|
||||
.donut__label { font-weight: 600; overflow-wrap: anywhere; }
|
||||
.donut__value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
|
||||
.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .2em .6em; line-height: 1.15; padding: 8px; }
|
||||
.cloud__word { font-weight: 800; color: var(--c0); transition: font-size .6s ease; }
|
||||
@@ -658,24 +657,18 @@ body.present {
|
||||
.stage--content .stage__description { color: var(--text); font-size: clamp(1.3rem, 2.6vw, 2.2rem); }
|
||||
.stage__results { font-size: clamp(1rem, 1.8vw, 1.5rem); margin-top: 2vh; }
|
||||
.stage .bar__track { height: 1.1em; }
|
||||
/* scale on stage: the average is the headline, the distribution a compact detail below */
|
||||
.stage .columns { height: 13vh; gap: .6vw; font-size: .75em; }
|
||||
.stage .average { padding: 2vh 2.5vw; gap: 1.5vh 4vw; margin-bottom: 1.5vh; background: rgba(var(--tint), .06); }
|
||||
.stage .average__value strong { font-size: clamp(3.4rem, 7.5vw, 7rem); }
|
||||
.stage .average__of { font-size: clamp(1.4rem, 2.8vw, 2.6rem); }
|
||||
/* scale on stage: big average next to a compact donut */
|
||||
.stage .scale-results__row { gap: 2vw; }
|
||||
.stage .average, .stage .donut { padding: 2.5vh 2.5vw; background: rgba(var(--tint), .06); }
|
||||
.stage .average__value strong { font-size: clamp(4rem, 9vw, 9rem); }
|
||||
.stage .average__of { font-size: clamp(1.6rem, 3vw, 3rem); }
|
||||
.stage .average__label, .stage .average__count, .stage .average__ends { font-size: clamp(.95rem, 1.5vw, 1.4rem); }
|
||||
.stage .average__track { height: 1em; box-shadow: none; background: linear-gradient(90deg, var(--surface-2), var(--c1)); }
|
||||
.stage .average__ends { margin-top: 6px; }
|
||||
.stage .star-meter { font-size: clamp(3rem, 7.5vw, 7rem); }
|
||||
.stage .bars--stars { gap: .8vh; font-size: .75em; }
|
||||
.stage .bars--stars .bar__track { height: .8em; }
|
||||
.stage .stars-legend, .stage .scale-count, .stage .scale__labels { font-size: clamp(.85rem, 1.2vw, 1.1rem); }
|
||||
.stage .scale-total { padding: 3vh 2.5vw; background: rgba(var(--tint), .06); }
|
||||
.stage .scale-total strong { font-size: clamp(3.4rem, 7.5vw, 7rem); }
|
||||
/* average without distribution: room for an even bigger figure */
|
||||
.stage .scale-results--average .average { padding: 4vh 3vw; }
|
||||
.stage .scale-results--average .average__value strong { font-size: clamp(4.5rem, 10vw, 9rem); }
|
||||
.stage .scale-results--average .star-meter { font-size: clamp(4rem, 10vw, 9rem); }
|
||||
.stage .star-meter { font-size: clamp(2.4rem, 4.5vw, 5rem); }
|
||||
.stage .scale-results__row--single .star-meter { font-size: clamp(3rem, 7vw, 7rem); }
|
||||
.stage .donut__chart { width: clamp(150px, 28vh, 340px); }
|
||||
.stage .donut__count { font-size: clamp(.85rem, 1.3vw, 1.2rem); }
|
||||
.stage .donut__legend { font-size: clamp(.9rem, 1.4vw, 1.3rem); }
|
||||
.stage .cloud { font-size: clamp(1.4rem, 2.6vw, 2.6rem); }
|
||||
.stage .answers { columns: 340px; }
|
||||
.stage .quiz-timer { font-size: clamp(3rem, 7vw, 6rem); }
|
||||
|
||||
Reference in new issue
Block a user