demo D180
Profiling a column
Count, spread, quartiles and outliers from the API, into a panel of your own
grid.statistics.profile(col)
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/lattice-grid.min.css">
<div id="grid" style="height: 460px"></div>
<pre id="out" style="margin-top: 12px"></pre>
<script type="module">
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.27.0/modules/htmx.esm.js';
const grid = createGrid(document.getElementById('grid'), {
rowKey: 'id',
toolPanel: { side: 'left', panels: ['filters', 'columns'] },
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' },
],
rows, // trading book records
});
// profile reads a full summary of one column over the filtered rows: the
// count, the spread, the quartiles and the shape of the distribution.
// Recompute it whenever the filters change, so the read-out always describes
// what is on screen.
const out = document.getElementById('out');
const report = () => {
out.textContent = JSON.stringify(grid.statistics.profile('notional'), null, 2);
};
grid.on('filter:changed', report);
report();
</script>