-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* eslint config file, files in src/*.js should all pass * fix minor alignment issue with disjoint clusters * remove classicMDSLayout * add example showing a bounding box over the circles
- Loading branch information
Showing
9 changed files
with
113 additions
and
105 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"rules": { | ||
"semi": 2, "no-undef": 2 | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Venn diagram of Venn diagrams</title> | ||
<style> | ||
body { | ||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="venn"></div> | ||
</body> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> | ||
<script src="../venn.js"></script> | ||
<script> | ||
var sets = [ | ||
{sets:["Information"], size: 12}, | ||
{sets:["Overlap"], size: 12}, | ||
{sets:["Circles"], size: 12}, | ||
{sets: ["Information", "Overlap"], size: 4, label: "Redundancy"}, | ||
{sets: ["Information", "Circles"], size: 4, label: "Pie Charts", }, | ||
{sets: ["Overlap", "Circles"], size: 4, label: "Eclipses"}, | ||
{sets: ["Information", "Overlap", "Circles"], size: 2, label: "Venn Diagrams"} | ||
]; | ||
|
||
var chart = venn.VennDiagram() | ||
.wrap(false) | ||
.fontSize("16px") | ||
.width(640) | ||
.height(640); | ||
|
||
function updateVenn(sets) { | ||
var div = d3.select("#venn").datum(sets); | ||
var layout = chart(div), | ||
circles = layout.circles; | ||
|
||
div.selectAll(".label").style("fill", "white"); | ||
div.selectAll(".venn-circle path").style("fill-opacity", .6); | ||
|
||
// add new bounding boxes | ||
layout.enter | ||
.filter(function(d) { return d.sets.length == 1; }) | ||
.append("rect") | ||
.attr("class", "box") | ||
.style("stroke", "#666") | ||
.style("stroke-width", "2") | ||
.style("fill-opacity", "0.2") | ||
.attr("height", 0) | ||
.attr("width", 0) | ||
.attr("x", chart.width() /2) | ||
.attr("y", chart.height() /2); | ||
|
||
// move existing | ||
layout.update | ||
.select(".box") | ||
.attr("x", function(d) { var c = circles[d.sets[0]]; return c.x - c.radius; }) | ||
.attr("y", function(d) { var c = circles[d.sets[0]]; return c.y - c.radius; }) | ||
.attr("height", function(d) { var c = circles[d.sets[0]]; return 2 * c.radius; }) | ||
.attr("width", function(d) { var c = circles[d.sets[0]]; return 2 * c.radius; }) | ||
.each("end", function() { console.log("done move"); }) | ||
|
||
// remove old (shrinking to middle) | ||
layout.exit | ||
.select(".box") | ||
.attr("x", chart.width() /2) | ||
.attr("y", chart.height() /2) | ||
.attr("width", 0) | ||
.attr("height", 0) | ||
.style("font-size", "0px"); | ||
|
||
return layout; | ||
} | ||
|
||
// add/remove set areas to showcase transitions | ||
updateVenn(sets.slice(0, 2)); | ||
var i = 1, direction = 1; | ||
window.setInterval( function() { | ||
i += direction; | ||
if (i >= sets.length) { | ||
direction = -1; | ||
} else if (i <= 1) { | ||
direction = 1; | ||
} | ||
updateVenn(sets.slice(0, i)); | ||
}, 1500); | ||
|
||
</script> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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