example 3 - abudaan/vega-multi-view GitHub Wiki
import { addViews } from 'vega-multi-view';
addViews({
specs: {
spec1: '../specs/spec1.yaml'
}
})
.then(result => {
const view = result.spec1.view;
view.addEventListener('mousedown', () => {
addViews({
specs: {
spec2: '../specs/spec2.yaml'
}
});
});
});
This example shows that you can call addViews
repeatedly. Every spec must have a unique id so if you add another spec with id spec1
in the example above, an error will be thrown. However you can overwrite existing specs if you set overwrite
to true
in the global settings.