Skip to content

Commit 247a7c4

Browse files
author
Pietro
committed
fix(commonshare): donut text flipping no more
1 parent 646781a commit 247a7c4

File tree

1 file changed

+7
-3
lines changed
  • app/assets/javascripts/commonshare

1 file changed

+7
-3
lines changed

app/assets/javascripts/commonshare/donut.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function links_of_type(d, key) {
4343
console.log("platform_uid is " + platform_uid);
4444
break;
4545
}
46-
}
46+
}
4747
var linktypes = keytypes[key];
4848
var type_links = [];
4949
for (var link in d.links) {
@@ -90,7 +90,8 @@ function arcMaths(d, i) {
9090

9191
if (d.endAngle > 90 * Math.PI / 180 &&
9292
start > (180 - end) &&
93-
(end - start) % 360 != 0) {
93+
Math.round(end - start) % 360 != 0) {
94+
console.log("FLIPPING" + " start is " + start + " and end is " + end);
9495
var startLoc = /M(.*?)A/;
9596
var middleLoc,
9697
endLoc;
@@ -112,6 +113,9 @@ function arcMaths(d, i) {
112113
}
113114
newArc = "M" + newStart + "A" + middleSec + numbers + newEnd;
114115
}
116+
else {
117+
console.log("nope" + " start is " + start + " and end is " + end);
118+
}
115119
chartg.append("path")
116120
.attr("class", "hiddenDonutArcs")
117121
.attr("id", "donutArc" + i)
@@ -448,7 +452,7 @@ function plotdonut(graphdata, mydata) {
448452
var degreeStart = (d.startAngle / (Math.PI / 180));
449453
return (d.endAngle > 90 * Math.PI / 180
450454
&& degreeStart > (180 - degreeEnd)
451-
&& ((degreeEnd - degreeStart) % 360 != 0) ? 18 : -11);
455+
&& (Math.round(degreeEnd - degreeStart) % 360 != 0) ? 18 : -11);
452456
});
453457

454458
d3.selectAll(".textpath").remove();

0 commit comments

Comments
 (0)