Socket
Book a DemoInstallSign in
Socket

@d3-node/choropleth-us-counties

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@d3-node/choropleth-us-counties

D3-Node Choropleth of US counties (with state boundaries)

0.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Choropleth Map of US Counties :earth_americas:

Choropleth of US counties via CSV data and custom color scale

map

Install

$ npm install @d3-node/choropleth-us-counties --save

Usage

const d3nMap = require('@d3-node/choropleth-us-counties')

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

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

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

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

See test for actual usage.

Output the test map to an image (PNG)
npm test

API

Options

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

Keywords

d3

FAQs

Package last updated on 25 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.