Last active
July 31, 2017 15:17
-
-
Save jacobwindsor/b45fdf2485a2e0c772fe2884c32ee9cc to your computer and use it in GitHub Desktop.
Pvjs Custom Element Advanced Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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