Lattice Grid Buy a licence

demo D185

Shadow columns: rank and movement in Angular

Rank, percentile and places moved; sort by places moved for live top movers

shadow: { of, kind: 'rankChange' }

This grid adds shadow columns for rank, percentile and places moved, so sorting by places moved surfaces the live top movers. It turns a changing feed into a leaderboard of who rose and fell most, from the movements it already tracks.

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 } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { LatticeGridComponent, provideLattice } from '@toclocoinc/lattice-grid/angular';

const columns = [
  { field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
  { field: 'desk', title: 'Desk', filter: { type: 'set' } },
  { field: 'region', title: 'Region', filter: { type: 'set' } },
  { field: 'price', title: 'Price', type: 'number' },
  { id: 'rank',  title: 'Rank', shadow: { of: 'price', kind: 'rank' }, type: 'number' },
  // rankChange is places climbed since the baseline: the top-movers column.
  { id: 'moved', title: 'Places moved', shadow: { of: 'price', kind: 'rankChange' }, type: 'number', format: { signed: true } },
  { id: 'pct',   title: 'Percentile', shadow: { of: 'price', kind: 'percentile' }, type: 'number' },
  { id: 'quartile', title: 'Quartile', shadow: { of: 'price', kind: 'quartile' }, type: 'number' },
];

const rows = [/* a live price book */];



@Component({
  selector: 'app-root',
  standalone: true,
  imports: [LatticeGridComponent],
  template: '<lattice-grid [config]="grid" style="display:block;height:460px"></lattice-grid>',
})
export class AppComponent {
  grid = {
    rowKey: 'id',
    highlightOnChange: { duration: 500 },
    toolPanel: {
      side: 'left', panels: ['columns', 'filters'],
      // Mark all: reset every baseline to the current book, so the deltas and
      // the rank change start again from now.
      actions: [{ name: 'rebase', title: 'Mark all', icon: 'flag',
        run: ({ grid }: any) => grid.statistics.rebase('price') }],
    },
    state: { sort: [{ col: 'moved', dir: 'desc' }] },
    columns: columns,
    rows: rows,
  };
}

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