Skip to content

Instantly share code, notes, and snippets.

@chmille4
Created January 25, 2011 23:11
Show Gist options
  • Save chmille4/795897 to your computer and use it in GitHub Desktop.
Save chmille4/795897 to your computer and use it in GitHub Desktop.
scribl generated chart with event handling
<!DOCTYPE HTML>
<html lang="en">
<head>
<script src="https://github.com/chmille4/Scribl/raw/master/lib/Scribl.events.js" ></script>
<script src="https://github.com/chmille4/Scribl/raw/master/lib/Scribl.gene.js" ></script>
<script src="https://github.com/chmille4/Scribl/raw/master/lib/Scribl.js" ></script>
<link rel="stylesheet" type="text/css" href="../css/demos.css" />
<script>
function draw(canvasName) {
// Get Canvas and Create Chart
var canvas = document.getElementById(canvasName);
// Create Chart
chart1 = new Scribl(canvas, 500);
// Add Gene position, length, orientation
gene1 = chart1.addGene( 900, 750 , '-');
gene1.name = "Click Me";
gene1.onMouseover = "Start:900 Length:750";
gene1.onClick = "http://www.google.com";
gene2 = chart1.addGene( 3500, 2500, '+');
gene2.name = "Gene 2";
gene2.onMouseover = "Start:3500 Length:2500";
// Draw Chart
chart1.draw();
}
</script>
</head>
<body onload="draw('canvas')">
<div id="description"><h2>Events</h2>
add click and mouseover events to genes
</div>
<div id="container">
<canvas id="canvas" width="547" height="330" ></canvas>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment