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/d70dff56885218c7ad9a to your computer and use it in GitHub Desktop.
Save domitry/d70dff56885218c7ad9a to your computer and use it in GitHub Desktop.
A demo for Ecoli.js (Venn diagram)

this is an experimental implementation of Venn diagram.

<html lang='en'>
<head>
<title>Nyaplotjs example -- Venn plot</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;
var favorites = ['apple', 'orange', 'banana'];
var names = [], log={};
for(var i=0;i<50;i++){
var name = 'p' + String(i);
var n = Math.floor(Math.random()*3);
favorites.sort(function(){return Math.random()-0.5});
log[name]=[];
for(var j=0;j<=n;j++)data1.push({name: name, favorite:favorites[j]});
for(var j=0;j<=n;j++)log[name].push(favorites[j]);
}
console.log(log);
models = {data:{data1: data1},panes: [{type:'rectangular', diagrams:[{type: 'venn', data: 'data1', options: {category:'favorite', count:'name'}}],options:{width:600, height:500, xrange: [-100, 100], yrange: [-100, 100], 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