...

/

Adding a Bit More to Our Difference Chart

Adding a Bit More to Our Difference Chart

Learn how to add a few more elements, such as axis labels and titles to make your difference chart better.

Add a y-axis label

Because it’s not immediately obvious what we’re looking at on the y-axis, we should add in a nice subtle label on it:

Press + to interact
svg.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.style("fill", "black")
.text("Daily Downloads from Leanpub");

Add a title

Every graph should have a title. The following code adds this to the top(ish) ...