Command Palette

Search for a command to run...

Hectal
Phase 14: Charts in React
Data Visualization · Exercise 2 of 5 PreviousNext
Intermediate

No NaN, ever

Bars crashes into NaN widths when a day has no reading, and draws an empty frame for an empty list. Fix it: leave out rows whose value is not a finite number, and show the sentence No data to draw. when nothing is left.

The scale must not divide by zero when every value is 0.

What Check tests

  1. The row with a null is left out: 2 bars
  2. An empty list says No data to draw.
  3. All zeros draw zero-width bars, not NaN
  4. 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.