-
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.
Pass in a custom function to override the behaviour in orientateCircles as discussed here: #56
- Loading branch information
Showing
5 changed files
with
96 additions
and
17 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,51 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Custom Orientation Order</title> | ||
<style> | ||
body { | ||
font-size : 16px; | ||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<h4> default ordering </h4> | ||
<div id="default"></div> | ||
<h4> ordering setids lexically </h4> | ||
<div id="lexical"></div> | ||
<h4> custom ordering </h4> | ||
<div id="custom"></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:["A"], size: 10}, | ||
{sets:["B"], size: 11}, | ||
{sets:["C"], size: 10}, | ||
{sets: ["A", "B"], size: 4}, | ||
{sets: ["A", "C"], size: 4}, | ||
{sets: ["B", "C"], size: 4}, | ||
{sets: ["A", "B", "C"], size:2} | ||
]; | ||
|
||
var chart = venn.VennDiagram() | ||
.width(640) | ||
.height(640); | ||
|
||
|
||
d3.select("#default").datum(sets).call(chart); | ||
|
||
chart.orientationOrder(function (a, b) { return a.setid.localeCompare(b.setid); }) | ||
d3.select("#lexical").datum(sets).call(chart); | ||
|
||
var customOrdering = {"A" : 1, "C": 2, "B" : 3} | ||
chart.orientationOrder(function (a, b) { return customOrdering[a.setid] - customOrdering[b.setid]}) | ||
d3.select("#custom").datum(sets).call(chart); | ||
</script> | ||
</html> |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "venn.js", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"author": "Ben Frederickson <[email protected]> (http:/www.benfrederickson.com)", | ||
"url": "https://github.com/benfred/venn.js/issues", | ||
"devDependencies": { | ||
|
@@ -35,7 +35,7 @@ | |
}, | ||
"scripts": { | ||
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -u venn -n venn -o build/venn.js -- build/bundle.js", | ||
"test": "jshint src/* && faucet `find tests -name '*test.js'`", | ||
"test": "jshint src/*.js && faucet `find tests -name '*test.js'`", | ||
"prepublish": "npm run test && uglifyjs build/venn.js -c -m -o build/venn.min.js && rm -f build/venn.zip && zip -j build/venn.zip -- LICENSE README.md build/venn.js build/venn.min.js" | ||
} | ||
} |
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