Skip to content

Commit

Permalink
Add example with reorderTracks: true
Browse files Browse the repository at this point in the history
  • Loading branch information
haxiomic committed Jun 30, 2020
1 parent 022b8eb commit 813cae8
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions examples/reorder-buttons/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<style>
body {
margin: 0;
}
</style>

<div id="container"></div>

<script src="../../dist/valis-hpgv.js"></script>

<script>
let config = {
allowNewPanels: false,
clampToTracks: true,
removableTracks: true,
reorderTracks: true,
panels: [
{
location: { contig: 'chr1', x0: 0, x1: 249e6 }
}
],
tracks: [
{
name: 'Cerebellum, DNase',
type: 'signal',
path: "https://www.encodeproject.org/files/ENCFF833POA/@@download/ENCFF833POA.bigWig",
heightPx: 150,
},
{
name: 'Unknown Signal',
type: 'signal',
path: "https://www.encodeproject.org/files/ENCFF677VKI/@@download/ENCFF677VKI.bigWig",
heightPx: 150,
},
{
name: 'Third Signal',
type: 'signal',
path: "https://www.encodeproject.org/files/ENCFF677VKI/@@download/ENCFF677VKI.bigWig",
heightPx: 150,
},
],
};

// get state from URL
if (window.location.hash) {
config = JSON.parse(decodeURIComponent(window.location.hash.substr(1)));
}

let visualizer = new GenomeVisualizer(config);

let container = document.getElementById('container');

window.addEventListener('resize', update);

function update() {
visualizer.render({
width: window.innerWidth,
height: window.innerHeight
}, container);
}

function saveStateInURL() {
window.history.replaceState(null, null, '#' + JSON.stringify(visualizer.getConfiguration()));
}

update();
</script>

0 comments on commit 813cae8

Please sign in to comment.