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">
<style>
#grid > div { height: 460px; }
</style>
<div id="grid"></div>
<script type="module">
import * as Vue from 'https://esm.sh/vue@3';
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/vue.esm.min.js';
const LatticeGrid = createLatticeGrid({ vue: Vue, createGrid });
Vue.createApp({
components: { LatticeGrid },
data() {
return {
config: {
rowKey: 'id',
columnDefaults: { filter: true },
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' },
],
rows, // trade records, one per row
},
};
},
template: '<lattice-grid v-bind="config" />',
}).mount('#grid');
</script>