demo D167
Gauge, funnel and radar in Web Component
The specialist types and what each is for
type: 'gauge' · 'funnel' · 'radar'
This shows three specialist charts and what each is for: a gauge for one figure against a target, a funnel for stages that narrow, and a radar for several measures at once. It helps you match an unusual shape of data to the chart built for it.
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.107.0/lattice-grid.min.css">
<script type="module">
import { defineLatticeGrid } from 'https://cdn.latticegrid.dev/lattice-grid@1.107.0/modules/webcomponent.esm.min.js';
defineLatticeGrid();
</script>
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; height: 210px">
<div id="gauge"></div>
<div id="funnel"></div>
<div id="radar"></div>
</div>
<lattice-grid row-key="id" style="display: block; height: 340px; margin-top: 14px"></lattice-grid>
<script type="module">
import { createChart } from 'https://cdn.latticegrid.dev/lattice-grid@1.107.0/modules/charts.esm.min.js';
const el = document.querySelector('lattice-grid');
el.config = {
columns: [
{ field: 'circuit', title: 'Circuit', layout: { width: 180 } },
{ field: 'region', title: 'Region', filter: { type: 'set' } },
{ field: 'status', title: 'Status', filter: { type: 'set' } },
{ field: 'bandwidth', title: 'Bandwidth', type: 'number' },
{ field: 'charge', title: 'Monthly charge', type: 'number',
format: { style: 'currency', currency: 'GBP' }, total: 'sum' },
],
};
el.rows = rows; // an array of circuit records
// Each type reads the shape it is built for: a gauge one value, a funnel a
// category and a measure, a radar a category around a ring. Every chart reads
// el.grid, the live grid inside the element, so they follow the table.
createChart({ grid: el.grid, container: '#gauge', type: 'gauge', y: 'charge' });
createChart({ grid: el.grid, container: '#funnel', type: 'funnel', x: 'status', y: 'charge' });
createChart({ grid: el.grid, container: '#radar', type: 'radar', x: 'region', y: 'charge' });
</script>