Menu

A rose window as a radar chart: drawing quiz results in plain SVG
πŸ“°

A rose window as a radar chart: drawing quiz results in plain SVG

DEV Community: astroΒ·work wllΒ·7 days ago
#tSxCEv3H
#devtoastro#devto#dev#lancet#const
Long article (1084 words) β€” no AI summary yet.
Reading 0:00
15s threshold

I recently built a small personality quiz about the seven heavenly virtues: 35 statements, five per virtue, and a score out of 100 for each one at the end. The site is plain Astro with no backend, and I wanted the result to look like something from a cathedral rather than a dashboard. So instead of a radar chart library, the result is drawn as a seven-light rose window, where each pane of glass fills from the centre outward in proportion to its score.

Here are the three pieces that made it work, with the real code.

1. Scoring with reversed statements

Some statements describe the virtue ("When I'm praised, I mention the people who helped") and some describe the sin against it. Sin statements are reverse-scored, so agreeing with everything doesn't inflate the result. Each virtue has n answers of 1 to 5, which gives a range of n to 5n , mapped onto 0–100:

function score ( questions : Question [ ] , answers : number [ ] ) : number [ ] { const sums = new Map ( virtues . map ( ( v ) => [ v .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.