Skip to content

Instantly share code, notes, and snippets.

@jacobwindsor
Last active July 31, 2017 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobwindsor/b45fdf2485a2e0c772fe2884c32ee9cc to your computer and use it in GitHub Desktop.
Save jacobwindsor/b45fdf2485a2e0c772fe2884c32ee9cc to your computer and use it in GitHub Desktop.
Pvjs Custom Element Advanced Example
<!DOCTYPE html>
<html lang="en">
<head>
<!--This is needed for everyting to behave-->
<meta charset="utf-8">
<title>Advanced Pvjs</title>
<script src="https://unpkg.com/@wikipathways/pvjs/dist/index.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@wikipathways/pvjs/dist/style.css" />
</head>
<body>
<div style="width:100vw;height:100vh;">
<wikipathways-pvjs id="my-diagram" wp-id="WP4" pan-zoom-locked detail-panel-enabled></wikipathways-pvjs>
</div>
<script>
var diag = document.getElementById("my-diagram");
diag.addEventListener('ready', function(e) {
var node = e.detail.entities.find(singleEntity => singleEntity.textContent === "TCA Cycle");
diag.highlightOn(node.id, 'red');
diag.zoomOn(node.id);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment