demo D188
Rules that describe the data
The outliers, found in the data, beside a threshold you typed
when: { op: 'outlier' }
Loading a live grid…
The configuration
import * as ng from '@angular/core';
import { Component } 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 });
// Two columns of the same field: a threshold you type, and a rule that finds
// the outliers in the data itself.
const formatting = {
charge: [{ when: { op: 'gt', value: 3000 }, style: { background: '#fff4e5' } }],
'charge-outlier': [{ when: { op: 'outlier' }, style: { background: '#fbeceb' } }],
};
const columns = [
{ field: 'circuit', title: 'Circuit', layout: { pin: 'start', width: 180 } },
{ field: 'region', title: 'Region', filter: { type: 'set' } },
{ field: 'charge', title: 'Charge · gt 3000', type: 'number' },
{ field: 'charge', id: 'charge-outlier', title: 'Charge · outlier', type: 'number' },
];
const rows = [/* circuit records */];
@Component({
selector: 'app-root',
standalone: true,
imports: [LatticeGridComponent],
template: '<lattice-grid [config]="grid" style="display:block;height:500px"></lattice-grid>',
})
export class AppComponent {
grid = {
rowKey: 'id',
columnDefaults: { filter: true },
formatting: formatting,
columns: columns,
rows: rows,
};
}
bootstrapApplication(AppComponent);