Public
Edited
Sep 23, 2023
Fork of Vit-S
1 fork
Insert cell
Insert cell
<div id="root" style="width: 100%; height: 400px" />
Insert cell
{

const pluginCoordinationTypes = [
new Plugins.PluginCoordinationType('myCustomCoordinationType', 0.75, z.number()),
];
const pluginViewTypes = [
new Plugins.PluginViewType('myCustomSlider', MyPluginSliderSubscriber, ['myCustomCoordinationType']),
new Plugins.PluginViewType('description', Description.DescriptionSubscriber, ['dataset']),
];
function Demo(props) {
return e(
VitS.VitS,
{
config,
height: 400,
theme: 'light',
viewTypes: pluginViewTypes,
coordinationTypes: pluginCoordinationTypes,
},
null
);
}
const container = document.getElementById('root');
const root = createRoot(container);
root.render(e(Demo));
}
Insert cell
MyPluginSlider = ({
myCustomCoordinationType,
setMyCustomCoordinationType,
}) => {
function handleChange(e) {
setMyCustomCoordinationType(e.target.value);
}
return e('p', {},
e('input', {
type: "range",
min: 0,
max: 1,
step: 0.01,
value: myCustomCoordinationType,
onChange: handleChange,
})
);
}
Insert cell
MyPluginSliderSubscriber = ({
coordinationScopes,
removeGridComponent,
theme,
title = 'My plugin slider',
}) => {
const [{
myCustomCoordinationType,
}, {
setMyCustomCoordinationType,
}] = VitS.useCoordination(
[
'myCustomCoordinationType',
],
coordinationScopes,
);
return e(VitS.TitleInfo, { title, theme, removeGridComponent, isReady: true},
e(MyPluginSlider, { myCustomCoordinationType, setMyCustomCoordinationType })
);
}
Insert cell
Insert cell
VitS = await importWithMap('@vitessce/vit-s', importMap)
Insert cell
Plugins = await importWithMap('@vitessce/plugins', importMap)
Insert cell
z = (await importWithMap('@vitessce/schemas', importMap)).z
Insert cell
Description = await importWithMap('@vitessce/description', importMap)
Insert cell
createRoot = (await importWithMap('react-dom/client', importMap)).createRoot
Insert cell
React = await importWithMap("react", importMap)
Insert cell
e = React.createElement;
Insert cell
vitessceVersion = "3.2.2"
Insert cell
importMap = ({
imports: {
"react": "https://esm.sh/react@18.2.0?dev",
"react-dom": "https://esm.sh/react-dom@18.2.0?dev",
"react-dom/client": "https://esm.sh/react-dom@18.2.0/client?dev",
"@vitessce/vit-s": `https://unpkg.com/@vitessce/vit-s@${vitessceVersion}`,
"@vitessce/plugins": `https://unpkg.com/@vitessce/plugins@${vitessceVersion}`,
"@vitessce/schemas": `https://unpkg.com/@vitessce/schemas@${vitessceVersion}`,
"@vitessce/description": `https://unpkg.com/@vitessce/description@${vitessceVersion}`
},
});
Insert cell
importWithMap = (await import('https://unpkg.com/dynamic-importmap@0.1.0')).importWithMap
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