d3-node/choropleth-us-counties

Name: choropleth-us-counties

Owner: D3-Node

Description: null

Created: 2017-08-25 05:21:57.0

Updated: 2017-08-25 10:14:05.0

Pushed: 2017-08-25 05:22:54.0

Homepage: null

Size: 642

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Choropleth Map of US Counties :earth_americas:

Choropleth of US counties via CSV data and custom color scale

map

Install
m install @d3-node/choropleth-us-counties --save
Usage
t d3nMap = require('@d3-node/choropleth-us-counties')

ead CSV -> parse to json
t csv = fs.readFileSync('./unemployment.csv').toString()
t data = d3nMap.csvParse(csv)

t colors = [ // 9-color scheme (blue)
f7fbff', '#deebf7', '#c6dbef',
9ecae1', '#6baed6', '#4292c6',
2171b5', '#08519c', '#08306b'


t scale = [ 2, 3, 4, 5, 6, 7, 8, 9 ] // buckets for unemployment rate

t map = d3nMap({ data, colors, scale })
svgString() // returns <svg>

See test for actual usage.

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

{ data, colors, scale, [ idField = 0, metricField = 1 ] }


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.