[docs,app,demos/multiview][m]: convert app back to being a demo of multiview (app proper is now in dataexplorer repo).

This commit is contained in:
Rufus Pollock
2012-06-27 10:10:45 +01:00
parent 3d944814ae
commit c2f5debf1f
13 changed files with 133 additions and 733 deletions

33
demos/index.html Normal file
View File

@@ -0,0 +1,33 @@
---
layout: container
title: Demos
root: ../
---
<div class="page-header">
<h1>
Demos
</h1>
</div>
<div class="row">
<div class="span4">
<div class="well">
<h3>Multiview Demo</h3>
<p>See the integrated multiview "Data Explorer" in action on a sample dataset <a href="multiview/">Demo &raquo;</a></p>
</div>
</div>
<div class="span4">
<div class="well">
<h3>TweetLine</h3>
<p>Coming Soon</p>
</div>
</div>
<div class="span4">
<div class="well">
<h3>Crime Maps</h3>
<p>Coming soon</p>
</div>
</div>
</div>

84
demos/multiview/app.js Executable file
View File

@@ -0,0 +1,84 @@
jQuery(function($) {
window.dataExplorer = null;
window.explorerDiv = $('.data-explorer-here');
// see if we have any configuration from query string
var state = recline.View.parseQueryString(decodeURIComponent(window.location.search));
if (state) {
_.each(state, function(value, key) {
try {
value = JSON.parse(value);
} catch(e) {}
state[key] = value;
});
} else {
state.url = 'demo';
}
var dataset = null;
if (state.dataset || state.url) {
dataset = recline.Model.Dataset.restore(state);
} else {
dataset = localDataset();
}
createExplorer(dataset, state);
});
// make Explorer creation / initialization in a function so we can call it
// again and again
var createExplorer = function(dataset, state) {
// remove existing data explorer view
var reload = false;
if (window.dataExplorer) {
window.dataExplorer.remove();
reload = true;
}
window.dataExplorer = null;
var $el = $('<div />');
$el.appendTo(window.explorerDiv);
var views = [
{
id: 'grid',
label: 'Grid',
view: new recline.View.SlickGrid({
model: dataset
})
},
{
id: 'graph',
label: 'Graph',
view: new recline.View.Graph({
model: dataset
})
},
{
id: 'map',
label: 'Map',
view: new recline.View.Map({
model: dataset
})
},
{
id: 'timeline',
label: 'Timeline',
view: new recline.View.Timeline({
model: dataset
})
}
];
window.dataExplorer = new recline.View.MultiView({
model: dataset,
el: $el,
state: state,
views: views
});
}
// provide a demonstration in memory dataset
function localDataset() {
var dataset = Fixture.getDataset();
return dataset;
}

View File

@@ -0,0 +1,24 @@
---
layout: container
title: Demos - Multiview
recline-deps: true
root: ../../
---
<style type="text/css">
.recline-slickgrid {
height: 450px;
}
.recline-timeline .vmm-timeline {
height: 450px;
}
</style>
<div class="data-explorer-here"></div>
<div style="clear: both;"></div>
<script type="text/javascript" src="{{page.root}}/test/base.js"></script>
<script type="text/javascript" src="app.js"></script>