Day Seventeen

4 July 2021

Number of SDA properties within SA3s | viewed as a choropleth map

Log

Working from day 13. This week I needed to make a legend, and I always muck about with this, and for some reason I had a look at Elijah Meek's book (which I need to do more of as every time I do this I pick something new up, and saw a refernce about using d3 SVG legend developed by Susie Lu. I had used their annotation tool before on a project (which I need to add in here on a day or two or three...). So Isued it on a project, and what I would normally spend time messing about on, it juts worked - BAM - like that.

  1. ADDED THIS:
    const legend = svg
    .append("g")
    .attr("class", "legendLinear")
    .attr("transform", "translate(10,220)")

    const legendLinear = d3.legendColor()
    .shapeWidth(10)
    .shapeHeight(10)
    .shapePadding(5)
    .orient('vertical')
    .scale(scale_color)
    .title("Number of SDA dwellings")

    legend
    .select(".legendLinear")
    .call(legendLinear)
  2. There are many options for layout included and more detail can be found at on the documentation page here

As ever code can be found here