Created
August 16, 2014 13:55
-
-
Save domitry/5a89296dfb23f0ea2ffd to your computer and use it in GitHub Desktop.
Example for Nyaplotjs
This file contains hidden or 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
<html lang='en'> | |
<head> | |
<title>Nyaplotjs example -- Boxplot</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=[]; | |
for(var i=0;i<100;i++){ | |
data1.push({ | |
norm1:d3.random.normal(0, 1)(), | |
norm2:d3.random.normal(3, 2)(), | |
norm3:d3.random.normal(1, 0.5)() | |
}); | |
} | |
var y_min = d3.min(data1, function(d){return (d.norm2 < d.norm1 ? d.norm2 : d.norm1)})-1; | |
var y_max = d3.max(data1, function(d){return (d.norm2 > d.norm1 ? d.norm2 : d.norm1)})+1; | |
models = {data:{data1: data1},panes: [{type:'rectangular', diagrams:[{type: 'box', data: 'data1', options: {value:["norm1","norm2","norm3"]}}],options:{width:500, height:500, xrange: ["norm1","norm2","norm3"], yrange: [y_min, y_max]}}]}; | |
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