Skip to content

Instantly share code, notes, and snippets.

@juanpasolano
Last active December 19, 2019 22:45
Show Gist options
  • Save juanpasolano/e2856fc42f359cd2bcda9b707f1abfa5 to your computer and use it in GitHub Desktop.
Save juanpasolano/e2856fc42f359cd2bcda9b707f1abfa5 to your computer and use it in GitHub Desktop.
County Map readme

How to use it

Install dependencies and build the library from the terminal

yarn install
yarn build

This will generate some files in the dist folder.

To use the map import dist/main.js script and initialize it with window.initMapApp(element)

  <!-- The element we want to render the map to -->
  <div id="root"></div>
  <!-- Import the script -->
  <script src="dist/main.js"></script>
  <!-- Initialize it -->
  <script>window.initMapApp(document.getElementById("root"))</script>

You can pass some options as the second argument of the initMapApp method

Option default Description
width 800 The width of the map
primaryColor #213766 The color used for the ui (buttons, texts, etc)
colorRangeFrom #EC770F The color from which the range starts (used only in the map visualization)
colorRangeTo #3cd33e The color from which the range ends (used only in the map visualization)

An example of a use is:

window.initMapApp(el, {
  width: 1200,
  primaryColor: "#123123",
  colorRangeFrom: "#00ff00",
  primaryColor: "#ff0000",
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment