6.6 Task 9-1 Review
6.6.1 From Day 21
- 9-1-1. In
yScale
, if.range(0, h)
, then they
axis should beh - yScale(d)
. If.range(h,0)
, then theheight
of bars should beh - yScale(d)
.
6.6.2 From Day 22
9-1-2.
- It should be
paddingInner()
, rather thanPaddingInner()
. {return "rgb( )"}
- It should be
9-1-3.
.attr("text-anchor", "middle")
9-1-4. I should use
d3.select("p")
, rather thansvg.select("p")
. Why? Because the newp
element is parallel with thesvg
element, I cannot select thep
withinsvg
.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()
, notease(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()
, thenduration()
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 betweenrgb
and(
.
6.6.5 From Day 24
xScale.bandwidth()
.d3.range()
, rather thanrange()
.Within the anonymous function of
.on()
, there is no need to writereturn ...
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 usesvg.selectAll("rect")
in.on()
when you updating the data.