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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Choropleth of US counties via CSV data and custom color scale
m install @d3-node/choropleth-us-counties --save
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.
test
{ data, colors, scale, [ idField = 0, metricField = 1 ] }