Command Palette

Search for a command to run...

Hectal
Phase 10: Colour, Typography and Responsive Charts
Data Visualization · Exercise 1 of 4Next
Beginner

Colour bars by value

Four bars show 10, 40, 70 and 100 rides. Colour them with a sequential scale: d3.scaleSequential(d3.interpolateViridis) with the domain 0 to 100, so the smallest bar is dark purple and the largest is yellow.

The starter paints every bar the same grey.

What Check tests

  1. There are 4 bars
  2. The smallest bar (10) is dark purple, rgb(72, 36, 117)
  3. The largest bar is yellow (#fde725)
  4. The four bars have four different colours
  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.