Lattice Grid Buy a licence

demo D250

Bubble map in Angular

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 Angular version. A standalone component takes the whole configuration through one config input, surfaces grid events as outputs, and exposes the live grid on a getter for anything the inputs do not cover.

The configuration

import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
import '@toclocoinc/lattice-grid/modules/chart-bubblemap';  // opt in to the bubblemap type
import { LatticeGridComponent, provideLattice } from '@toclocoinc/lattice-grid/angular';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [LatticeGridComponent],
  template:
    '<div id="chart" style="height:340px"></div>' +
    '<lattice-grid [config]="grid" style="display:block;height:320px;margin-top:14px"></lattice-grid>',
})
export class AppComponent implements AfterViewInit {
  @ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;

  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 */],
  };

  ngAfterViewInit() {
    createChart({ grid: this.gridRef.grid, container: '#chart', type: 'bubblemap', lon: 'lon', lat: 'lat', size: 'users', label: 'city', title: 'Users by city' });
  }
}

bootstrapApplication(AppComponent, {
  providers: [provideLattice({ createGrid })],
});