demo D264
Scatterplot matrix in Angular
Every pair of measures as its own small scatter, to spot which pairs move together
type: 'splom', columns
This draws every pair of measures as its own small scatter, arranged as a matrix. It lets you spot which pairs of columns move together across a dataset, so a relationship worth a closer look stands out.
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-splom'; // opt in to the splom 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:340px;margin-top:14px"></lattice-grid>',
})
export class AppComponent implements AfterViewInit {
@ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;
grid = {
rowKey: 'id',
columns: [
{ field: 'symbol', title: 'Symbol' },
{ field: 'desk', title: 'Desk', filter: { type: 'set' } },
{ field: 'price', title: 'Price', type: 'number', format: { decimals: 4 } },
{ field: 'bid', title: 'Bid', type: 'number', format: { decimals: 4 } },
{ field: 'ask', title: 'Ask', type: 'number', format: { decimals: 4 } },
{ field: 'volume', title: 'Volume', type: 'number', format: { notation: 'compact' } },
{ field: 'notional', title: 'Notional', type: 'number', format: { style: 'currency', currency: 'USD' }, total: 'sum' },
],
rows: [/* instruments: symbol, desk, price, bid, ask, volume, notional */],
};
ngAfterViewInit() {
// columns names the measures; the chart crosses every pair as its own scatter.
createChart({ grid: this.gridRef.grid, container: '#chart', type: 'splom', columns: ['price', 'bid', 'ask', 'volume'], title: 'Every measure against every other' });
}
}
bootstrapApplication(AppComponent, {
providers: [provideLattice({ createGrid })],
});