From a481707ca701390ff8c0dd74e09507a7dbd0d7c9 Mon Sep 17 00:00:00 2001 From: Brandon Bernal Date: Fri, 30 May 2014 15:47:23 -0400 Subject: [PATCH] transformForArcLabel NaN error. Sometimes the data provided can't be used for transformForArcLabel (a stacked area chart where registered items came back as neither connected or disconnected. http://jsfiddle.net/U5g3h/). I find that the startAngle and endAngle values arrive as NaN. To fix this I am checking before assigning x and y. --- c3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c3.js b/c3.js index c0077a2..f70a0bf 100644 --- a/c3.js +++ b/c3.js @@ -1031,8 +1031,8 @@ var updated = updateAngle(d), c, x, y, h, ratio, translate = ""; if (updated && !hasGaugeType(c3.data.targets)) { c = svgArc.centroid(updated); - x = c[0]; - y = c[1]; + x = isNaN(c[0]) ? 0 : c[0]; + y = isNaN(c[1]) ? 0 : c[1]; h = Math.sqrt(x * x + y * y); // TODO: ratio should be an option? ratio = radius && h ? (36 / radius > 0.375 ? 1.175 - 36 / radius : 0.8) * radius / h : 0;