Public
Edited
Jan 29, 2023
Insert cell
Insert cell
Insert cell
{
const menuContainer = d3.create('div')
.attr('class', 'menu-container');
const carMenu = menuContainer.append('div');

const options = [
{ value: 'volvo', text: 'Volvo' },
{ value: 'saab', text: 'Saab' },
{ value: 'mercedes', text: 'Mercedes' },
{ value: 'audi', text: 'Audi' }
];
carMenu.call(
menu()
.id('car-menu')
.labelText('Car: ')
.options(options)
.on('change', (value) => {
console.log(`You selected: ${value}`);
})
);
return menuContainer.node();
}
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more