demo D186
Shadow columns: rate and streak in Web Component
Speed of change, direction runs, and a sparkline of recent history
shadow: { of, kind: 'rate' }
This grid adds shadow columns for speed of change, runs in one direction, and a sparkline of recent history. It shows not just where a value is but how fast and which way it is moving, per row.
This is the web component version. A lattice-grid custom element renders the grid with no build step, its configuration set as a property, so it works on a page that has no bundler at all.
The configuration
<link rel="stylesheet" href="https://cdn.latticegrid.dev/lattice-grid@1.108.0/lattice-grid.min.css">
<script type="module">
import { defineLatticeGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.108.0/modules/webcomponent.esm.min.js';
defineLatticeGrid();
</script>
<lattice-grid row-key="id" style="display: block; height: 460px"></lattice-grid>
<script type="module">
const grid = document.querySelector('lattice-grid');
grid.config = {
highlightOnChange: { duration: 500 },
columns: [
{ field: 'symbol', title: 'Symbol', layout: { pin: 'start', width: 120 } },
{ field: 'price', title: 'Price', type: 'number' },
{ id: 'rate', title: 'Per second', shadow: { of: 'price', kind: 'rate' }, type: 'number', format: { signed: true } },
{ id: 'since', title: 'Since move', shadow: { of: 'price', kind: 'sinceUpdate' }, type: 'duration' },
{ id: 'hist', title: 'Recent', shadow: { of: 'price', kind: 'history' }, cell: { render: 'line' } },
],
};
grid.rows = rows; // trading book records
</script>