From e4aaacc6b3c9f98db43c0e629ea7c6e374204854 Mon Sep 17 00:00:00 2001 From: "olau@iola.dk" Date: Wed, 24 Nov 2010 11:10:39 +0000 Subject: [PATCH] Don't redraw if the placeholder loses its dimensions git-svn-id: https://flot.googlecode.com/svn/trunk@270 1e0a6537-2640-0410-bfb7-f154510ff394 --- jquery.flot.resize.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jquery.flot.resize.js b/jquery.flot.resize.js index a70fc43..c50a8d2 100644 --- a/jquery.flot.resize.js +++ b/jquery.flot.resize.js @@ -32,8 +32,15 @@ plots, you can just fix the size of their placeholders. plot.getPlaceholder().resize(onResize); function onResize() { + var placeholder = plot.getPlaceholder(); + + // somebody might have hidden us and we can't plot + // when we don't have the dimensions + if (placeholder.width() == 0 || placeholder.height() == 0) + return; + ++redrawing; - $.plot(plot.getPlaceholder(), plot.getData(), plot.getOptions()); + $.plot(placeholder, plot.getData(), plot.getOptions()); --redrawing; } }