@lsteiner/map_module

0.0.7 • Public • Published

what is this module

  • this package exports a function which, when called with the correct configuration object, will append a d3-generated chloropleth chart to your document body.
  • the function is meant to run in any javascript file (extremely React Compatible!)
  • version 1 will generate a map for point in time data
  • version 2 will have a setting for point in time vs. timeseries data
  • currently supports county-level data in the US, state level configuration coming soon

how to use this module

  1. npm i @lsteiner/map_module
  2. import {draw} from '@lsteiner/map_module'
  3. the draw function takes one parameter, a configuration object, which should look like this:
    const config = {
        id: "#map-viz", // what DOM object do you want the svg to append itself to?
        data: [{datapoint}, {datapoint}, {datapoint}...], 
        title: 'a descriptive and succinct chart title', 
        numBuckets: 8,  //5-8 buckets currently supported
        colorScheme: 'green', // current schemes include 'green', 'blue', 'red', 'orange', and 'gray'
        valueKey: 'population', // in your data, what is the key of the value you're charting
        countyKey: 'GEO', //data must be mapped to county ids -- the name of the key containing that id in your data goes here
        countyNameKey: 'GEO_NAME', //the key to actual place names 
        pointInTime: true
      }
    
      
     
    
  4. call the draw function with the configuration object parameter you've made, eg: draw(config);

Package Sidebar

Install

npm i @lsteiner/map_module

Weekly Downloads

1

Version

0.0.7

License

ISC

Unpacked Size

699 kB

Total Files

5

Last publish

Collaborators

  • lsteiner