Files
nebula.js/examples/dev-mashup/index.js
Tobias Åström 2ce33628e5 chore: add dev mashup example (#536)
* chore: add dev mashup example

* chore: update example readme

* fix: update schema version

* chore: change stardust to dep
2020-11-16 13:12:45 +01:00

37 lines
789 B
JavaScript
Executable File

import { embed } from '@nebula.js/stardust';
import bar from '@nebula.js/sn-bar-chart';
import line from '@nebula.js/sn-line-chart';
import connect from './connect';
function init() {
connect().then((app) => {
const nebbie = embed(app, {
types: [
{
name: 'bar',
load: () => Promise.resolve(bar),
},
{
name: 'line',
load: () => Promise.resolve(line),
},
],
});
nebbie.selections().then((s) => s.mount(document.querySelector('.toolbar')));
document.querySelectorAll('.object').forEach((el) => {
const type = el.getAttribute('data-type');
nebbie.render({
type,
element: el,
fields: ['Alpha', '=Sum(Expression1)'],
});
});
});
}
init();