demo D187
Marking a baseline
"Mark all" resets every delta to now
grid.statistics.rebase(col)
Loading a live grid…
The configuration
import * as ng from '@angular/core';
import { Component, ViewChild } 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: 'price', title: 'Price', type: 'number' },
{ id: 'delta', title: 'Change', shadow: { of: 'price', kind: 'delta' }, type: 'number', format: { signed: true } },
{ id: 'first', title: 'Baseline', shadow: { of: 'price', kind: 'firstValue' }, type: 'number' },
];
@Component({
selector: 'app-root',
standalone: true,
imports: [LatticeGridComponent],
template:
'<button (click)="markAll()">Mark all</button>' +
'<lattice-grid [config]="grid" style="display:block;height:440px;margin-top:8px"></lattice-grid>',
})
export class AppComponent {
@ViewChild(LatticeGridComponent) gridRef!: LatticeGridComponent;
grid = {
rowKey: 'id',
columns,
rows: [/* a live price book */],
};
// rebase moves every baseline to the current value, so the deltas start again.
markAll() {
const grid = this.gridRef && this.gridRef.grid;
if (grid) grid.statistics.rebase('price');
}
}
bootstrapApplication(AppComponent);