Command Palette

Search for a command to run...

Hectal
Phase 2: Seeing Data: Choosing the Right Chart
Data Visualization · Exercise 2 of 4 PreviousNext
Beginner

Size a circle by area

Write radiusFor(value, max, maxRadius) so that the circle's area is proportional to the value. The biggest value gets maxRadius.

Return 0 for a zero, negative, missing or NaN value instead of letting NaN reach the SVG.

What Check tests

  1. The biggest value gets the biggest radius
  2. A quarter of the value gives half the radius
  3. Zero, negative and missing values give 0
  4. The drawn circle for 439 rides has radius about 9.5
  5. No attribute holds NaN

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.