Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery 1.8 compatibility #814

Closed
dnschnur opened this issue Sep 28, 2012 · 11 comments
Closed

jQuery 1.8 compatibility #814

dnschnur opened this issue Sep 28, 2012 · 11 comments
Assignees
Milestone

Comments

@dnschnur
Copy link
Member

Original author: ChinagoI...@gmail.com (August 11, 2012 15:07:10)

jquery.flot.pie works perfectly with jQuery 1.7.2, I had interactive hover enabled. After upgrading to jQuery 1.8, however, it shows a quarter of a pie. All the interactions were gone. I was able to replicate the issue on FF 14.0.1 and the latest Chrome. No error in the console.

Original issue: http://code.google.com/p/flot/issues/detail?id=735

@dnschnur
Copy link
Member Author

From rob...@accettura.com on August 17, 2012 16:58:32
Confirmed. I see the same thing, haven't had a chance to see if I can figure it out.

@dnschnur
Copy link
Member Author

From andrew.theiss@gmail.com on August 17, 2012 17:16:37
I have found the issue and will post a fix shortly.

In function setupPie() on line 187

187 function setupPie()
188 {
189 legendWidth = target.children().filter('.legend').children().width();

legendWidth is not being defined with the new jquery 1.8 library.

@dnschnur
Copy link
Member Author

From andrew.theiss@gmail.com on August 17, 2012 18:29:48
Its only a temporary fix but you can grab the legend width manually as the .width() does not properly go into the object context and return the width.

legendWidth = target.children().filter('.legend').children();
legendWidth = legendWidth.context.width;

This allows for most functionality except centering inside the container (however Im not using that so this work around is all I need)

Hope it helps for the time being even though a real solution is still needed.

@dnschnur
Copy link
Member Author

From ChinagoI...@gmail.com on August 18, 2012 15:30:01
jquery.flot.js line 2265: $('

').prependTo(legend).css('opacity', options.legend.backgroundOpacity);
Should be cleaner to call .width(div.width())

@dnschnur
Copy link
Member Author

From rob...@accettura.com on August 20, 2012 15:45:51
Has a bug been filed against jQuery?

@dnschnur
Copy link
Member Author

From ChinagoI...@gmail.com on August 21, 2012 08:44:12
jquery.flot.pie.js line 189: target.children().filter('.legend') returns an empty set on Chromium 18.

@dnschnur
Copy link
Member Author

From rob...@accettura.com on August 21, 2012 14:20:36
Hmm. target.children = [canvas.base, canvas.overlay].

I don't see a .legend. Looking at target itself, that returned array seems correct. I'm guessing legend isn't being set.

Maybe a problem with flot's insertLegend vs. the flot.pie?

@dnschnur
Copy link
Member Author

From juergenm...@gmail.com on August 22, 2012 20:47:47
In jquery 1.7 the function for legendWidth returns null if no legend exists
This changed in jquery 1.8, now it returns undefined
From a theoretical standpoint, the new behaviour is more correct than the old one.
But in calculations handling of null is different to undefinded.
PIE plugin is based on null.

Simple workaround is to add a line after line 189 like this:
if(!legendWidth) legendWidth = null;

@dnschnur
Copy link
Member Author

From rob...@accettura.com on August 24, 2012 17:39:36
This seems reasonable. Can this be committed and made official.

(I hate to patch my code vs updating to latest).

@dnschnur
Copy link
Member Author

From rob...@accettura.com on September 05, 2012 15:49:17
Possibly related to:
http://bugs.jquery.com/ticket/12283

This appears to be fixed when using jQuery 1.8.1

@dnschnur
Copy link
Member Author

From ilo...@gmail.com on September 18, 2012 09:42:35
I went crazy with this (I had jQuery 1.8.0).
I upgraded to 1.8.1 and the problem was gone! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant