jqplot not working with noConflict method.

310 views
Skip to first unread message

liaabi

unread,
Mar 9, 2012, 9:29:54 AM3/9/12
to jqplot-users
Hey, I am having the same problem.
I am trying to use jqplot with richfaces and trying to make the simple
example work:
$j = jQuery.noConflict();
$j(document).ready(function($j){
var plot1 = $j.jqplot ('#chartdiv', [[3,7,9,1,4,6,8,2,5]]);
});

I get a js error '$j.jqplot is not a function'
Same if I am using $ or jQuery as caller objects. I need noConflict()
because of richfaces.
Can you please provide some help?

Thank you

CLWill

unread,
Mar 9, 2012, 12:26:07 PM3/9/12
to jqplot-users
Just a guess, but I don't think you want the ($j) in the function
call. I think you're redefining it twice. I think it should be this:

$j = jQuery.noConflict();
$j(document).ready(function(){
var plot1 = $j.jqplot ('#chartdiv',
[[3,7,9,1,4,6,8,2,5]]);
});

But I haven't tried it.

liaabi

unread,
Mar 12, 2012, 1:52:02 AM3/12/12
to jqplot-users
Thanks for the suggestion. I tried that too. And basically every
possible combination :D
I get the same error.
Any help greatly appreciated.

liaabi

unread,
Mar 12, 2012, 6:23:59 AM3/12/12
to jqplot-users
I don't know if this is a newbie mistake or if there is a problem with
<a4j:loadScript> but I found that I have to use <script type="text/
javascript" src=""> in the template rather than using <a4j:loadScript>
in the xhtml composition file when using multiple js libraries (and I
think it has something to do with jQuery based libs).
In case anyone else comes across this issue.

Al Brown

unread,
Mar 13, 2012, 7:24:30 PM3/13/12
to jqplot...@googlegroups.com
Try passing just the id of the div, not the #.

Also, maybe try var to ensure there's no scoping issue:

  var $j = jQuery.noConflict();

And watch out for capitalization.  If you specify"$j.jqplot.dateAxisRenderer" as your renderer instead of "$j.jqplot.DateAxisRenderer", things won't work.
Message has been deleted

Jesse

unread,
Mar 27, 2012, 4:08:43 PM3/27/12
to jqplot-users
Hey have you gotten this working yet?

Im having the exact same problem... I keep getting "Error: $j.jqplot
is not a function"

ive tried without noConflict() .. im getting the same issue without
it.

Anyone else?

Thanks!

Jesse
> > > > I get a js error '$j.jqplotis not a function'

Furqan Shaikh

unread,
May 9, 2013, 11:01:06 AM5/9/13
to jqplot...@googlegroups.com
Hi, 

I am having the same problem. 
What I have identified, we are having multiple conflicts.
After  var $j = jQuery.noConflict();

$ starts to refer to the prototype library.

How can we get the jqplot handler. 

Thanks !!!
Reply all
Reply to author
Forward
0 new messages