demo D211
Analytical chemistry: JavaScript Data Grid Demo
Molarity, ppb and dose types, with a contaminated batch the rules find
type: molarity · ppb · doseRate
This is an analytical chemistry sheet with molarity, parts-per-billion and dose-rate types, and a contaminated batch that the rules find. It shows domain units and inline rules catching a real problem in scientific data.
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: 480px"></div>
<script>
const grid = LatticeGrid.createGrid(document.getElementById('grid'), {
rowKey: 'id',
columnDefaults: { filter: true },
toolPanel: { side: 'left', panels: ['columns', 'filters', 'statistics'] },
columns: [
{ field: 'sample', title: 'Sample', layout: { pin: 'start', width: 120 } },
{ field: 'batch', title: 'Batch', filter: { type: 'set' } },
// Each reading is its own unit type: molarity, parts per billion,
// temperature, radioactivity and dose rate, all sortable and totalled.
{ field: 'concentration', title: 'Concentration', type: 'molarity', total: 'median' },
{ field: 'contaminant', title: 'Contaminant', type: 'ppb', total: 'p95' },
{ field: 'temperature', title: 'Temp', type: 'celsius', total: 'avg' },
{ field: 'activity', title: 'Activity', type: 'radioactivity' },
{ field: 'doseRate', title: 'Dose rate', type: 'doseRate', total: 'max' },
],
formatting: {
// The z-score and outlier rules read the whole column, so a contaminated
// batch is flagged whatever the sort order.
contaminant: [
{ id: 'c-z', when: { op: 'zAbove', value: 3 }, style: { background: '#fbeceb', color: '#a4262c' } },
{ id: 'c-out', when: { op: 'outlier' }, style: { background: '#fff4e5' } },
],
},
rows, // lab samples: sample, batch, concentration, contaminant, temperature, activity, doseRate
});
</script>