Skip to content

Instantly share code, notes, and snippets.

@domitry
Last active August 29, 2015 14:02
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/e9a914b78f3a576ed3bb to your computer and use it in GitHub Desktop.
Save domitry/e9a914b78f3a576ed3bb to your computer and use it in GitHub Desktop.
A demo for Ecoli.js (Line)
<html lang='en'>
<head>
<title>Nyaplotjs example -- Line chart</title>
<script src='http://d3js.org/d3.v3.min.js'></script>
<script src='https://rawgit.com/domitry/Nyaplotjs/master/release/nyaplot.js'></script>
</head>
<body>
<div id='vis'></div>
<script>
var data1 = [], MAX=10, MIN=0;
for(var x=MIN;x<MAX;x+=0.1)data1.push({x: x, y1: Math.sin(x), y2: Math.cos(x)});
models = {data:{data1: data1},panes: [{type:'rectangular', diagrams:[{type: 'line', data: 'data1', options: {x:'x', y:'y1', stroke_width:2, title:'sin(x)'}},{type: 'line', data: 'data1', options: {x:'x', y:'y2', stroke_width:2, color:'#000000', title:'cos(x)'}}],options:{width:700, height:500, xrange: [MIN, MAX], yrange: [-2, 2], legend:true}}]};
window.onload = function(){Nyaplot.core.parse(models, '#vis');};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment