Commit 7ee31a60 authored by David Schnur's avatar David Schnur

Added work-around for the Excanvas 100% arc bug.

When a slice equals (or comes close enough that it is equal in
floating-point representation) 100% of the pie, it was no longer drawn
by Excanvas.  This is because of a long-standing issue where VML won't
draw an arc whose begin and end are the same.  Rather than some hack,
like adding/subtracting a small value, we'll simply draw two arcs for
every slice, with each covering half of the slice's angle.
parent 8525ea75
...@@ -436,7 +436,8 @@ More detail and specific examples can be found in the included HTML file. ...@@ -436,7 +436,8 @@ More detail and specific examples can be found in the included HTML file.
} }
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera //ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
ctx.arc(0, 0, radius,currentAngle, currentAngle + angle, false); ctx.arc(0, 0, radius,currentAngle, currentAngle + angle / 2, false);
ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
ctx.closePath(); ctx.closePath();
//ctx.rotate(angle); // This doesn't work properly in Opera //ctx.rotate(angle); // This doesn't work properly in Opera
currentAngle += angle; currentAngle += angle;
...@@ -576,7 +577,8 @@ More detail and specific examples can be found in the included HTML file. ...@@ -576,7 +577,8 @@ More detail and specific examples can be found in the included HTML file.
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(0, 0); // Center of the pie ctx.moveTo(0, 0); // Center of the pie
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here. //ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle, false); ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
ctx.closePath(); ctx.closePath();
x = mouseX - centerLeft; x = mouseX - centerLeft;
y = mouseY - centerTop; y = mouseY - centerTop;
...@@ -741,7 +743,8 @@ More detail and specific examples can be found in the included HTML file. ...@@ -741,7 +743,8 @@ More detail and specific examples can be found in the included HTML file.
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) { if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
octx.moveTo(0, 0); // Center of the pie octx.moveTo(0, 0); // Center of the pie
} }
octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle, false); octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
octx.closePath(); octx.closePath();
octx.fill(); octx.fill();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment