6.6 Task 9-1 Review

6.6.1 From Day 21

  • 9-1-1. In yScale, if .range(0, h), then the y axis should be h - yScale(d). If .range(h,0), then the height of bars should be h - yScale(d).

6.6.2 From Day 22

  • 9-1-2.

    • It should be paddingInner(), rather than PaddingInner().
    • {return "rgb( )"}
  • 9-1-3. .attr("text-anchor", "middle")

  • 9-1-4. I should use d3.select("p"), rather than svg.select("p"). Why? Because the new p element is parallel with the svg element, I cannot select the p within svg.

  • 9-1-6. The .transition() should be added within the anonymous function. It should be put after you have updated the data and before any changes.

  • 9-1-8. It is ease(d3.easeLinear(), not ease(d3.scaleLinear()).

  • 9-1-9. Scott Murray was wrong. The position of .delay() is not flexible at all. It mush be put AFTER .transition().

  • 9-1-10. Please keep in mind that if you have .delay() after the .transition(), then duration() is applied to each individual transition, rather than all transitions in aggregate.

6.6.3 Recap: functions you absolutely HAVE TO call d3 first:

  • d3.scaleLinear() …

  • d3.max()

  • d3.range()

  • d3.easeLinear

6.6.4 From Day 23

  • 9-1. return "rgb(0, 0, " + Math.round(d*10) + ")". You are not allowed to have space between rgb and (.

6.6.5 From Day 24

  • xScale.bandwidth().

  • d3.range(), rather than range().

  • Within the anonymous function of .on(), there is no need to write return ...

6.6.6 From Day 29

  • 9-1-4.
    • <p>Click Here</p>. No need to use ""
    • alert("phrase here")
  • 9-1-5. Even if you used svg.selectAll("placeholder-for-rects") to create and select placeholder elements to be used later, you still need to use svg.selectAll("rect") in .on() when you updating the data.