This gist is a starting point to code a function buiding wikiatlas keys. It also gather helpful resources to learn and code further. Collaborative and versionned coding, fork, can be done on Codio.
Ideally, the function should take as input :
[zmin, zmax]
(?),[0, 50 200, 500, <zmax>]
,[<zmin>, -200, -100, -50, 0]
to then build a set of keys which manage both positive and negative altitudes,
Two different approches are implemented.
One use a threshold scale, in the style of Ford Fessenden’s map of police stops involving force.
A linear scale is used to set the x-position of each colored rectangle in the key. There is one rectangle per color in the threshold scale’s range, and one tick per value in the threshold scale’s domain. The linear scale’s domain sets the implied extent of the key, here spanning 0 to 100%.
Explore D3's ordinal scales
may be productive.
.domain()
, .range()
, .ticks()
..ticks()
Public domain.
Modified http://d3js.org/d3.v3.min.js to a secure url
Modified http://d3js.org/topojson.v1.min.js to a secure url
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v1.min.js