[tw] Re: jquery code in tiddler

2011-03-28 Thread axs
>> But I do not understand why loading it in MarkupPreHead does not work. 

im not sure, but i think it's because TW loads jQuery after any Markup 
pre/post head (or any of those shadow tiddlers), thus overwriting any jquery 
plugins loaded before that point. i think. 


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: jquery code in tiddler

2011-03-28 Thread La Raison
It's working!
Thank you,

But I do not understand why loading it in MarkupPreHead does not work.

Anyway,

Thanks to M.Shulman, PMario and M. axs.

On Mar 28, 6:16 pm, axs  wrote:
> try loading the Flot library inside your script tag before calling your code
> and only call the code if the library loads:
>
> 
> jQuery.getScript('jquery.flot.js',function(){
> //your code goes here})
>
> 
>
> note:
> - this assumes you've placed the plugin in the same folder as your TW file.
> - the original page that you referred to also loads an excanvas.min.js
> script. if it's necessary for this to work, make sure you load it as well
>
> regards,
> axs

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: jquery code in tiddler

2011-03-28 Thread axs
try loading the Flot library inside your script tag before calling your code 
and only call the code if the library loads:


jQuery.getScript('jquery.flot.js',function(){
//your code goes here
})


note:
- this assumes you've placed the plugin in the same folder as your TW file.
- the original page that you referred to also loads an excanvas.min.js 
script. if it's necessary for this to work, make sure you load it as well

regards,
axs

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: jquery code in tiddler

2011-03-28 Thread La Raison
Wow!

Two greats answers, and it's the same strategy.
Thanks to M. Shulman and M. PMario for the code and the explications.

I try the code and ...

TypeError: jQuery.plot is not a function

I have to think about that.
My Javascript and Jquery knowledge is very small.

LaRaison

On Mar 28, 5:22 pm, PMario  wrote:
> 
>     var d1 = [];
>     for (var i = 0; i < 14; i += 0.5)
>         d1.push([i, Math.sin(i)]);
>     var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
>     // a null signifies separate line segments
>     var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
>     jQuery.plot( jQuery("#placeholder"), [ d1, d2, d3 ]);
> 
>
> may work.
>
> since $ is only a "shortcut" for jQuery replace something like
>
> $('#someID').someFunctionName();
> with
> jQuery('#someID').someFunctionName(); and it should work.
>
> since $.plot() is a jQuery plugin it should be possible to use
> jQuery.plot()
>
> the above is not tested.
> -m

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: jquery code in tiddler

2011-03-28 Thread PMario

var d1 = [];
for (var i = 0; i < 14; i += 0.5)
d1.push([i, Math.sin(i)]);
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
// a null signifies separate line segments
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
jQuery.plot( jQuery("#placeholder"), [ d1, d2, d3 ]);


may work.

since $ is only a "shortcut" for jQuery replace something like

$('#someID').someFunctionName();
with
jQuery('#someID').someFunctionName(); and it should work.

since $.plot() is a jQuery plugin it should be possible to use
jQuery.plot()

the above is not tested.
-m

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.