See it in action - abudaan/vega-multi-view GitHub Wiki
I made a related project called vega-multi-view-server which is a simple REST API server that has a single endpoint that returns a global configuration object based on the spec ids you send to the server.
The server returns an HTML page with the rendered Vega views or a JSON string that you can process further to your liking. Here some examples:
- http://app4.bigdator.nl/6a/6b/4b/8a/8b → returns a rendered Twig template
- http://app4.bigdator.nl/rest/4a/4b → returns configuration object as JSON string
- http://app4.bigdator.nl/rest/simple.html → loads configuration via API call and renders the views
Below the HTML that uses the UMD approach and loads the global configuration file via a REST API call.
<!doctype html>
<html>
<head>
<title>vega</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/abudaan/vega-multi-view/v1.1.5/build/vmv.css" />
<script src="https://cdn.rawgit.com/abudaan/vega-multi-view/v1.1.5/build/vmv.min.js"></script>
</head>
<body>
<div id="container"></div>
<script>
// vega-multi-view is available via the global variable vmv
var addViews = window.vmv.addViews;
// feed the endpoint '/json' the parameters '6a' and '6b'
var restApiUrl = '/json/6a/6b';
// parse the global configuration and render the views
addViews(restApiUrl)
.then(function (result) {
console.log(result);
}).catch(function (error) {
console.error(error);
});
</script>
</body>
</html>