demo D169
Values on a map
Continents and countries from ISO codes
type: 'geomap', code, y
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/lattice-grid.min.css">
<script src="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/lattice-grid.min.js"></script>
<div id="map" style="height: 320px"></div>
<div id="grid" style="height: 320px; margin-top: 14px"></div>
<script type="module">
import { createChart } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/modules/charts';
const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
rowKey: 'id',
columns: [
{ field: 'country', title: 'ISO code', layout: { width: 140 } },
{ field: 'revenue', title: 'Revenue', type: 'number',
format: { style: 'currency', currency: 'USD' }, total: 'sum' },
],
rows, // e.g. [{ id: 1, country: 'US', revenue: 4200 }, …]
});
// A geomap reads an ISO code column and a value. A country code lands on its
// continent unless you supply country shapes; an unmatched code is reported.
createChart({ grid, container: '#map', type: 'geomap', code: 'country', y: { col: 'revenue', fn: 'sum' } });
</script>