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
npm i @lsteiner/map_module
import {draw} from '@lsteiner/map_module'
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
}
call the draw function with the configuration object parameter you've made, eg:
draw(config);