demo D189
Quantile colour scales
A scale that ignores the outlier flattening it
scale: { from: 'quantile' }
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.min.css">
<div id="grid"></div>
<script type="module">
import React from 'https://esm.sh/react@18';
import { createRoot } from 'https://esm.sh/react-dom@18/client';
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.esm.min.js';
import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/modules/react.esm.min.js';
const LatticeGrid = createLatticeGrid({ React, createGrid });
// The same skewed column, two scales. A min-max scale is flattened by one
// large value; a quantile scale spans the 5th to 95th percentile instead.
const formatting = {
'v-minmax': [{ scale: { from: 'minmax', colours: ['#f5f7fa', '#1a6bc7'] } }],
'v-quantile': [{ scale: { from: 'quantile', low: 5, high: 95, colours: ['#f5f7fa', '#1a6bc7'] } }],
};
const columns = [
{ field: 'node', title: 'Node', layout: { pin: 'start', width: 150 } },
{ field: 'value', id: 'v-minmax', title: 'min-max scale', type: 'number' },
{ field: 'value', id: 'v-quantile', title: 'quantile scale', type: 'number' },
{ field: 'value', title: 'value', type: 'number' },
];
const rows = [/* a skewed set of node readings */];
function App() {
return (
<LatticeGrid
rowKey="id"
formatting={formatting}
columns={columns}
rows={rows}
style={{ height: '460px' }}
/>
);
}
createRoot(document.getElementById('grid')).render(<App />);
</script>