demo D179
Statistics in the totals row
Median, percentiles, deviation and spread, each over the filtered rows
total: 'median' · 'p95' · 'stddev'
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.min.css">
<div id="grid"></div>
<script type="module">
import React from 'https://esm.sh/react@18';
import { createRoot } from 'https://esm.sh/react-dom@18/client';
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.esm.min.js';
import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/modules/react.esm.min.js';
const LatticeGrid = createLatticeGrid({ React, createGrid });
const columns = [
{ field: 'reference', title: 'Reference', layout: { pin: 'start', width: 150 } },
{ field: 'desk', title: 'Desk', filter: { type: 'set' } },
// Each column names its own reduction: median, 95th percentile, deviation.
{ field: 'price', title: 'Price', type: 'number', total: 'median' },
{ field: 'bid', title: 'Bid', type: 'number', total: 'p95' },
{ field: 'volume', title: 'Volume', type: 'number', total: 'iqr' },
{ field: 'notional', title: 'Notional', type: 'number', total: 'sum' },
];
const rows = [/* trading book records */];
function App() {
return (
<LatticeGrid
rowKey="id"
columnDefaults={{ filter: true }}
columns={columns}
rows={rows}
style={{ height: '460px' }}
/>
);
}
createRoot(document.getElementById('grid')).render(<App />);
</script>