Published
Edited
Sep 21, 2020
Insert cell
md`# Day Nineteen (Task 8), Spet. 12, 2020`
Insert cell
md` ## Task 7

- 7-1-1. The order of codes does matter in D3.js. If I put \`xScale\` and \`yScale\` before \`var dataset = ...\`, then D3 would not be able to generate any results. This because I need to call \`dataset\` in \`xScale\` and \`yScale\`.

`
Insert cell
md`# Chapter 8: Axes
`
Insert cell
md`## Task 8:

- 8-1. Create an axis on top of the chart for xScale. Assign a class named "axis" to the group element you just created at the end of the \`svg\` element. *hint* : think about whether you need to use \`d3.axisTop()\` or \`d3.axisBottom()\`.

- 8-2. Push the axis to the base of the chart using SVG *transformations*.

- 8-3. Style \`path\` and \`line\` in \`.axis\` such that they are in teal (*Hint*: using \`stroke: teal;\`). Style \`text\` such that it is Optima, sans-serif, bold, 14px, and in teal.

- 8-4. Set the rough number of ticks to be 5. // D3 might override it, though.

- 8-5. Only label 0, 100, 250, and 600, using \`tickValues([])\`.

- 8-6. Generate a Y-axis on the left. Set the rough number of ticks to be 5. Push this axis to the right by \`margin.left\` px. Also assign the class of "axis" to it.

p.145
`
Insert cell
md`
Go to [Day 20](https://observablehq.com/@hongtaoh/day-twenty-task-8-continued-2020-09-13)
`
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more