Skip to content

Commit 2df538e

Browse files
committed
fix for d3 v3.0
1 parent 7bede40 commit 2df538e

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "venn.js",
3-
"version": "0.2.11",
3+
"version": "0.2.12",
44
"author": "Ben Frederickson <ben@benfrederickson.com> (http:/www.benfrederickson.com)",
55
"url": "https://github.com/benfred/venn.js/issues",
66
"devDependencies": {

src/diagram.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ export function VennDiagram() {
147147

148148
if (wrap) {
149149
if (hasPrevious) {
150-
updateText.on("end", wrapText(circles, label));
150+
// d3 4.0 uses 'on' for events on transitions,
151+
// but d3 3.0 used 'each' instead. switch appropiately
152+
if ('on' in updateText) {
153+
updateText.on("end", wrapText(circles, label));
154+
} else {
155+
updateText.each("end", wrapText(circles, label));
156+
}
151157
} else {
152158
updateText.each(wrapText(circles, label));
153159
}

venn.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,13 @@
13401340

13411341
if (wrap) {
13421342
if (hasPrevious) {
1343-
updateText.on("end", wrapText(circles, label));
1343+
// d3 4.0 uses 'on' for events on transitions,
1344+
// but d3 3.0 used 'each' instead. switch appropiately
1345+
if ('on' in updateText) {
1346+
updateText.on("end", wrapText(circles, label));
1347+
} else {
1348+
updateText.each("end", wrapText(circles, label));
1349+
}
13441350
} else {
13451351
updateText.each(wrapText(circles, label));
13461352
}

0 commit comments

Comments
 (0)