demo D173
Brushing a time range
Drag a range on the chart and the grid narrows to it
brush: true
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/lattice-grid.min.css">
<script src="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/lattice-grid.min.js"></script>
<div id="chart" style="height: 300px"></div>
<div id="grid" style="height: 340px; margin-top: 14px"></div>
<script type="module">
import { createChart } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.13.0/modules/charts';
const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
rowKey: 'id',
columns: [
{ field: 'date', title: 'Date', type: 'date', layout: { width: 150 } },
{ field: 'price', title: 'Price', type: 'number' },
],
rows,
});
// brush lets you drag a range on the chart to filter the grid to it.
createChart({ grid, container: '#chart', type: 'line', x: 'date', y: 'price', brush: true });
</script>