this is an experimental implementation of Venn diagram.
Last active
August 29, 2015 14:02
-
-
Save domitry/d70dff56885218c7ad9a to your computer and use it in GitHub Desktop.
A demo for Ecoli.js (Venn diagram)
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 -- 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