Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@d3-node/choropleth-us-states

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@d3-node/choropleth-us-states

D3-Node US States choropleth

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Choropleth Map of US States :earth_americas:

geocoded markers (via CSV) with radius representing a datapoint

map

Install

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

Usage

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

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

const stateNameField = 'State'
const valueField = 'Population'
const colors = [
  'rgb(255,245,240)', 'rgb(254,224,210)', 'rgb(252,187,161)',
  'rgb(252,146,114)', 'rgb(251,106,74)', 'rgb(239,59,44)',
  'rgb(203,24,29)', 'rgb(165,15,21)', 'rgb(103,0,13)'
]
const scale = [1, 4, 8, 15, 20, 30, 40, 50, 60]

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

See test for actual usage.

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

API

Options

{ data, colors, scale, [ stateNameField, valueField ] }

Keywords

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc