From 7deacc9ed16418c40f2d06260f1a8eb505923e05 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sat, 14 Sep 2013 17:44:18 -0700 Subject: [PATCH] Clip the pie center only when using offset auto. If an explicit numeric offset was provided, we should not override it. The clipping is only meant to apply to the case where the center is moved to make room for the legend in 'auto' mode, anyway. --- jquery.flot.pie.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/jquery.flot.pie.js b/jquery.flot.pie.js index 6553c8e..a4b538a 100644 --- a/jquery.flot.pie.js +++ b/jquery.flot.pie.js @@ -293,16 +293,15 @@ More detail and specific examples can be found in the included HTML file. } else { centerLeft -= legendWidth / 2; } + if (centerLeft < maxRadius) { + centerLeft = maxRadius; + } else if (centerLeft > canvasWidth - maxRadius) { + centerLeft = canvasWidth - maxRadius; + } } else { centerLeft += options.series.pie.offset.left; } - if (centerLeft < maxRadius) { - centerLeft = maxRadius; - } else if (centerLeft > canvasWidth - maxRadius) { - centerLeft = canvasWidth - maxRadius; - } - var slices = plot.getData(), attempts = 0;