Lattice Grid Buy a licence

demo D250

Bubble map in ESM

Place a value at each point on the map and size the bubble by how large it is

type: 'bubblemap', lon, lat, size

This places a value at each point on a map and sizes the bubble by how large it is. It shows both where something happens and how much of it, so a geographic pattern of magnitude reads in one view.

Building…
Loading a live grid…

This is the ES module version. The grid is imported straight from a CDN as a module, the same configuration as the vanilla tab without a global script tag, so it drops into any bundler or a bare module script.

The configuration

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.71.0/lattice-grid.min.css">

<div id="grid" style="height: 320px"></div>
<div id="chart" style="height: 340px"></div>

<script type="module">
  import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
  import '@toclocoinc/lattice-grid/modules/chart-bubblemap';  // opt in to the bubblemap type

  const grid = createGrid(document.getElementById('grid'), {
    rowKey: 'id',
    columns: [
      { field: 'city', title: 'City' },
      { field: 'lon', title: 'Longitude', type: 'number', format: { decimals: 2 } },
      { field: 'lat', title: 'Latitude', type: 'number', format: { decimals: 2 } },
      { field: 'users', title: 'Users (m)', type: 'number', format: { decimals: 1 }, total: 'sum' },
    ],
    rows,  // one city a row: city, lon, lat, users
  });

  // lon and lat place each point directly, so no outline data is needed.
  createChart({
    grid,
    container: document.getElementById('chart'),
    type: 'bubblemap',
    lon: 'lon',
    lat: 'lat',
    size: 'users',
    label: 'city',
    title: 'Users by city',
  });
</script>