Published
Edited
Feb 20, 2020
Insert cell
md`# LineUp.js simple example`
Insert cell
cats = ['c1', 'c2', 'c3']
Insert cell
arr = {
const arr = []
for (let i = 0; i < 1000; ++i) {
arr.push({
a: Math.random() * 10,
d: 'Row ' + i,
cat: cats[Math.floor(Math.random() * 3)],
cat2: cats[Math.floor(Math.random() * 3)]
})
}
return arr;
}
Insert cell
mutable selection = []
Insert cell
{
lineup.on('selectionChanged', (indices) => {
mutable selection = indices;
});
lineup.setSelection(selection);
}
Insert cell
reset = {
const b = html`<button>Reset Selection</button>`;
b.onclick = () => mutable selection = [];
return b;
}
Insert cell
lineup = {
root.innerHTML = '';
const b = LineUpJS.builder(arr);
b.deriveColumns();
b.deriveColors();
b.rowHeight(24);
return b.buildTaggle(root)
}
Insert cell
root = html`<div style="position: relative; width: 100%; height: 500px; line-height: normal !important"></div>`
Insert cell
LineUpJS=require('lineupjs@next')
Insert cell
stylesheet = html`<link rel='stylesheet' href='https://unpkg.com/lineupjs@next/build/LineUpJS.css' />`
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more