Last active
August 18, 2020 09:50
-
-
Save skflowne/6899aa6de99420dbb93e8135af8716a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import DeckGLMap from "./DeckGLMap" | |
import { ScatterplotLayer } from "@deck.gl/layers" | |
const DataMap = ({ mapboxToken = "", data = [], dotCoordinates = "coordinates", displayStat = "cases" }) => { | |
const scatterplotLayer = new ScatterplotLayer({ | |
id: "scatterplot-layer", | |
data, | |
stroked: false, | |
filled: true, | |
getPosition: (d) => d[dotCoordinates], | |
getRadius: (d) => (d[displayStat] > 0 ? (Math.log10(d[displayStat]) + d[displayStat] / 100000) * 20000 : 0), | |
getFillColor: (d) => [255, 0, 0], | |
}) | |
const layers = [scatterplotLayer] | |
return <DeckGLMap mapboxToken={mapboxToken} layers={layers} /> | |
} | |
export default DataMap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment