Published
Edited
Sep 21, 2020
Insert cell
md`# Day Twenty (Task 8 Continued + Task 9-1), 2020-09-13`
Insert cell
d3 = require("d3@6")
Insert cell
random = Math.random()
Insert cell
Math.round(random)
Insert cell
Math.floor(random)
Insert cell
md` ## Some key points about \`Math\`
- \`Math.random()\` will generate random numbers less than 1.0.
- If \`random = 8.9999\`, then \`Math.round(random) = 9 \` but \`Math.floor(random) = 8\`.
- \`Math\` is **parallel** with \`d3\`, so \`d3.Math....\` is unnecessary and wrong.

`
Insert cell
md`## Task 8

- 8-7. Let the dataset be made up of 50 pairs of random numbers between 0 and 100 that are integers.
- 8-8. Remove labels.
- 8-9. Treat values on x-axis as percentages with one decimal point precision. *Hint* : using \`d3.format("")\`, and \`.tickFormat()\`.

`
Insert cell
md`# Chapter 9: Updates, Transiations, and Motion`
Insert cell
md` Task 9-1.

- 9-1-1. Make a normal-looking bar chart for this dataset: [ 5, 10, 13, 19, 21, 25, 22, 18, 15, 13, 11, 12, 15, 20, 18, 17, 16, 18, 23, 25 ]. Width and height of the SVG: 600, 250.
`
Insert cell
md`
Go to [Day 21](https://observablehq.com/@hongtaoh/day-twenty-one-task-9-continued-2020-09-14).
`
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more