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