choropleth - VizArtJS/vizart-geo GitHub Wiki

Quick Reference

import { choropleth } from 'vizart-geo';
import 'vizart-geo/dist/vizart-geo.css';

const chart = choropleth('#chart', {
	data: {
		x: { name: 'states', type: 'string', accessor: 'name'} ,
		y: [ { name: 'sales', type: 'number', accessor: 'sales'} ],
	}
});

d3.json('./data/sales_us.json', function(data){
	chart.render(data);
});

API

Default options:

const DefaultOptions = {
  chart: {
    type: 'choropleth',
  },
  plots: {
    emptyDataColor: '#ffffff',
    fillOpacity: 0.8,
    stroke: '#ffffff',
    strokeDashArray: '5,1',
    strokeHighlight: '#8f8d8b',
    strokeWidth: 1.5,
    strokeWidthHighlight: 3,
  },
  color: {
    scheme: MetroCold5,
    type: Globals.ColorType.GRADIENT,
  },
  geojson: {...} // us by default
  map: {
    tileLayer: ,
    layerOptions: {
      maxZoom: 18,
      detectRetina: true,
      id: 'stare.op5mde27',
    },
    center: [37.8, -96.9],
    zoomLevel: 4,
  },
};