Name: map-us-states
Owner: D3-Node
Description: geocoded markers (via CSV) with radius representing a datapoint
Created: 2017-08-16 03:35:29.0
Updated: 2017-08-18 17:57:44.0
Pushed: 2017-08-18 18:52:07.0
Size: 271
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
geocoded markers (via CSV) with radius representing a datapoint
m install @d3-node/map-us-states --save
t d3nMap = require('@d3-node/map-us-states')
ead CSV -> parse to json
t csv = fs.readFileSync('./markers.csv').toString()
t markers = d3nMap.csvParse(csv)
ptional marker radius calculation
t radius = function (d) {
turn d.POP_2010 / 150000
ptional marker color fill
t fill = function (d) {
nst colorScale = d3nMap.scaleThreshold()
.domain([1, 15, 20, 60])
.range(['rgb(255,245,240)', 'rgb(252,146,114)', 'rgb(203,24,29)', 'rgb(103,0,13)'])
turn colorScale(d.POP_2010 / 150000)
t map = d3nMap({ markers, radius, fill })
svgString() // returns <svg>
See test for actual usage.
test
{ markers, [ radius, fill, styles ] }