Lattice Grid Buy a licence

demo D180

Profiling a column

Count, spread, quartiles and outliers from the API, into a panel of your own

grid.statistics.profile(col)

Building…
Loading a live grid…

The configuration

import * as ng from '@angular/core';
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 createLatticeGrid from '@toclocoinc/lattice-grid/modules/angular';

const { LatticeGridComponent } = createLatticeGrid({ ng, createGrid });

const columns = [
  { field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
  { field: 'desk', title: 'Desk', filter: { type: 'set' } },
  { field: 'price', title: 'Price', type: 'number' },
  { field: 'bid', title: 'Bid', type: 'number' },
  { field: 'volume', title: 'Volume', type: 'number' },
  { field: 'notional', title: 'Notional', type: 'number',
    format: { style: 'currency', currency: 'USD' }, total: 'sum' },
];

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [LatticeGridComponent],
  template:
    '<lattice-grid [config]="grid" (filter-changed)="report()" style="display:block;height:460px"></lattice-grid>' +
    '<pre style="margin-top:12px">{{ out }}</pre>',
})
export class AppComponent implements AfterViewInit {
  @ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;
  out = '';

  grid = {
    rowKey: 'id',
    toolPanel: { side: 'left', panels: ['filters', 'columns'] },
    columns,
    rows: [/* trade records */],
  };

  // profile() reads a full summary of one column over the filtered rows, so every
  // figure follows the filters.
  report() {
    const grid = this.gridRef && this.gridRef.grid;
    if (grid) this.out = JSON.stringify(grid.statistics.profile('notional'), null, 2);
  }

  ngAfterViewInit() { this.report(); }
}

bootstrapApplication(AppComponent);