demo D200
The correlation matrix: JavaScript Data Grid Demo
Every numeric column against every other, Pearson or Spearman
type: 'correlogram'
This draws a correlation matrix of every numeric column against every other, by Pearson or Spearman. It surfaces which measures move together across a whole dataset in one picture, so a relationship worth chasing stands out.
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.103.2/lattice-grid.min.css">
<script src="https://cdn.latticegrid.dev/lattice-grid@1.103.2/lattice-grid.min.js"></script>
<div id="grid" style="height: 340px"></div>
<div id="chart" style="height: 340px"></div>
<script type="module">
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
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
});
// A chart reads the grid's filtered rows and redraws when the grid changes.
// A correlogram takes the columns to correlate, the method (pearson, spearman
// or kendall) and whether to print the coefficient in each cell.
createChart({
grid,
container: document.getElementById('chart'),
type: 'correlogram',
columns: ['price', 'bid', 'ask', 'volume', 'notional'],
method: 'pearson',
values: true,
title: 'Correlation matrix',
});
</script>