Skip to content

Instantly share code, notes, and snippets.

@sanandak
Created May 12, 2016 16:39
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 sanandak/3bbce7380a4e75eaf699636029044bed to your computer and use it in GitHub Desktop.
Save sanandak/3bbce7380a4e75eaf699636029044bed to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>G3 Test</title>
<style media="screen">
.axis path,
.axis line {
stroke-width: 1;
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.js" charset="utf-8"></script>
<script src="g3/dist/g3.js" charset="utf-8"></script>
</head>
<body>
<div class="wig_plot_div">
</div>
<script type="text/javascript">
var myPlot = g3.plot('.wig_plot_div')
.height(400).width(600)
.xDomain([-10, 10])
.yDomain([0, 100])
.draw();
var myarr = new Array(10);
for(var t=0; t<10; t++) {
myarr[t] = new Array(100);
for (var i=0; i<100; i++) {
myarr[t][i] = Math.sin(2*Math.PI * 5 * i / 100 + Math.PI * t / 8);
}
}
console.log(myarr);
var wig = g3.wiggle(myPlot, myarr)
.sampleRate(1000)
.xTrans(0)
.xMult(1)
.draw()
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment