Export to GitHub

flot - issue #643

Flot Navigate seems not to work with jQuery 1.7.1


Posted on Nov 28, 2011 by Swift Dog

I am currently using Flot in my Wordpress plugin WP SlimStat

http://wordpress.org/extend/plugins/wp-slimstat/

Recently, Wordpress 3.3 has updated the built-in jQuery library to 1.7.1. I was testing my plugin (and your charts) with this new version, and it looks like the zoom functionality is not working anymore. Everything was working fine with the previous version of jQuery, though.

With version 1.7.1 I get the following error message in Firefox

Error: uncaught exception: [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://multisite.dev/wp-content/plugins/wp-slimstat/view/flot/jquery.flot.min.js?ver=0.7 Line: 1635"]

As you can see I'm using the uncompressed version of flot, to better identify where the problem occurs. This happens as soon as I try to zoom in/out. The chart disappears and all the ticks are crammed together in the bottom left hand corner of the canvas (see attachment).

This is the code I use to initialize the chart

jQuery.plot(jQuery("#chart-placeholder"),[a,b,c],{zoom:{interactive:true},pan:{interactive:true},series:{lines:{show:true},points:{show:true},colors:[{opacity:0.85}]},xaxis:{tickSize:1,tickDecimals:0<?php echo "$datachart->min_max_ticks"; echo (!empty($wp_slimstat_view->day_interval) && $wp_slimstat_view->day_interval > 20)?',ticks:[]':',ticks:window.ticks' ?>,zoomRange:[5,window.ticks.length],panRange:[0,window.ticks.length]},yaxis:{tickDecimals:0,tickFormatter:tickFormatter,zoomRange:[5,<?php echo $datachart->max_yaxis+intval($datachart->max_yaxis/5) ?>],panRange:[0,<?php echo $datachart->max_yaxis+intval($datachart->max_yaxis/5) ?>]}, grid:{backgroundColor:"#ffffff",borderWidth:0,hoverable:true,clickable:true},legend:{container:"#chart-legend",noColumns:3}});

Your help would be greatly appreciated not just by me, but by the entire community of WP SlimStat users

Attachments

Comment #1

Posted on Nov 28, 2011 by Swift Dog

I just downloaded this demo on my local environment

http://people.iola.dk/olau/flot/examples/navigate.html

and replaced jQuery 1.5.1 with 1.7.1, and I get the same error as above, both in Chrome and Firefox.

Attachments

Comment #2

Posted on Nov 28, 2011 by Helpful Wombat

Hm, it seems like there have been some changes in the way jQuery sets up events. it's perhaps a problem with the inline drag event thing dependency in that plugin. Maybe see if there's been an update to that?

Comment #3

Posted on Nov 28, 2011 by Swift Dog

Thank you for pointing me into the right direction. That was the problem, indeed.

Comment #4

Posted on Nov 28, 2011 by Swift Dog

I know this is not the 'official' release, but if someone needs it, I'm attaching the updated library.

Thank you so much!

Attachments

Comment #5

Posted on Dec 21, 2011 by Quick Kangaroo

Could you post a non-minified version as well? I've observed an issue (that under jQuery 1.7.1 I can only zoom in with the scroll wheel, not out) and I'd like to see if it's related to this update before I start filing bugs.

Comment #6

Posted on Dec 21, 2011 by Swift Dog

Sure, I'm out of town for a couple of weeks, I will post it as soon as I get back.

Happy Holidays!

Comment #7

Posted on Jan 10, 2012 by Swift Dog

Sorry for the delay, here you go :)

Attachments

Comment #8

Posted on Feb 9, 2012 by Grumpy Elephant

Thank you!

Comment #9

Posted on Feb 14, 2012 by Happy Dog

I just hit this one on Safari 5.0.6, where it just leads to the graph vanishing silently.

Comment #10

Posted on May 4, 2012 by Happy Wombat

The problem was actually with the inline mousewheel plugin, not the drag plugin; you just happened to update both in your version. I've updated the mousewheel inline in the master branch; merging this with issue #685.

Status: Duplicate

Labels:
Type-Defect Priority-Medium