Skip to content

Instantly share code, notes, and snippets.

@domitry
Last active August 29, 2015 14:00
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 domitry/11394091 to your computer and use it in GitHub Desktop.
Save domitry/11394091 to your computer and use it in GitHub Desktop.
The single plotting example with Elegans

About this sample

This is a sample to show how to generate a single plot with Elegans.

About Elegans

Click here to learn more about Elegans.

<html lang="en">
<head>
<title>Plot Sample - Line</title>
<link rel='stylesheet' href="https://rawgit.com/domitry/elegans/master/examples/common.css">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r66/three.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.4/d3.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/domitry/elegans/master/release/elegans.min.js"></script>
<script type="text/javascript">
window.onload = function(){
var BEGIN = -10, END = 10, INTERVAL = 0.5;
var data = {x:[],y:[],z:[]};
for(var x=BEGIN;x<=END;x+=INTERVAL){
var y = -1*x;
var z = x*x+y*y;
data.x.push(x);
data.y.push(y);
data.z.push(z);
}
d3.select("#vis").datum(data).call(Elegans.LinePlot.data_name("z = x^2 + y^2 (y = -x, x=-10..10)").thickness(5).colors(["#dd1c77","#dd1c77"]));
};
</script>
</head>
<body>
<div id="vis">
</div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment