demo D201
Is this column normal? in Svelte
A Q-Q plot against a line through the quartiles
type: 'qq', y
This draws a Q-Q plot of a column against a line through its quartiles, to judge whether it is normally distributed. It answers 'is this column normal' visually, so you can see how far the data departs from the assumption before relying on it.
This is the Svelte version. A use action attaches the grid to a plain element, so no framework runtime is passed in and the component stays small, while the configuration is ordinary Svelte state.
The configuration
<script>
import { createGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.107.0/lattice-grid.esm.min.js';
import createLatticeAction from 'https://cdn.latticegrid.dev/lattice-grid@1.107.0/modules/svelte.esm.min.js';
import { createChart } from 'https://cdn.latticegrid.dev/lattice-grid@1.107.0/modules/charts.esm.min.js';
const lattice = createLatticeAction({ createGrid });
let chartEl;
const config = {
rowKey: 'id',
columns: [
{ field: 'symbol', title: 'Symbol' },
{ field: 'desk', title: 'Desk', filter: { type: 'set' } },
{ field: 'price', title: 'Price', type: 'number', format: { decimals: 4 } },
{ field: 'bid', title: 'Bid', type: 'number', format: { decimals: 4 } },
{ field: 'ask', title: 'Ask', type: 'number', format: { decimals: 4 } },
{ field: 'volume', title: 'Volume', type: 'number', format: { notation: 'compact' } },
{ field: 'notional', title: 'Notional', type: 'number',
format: { style: 'currency', currency: 'USD' }, total: 'sum' },
],
rows, // instruments: symbol, desk, price, bid, ask, volume, notional
// onGrid hands over the live grid the moment it is created. A Q-Q plot reads
// one measure, y, and follows the grid's filters and sort from then on.
onGrid: (grid) => {
createChart({ grid, container: chartEl, type: 'qq', y: 'price' });
},
};
</script>
<svelte:head>
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.107.0/lattice-grid.min.css">
</svelte:head>
<div bind:this={chartEl} style="height: 340px"></div>
<div use:lattice={config} style="height: 340px; margin-top: 14px"></div>