d3-node/map-us-states

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

Homepage:

Size: 271

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Map of US States :earth_americas:

geocoded markers (via CSV) with radius representing a datapoint

map

Install
m install @d3-node/map-us-states --save
Usage
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.

Output the test map to an image (PNG)
test
API
Options

{ markers, [ radius, fill, styles ] }


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.