HashedCollection in flot paramaters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

HashedCollection in flot paramaters

Usman Bhatti
Hello all,

I am trying to adapt the basic example of flot available here: https://gist.github.com/1649426. The basic example works but when I try to pass it a few more parameters for customization, it does not.


In javascript, a graph can be drawn by calling the plot function with dictionary containing data and params:
 
$.plot($("#placeholder"), [
{
data: d1,
lines: { show: true, fill: true }
},
]);

With Amber, I am creating my data in this way:

d1 := OrderedCollection new.
(0 to: 14 by: 0.5) do:[:i| d1 add:{ i.  Math  sin:( i ) } ].

jQuery plot: '#placeholder' asJQuery with: {#{
                'data' -> d1. 'bars' -> #{'show' -> 'true'} }}.

Do you see any problem with my code?

tx,
Usman
Reply | Threaded
Open this post in threaded view
|

Re: HashedCollection in flot paramaters

Nicolas Petton
Hello Usman! (nice to see you on Amber's ML)

All I can see is that you pass a string instead of a boolean object:

'data' -> d1. 'bars' -> #{'show' -> 'true'}

should probably be:

'data' -> d1. 'bars' -> #{'show' -> true}

Cheers,
Nico

Usman Bhatti <[hidden email]> writes:


> Hello all,
>
>
> I am trying to adapt the basic example of flot available
> here: https://gist.github.com/1649426. The basic example works but
> when I try to pass it a few more parameters for customization, it does
> not.
>
>
> In javascript, a graph can be drawn by calling the plot function with
> dictionary containing data and params:
>  
>
>                                                                
>  $.plot($("#placeholder"), [                                  
>                                                                
>                              {                                
>                                                                
>                              data: d1,                        
>                                                                
>                              lines: { show: true, fill: true }
>                                                                
>                              },                                
>                                                                
>                              ]);                              
>                                                                
>
> With Amber, I am creating my data in this way:
>
> d1 := OrderedCollection new.
> (0 to: 14 by: 0.5) do:[:i| d1 add:{ i.  Math  sin:( i ) } ].
>
> jQuery plot: '#placeholder' asJQuery with: {#{
>                 'data' -> d1. 'bars' -> #{'show' -> 'true'} }}.
>
> Do you see any problem with my code?
>
> tx,
> Usman

--
Nicolas Petton
http://nicolas-petton.fr
Reply | Threaded
Open this post in threaded view
|

Re: HashedCollection in flot paramaters

Usman Bhatti
Thanx Nicolas for your prompt reply.

On Monday, 9 July 2012 12:00:56 UTC+2, nicolas petton wrote:
Hello Usman! (nice to see you on Amber's ML)

All I can see is that you pass a string instead of a boolean object:

'data' -> d1. 'bars' -> #{'show' -> 'true'}

should probably be:

'data' -> d1. 'bars' -> #{'show' -> true}

I changed it but it does not resolve the problem. 
When I inspect #{'show' -> true}, the key ('show') is an array instead of a string. Do you think that this might the problem?


Cheers,
Nico



> Hello all,
>
>
> I am trying to adapt the basic example of flot available
> here: https://gist.github.com/1649426. The basic example works but
> when I try to pass it a few more parameters for customization, it does
> not.
>
>
> In javascript, a graph can be drawn by calling the plot function with
> dictionary containing data and params:
>  
>
>                                                                
>  $.plot($("#placeholder"), [                                  
>                                                                
>                              {                                
>                                                                
>                              data: d1,                        
>                                                                
>                              lines: { show: true, fill: true }
>                                                                
>                              },                                
>                                                                
>                              ]);                              
>                                                                
>
> With Amber, I am creating my data in this way:
>
> d1 := OrderedCollection new.
> (0 to: 14 by: 0.5) do:[:i| d1 add:{ i.  Math  sin:( i ) } ].
>
> jQuery plot: '#placeholder' asJQuery with: {#{
>                 'data' -> d1. 'bars' -> #{'show' -> 'true'} }}.
>
> Do you see any problem with my code?
>
> tx,
> Usman

--
Nicolas Petton
http://nicolas-petton.fr
Reply | Threaded
Open this post in threaded view
|

Re: HashedCollection in flot paramaters

Nicolas Petton
Indeed that's a problem :)

What version of Amber are you using?
you show me what you have if you printIt the literal object?

Cheers,
Nico

Usman Bhatti <[hidden email]> writes:

> Thanx Nicolas for your prompt reply.
>
>
> On Monday, 9 July 2012 12:00:56 UTC+2, nicolas petton wrote:
>
>     Hello Usman! (nice to see you on Amber's ML)
>    
>     All I can see is that you pass a string instead of a boolean
>     object:
>    
>     'data' -> d1. 'bars' -> #{'show' -> 'true'}
>    
>     should probably be:
>    
>     'data' -> d1. 'bars' -> #{'show' -> true}
>    
>
> I changed it but it does not resolve the problem. 
> When I inspect #{'show' -> true}, the key ('show') is an array instead
> of a string. Do you think that this might the problem?
>
>
>     Cheers,
>     Nico
>    
>    
>    
>     > Hello all,
>     >
>     >
>     > I am trying to adapt the basic example of flot available
>     > here: https://gist.github.com/1649426. The basic example works
>     but
>     > when I try to pass it a few more parameters for customization,
>     it does
>     > not.
>     >
>     >
>     > In javascript, a graph can be drawn by calling the plot function
>     with
>     > dictionary containing data and params:
>     >  
>     >
>     >                                                                
>     >  $.plot($("#placeholder"), [                                  
>     >                                                                
>     >                              {                                
>     >                                                                
>     >                              data: d1,                        
>     >                                                                
>     >                              lines: { show: true, fill: true }
>     >                                                                
>     >                              },                                
>     >                                                                
>     >                              ]);                              
>     >                                                                
>     >
>     > With Amber, I am creating my data in this way:
>     >
>     > d1 := OrderedCollection new.
>     > (0 to: 14 by: 0.5) do:[:i| d1 add:{ i.  Math  sin:( i ) } ].
>     >
>     > jQuery plot: '#placeholder' asJQuery with: {#{
>     >                 'data' -> d1. 'bars' -> #{'show' -> 'true'} }}.
>     >
>     > Do you see any problem with my code?
>     >
>     > tx,
>     > Usman
>    
>     --
>     Nicolas Petton
>     http://nicolas-petton.fr 
>    

--
Nicolas Petton
http://nicolas-petton.fr
Reply | Threaded
Open this post in threaded view
|

Re: HashedCollection in flot paramaters

Usman Bhatti


On Monday, 9 July 2012 15:01:59 UTC+2, nicolas petton wrote:
Indeed that's a problem :)

What version of Amber are you using?

I downloaded Amber yesterday from the version available on the website here:
http://github.com/NicolasPetton/amber/tarball/master


 
you show me what you have if you printIt the literal object?

Strangely I am getting a nil. 

Check this out:

#{'akey' -> #{'innerKey' -> 1}}
akey is an array instead of a string and printing it, we get a nil.

Can you replicate the problem on your end?

 

Cheers,
Nico

> Thanx Nicolas for your prompt reply.
>
>
> On Monday, 9 July 2012 12:00:56 UTC+2, nicolas petton wrote:
>
>     Hello Usman! (nice to see you on Amber's ML)
>    
>     All I can see is that you pass a string instead of a boolean
>     object:
>    
>     'data' -> d1. 'bars' -> #{'show' -> 'true'}
>    
>     should probably be:
>    
>     'data' -> d1. 'bars' -> #{'show' -> true}
>    
>
> I changed it but it does not resolve the problem. 
> When I inspect #{'show' -> true}, the key ('show') is an array instead
> of a string. Do you think that this might the problem?
>
>
>     Cheers,
>     Nico
>    
>    
>    
>     > Hello all,
>     >
>     >
>     > I am trying to adapt the basic example of flot available
>     > here: https://gist.github.com/1649426. The basic example works
>     but
>     > when I try to pass it a few more parameters for customization,
>     it does
>     > not.
>     >
>     >
>     > In javascript, a graph can be drawn by calling the plot function
>     with
>     > dictionary containing data and params:
>     >  
>     >
>     >                                                                
>     >  $.plot($("#placeholder"), [                                  
>     >                                                                
>     >                              {                                
>     >                                                                
>     >                              data: d1,                        
>     >                                                                
>     >                              lines: { show: true, fill: true }
>     >                                                                
>     >                              },                                
>     >                                                                
>     >                              ]);                              
>     >                                                                
>     >
>     > With Amber, I am creating my data in this way:
>     >
>     > d1 := OrderedCollection new.
>     > (0 to: 14 by: 0.5) do:[:i| d1 add:{ i.  Math  sin:( i ) } ].
>     >
>     > jQuery plot: '#placeholder' asJQuery with: {#{
>     >                 'data' -> d1. 'bars' -> #{'show' -> 'true'} }}.
>     >
>     > Do you see any problem with my code?
>     >
>     > tx,
>     > Usman
>    
>     --
>     Nicolas Petton
>     http://nicolas-petton.fr
>    

--
Nicolas Petton
http://nicolas-petton.fr
Reply | Threaded
Open this post in threaded view
|

Re: HashedCollection in flot paramaters

Nicolas Petton
Using the stable version (you can check on the website), I get

 a HashedCollection('akey' -> a HashedCollection('innerKey' -> 1))


Nico

Usman Bhatti <[hidden email]> writes:

> On Monday, 9 July 2012 15:01:59 UTC+2, nicolas petton wrote:
>
>     Indeed that's a problem :)
>    
>     What version of Amber are you using?
>    
>
> I downloaded Amber yesterday from the version available on the website
> here:
> http://github.com/NicolasPetton/amber/tarball/master
>
>
>  
>
>     you show me what you have if you printIt the literal object?
>    
>
> Strangely I am getting a nil. 
>
> Check this out:
>
> #{'akey' -> #{'innerKey' -> 1}}
> akey is an array instead of a string and printing it, we get a nil.
>
> Can you replicate the problem on your end?
>
>  
>
>
>     Cheers,
>     Nico
>    
>     > Thanx Nicolas for your prompt reply.
>     >
>     >
>     > On Monday, 9 July 2012 12:00:56 UTC+2, nicolas petton wrote:
>     >
>     >     Hello Usman! (nice to see you on Amber's ML)
>     >    
>     >     All I can see is that you pass a string instead of a boolean
>     >     object:
>     >    
>     >     'data' -> d1. 'bars' -> #{'show' -> 'true'}
>     >    
>     >     should probably be:
>     >    
>     >     'data' -> d1. 'bars' -> #{'show' -> true}
>     >    
>     >
>     > I changed it but it does not resolve the problem. 
>     > When I inspect #{'show' -> true}, the key ('show') is an array
>     instead
>     > of a string. Do you think that this might the problem?
>     >
>     >
>     >     Cheers,
>     >     Nico
>     >    
>     >    
>     >    
>     >     > Hello all,
>     >     >
>     >     >
>     >     > I am trying to adapt the basic example of flot available
>     >     > here: https://gist.github.com/1649426. The basic example
>     works
>     >     but
>     >     > when I try to pass it a few more parameters for
>     customization,
>     >     it does
>     >     > not.
>     >     >
>     >     >
>     >     > In javascript, a graph can be drawn by calling the plot
>     function
>     >     with
>     >     > dictionary containing data and params:
>     >     >  
>     >     >
>     >     >                                                          
>          
>     >     >  $.plot($("#placeholder"), [                              
>        
>     >     >                                                          
>          
>     >     >                              {                            
>        
>     >     >                                                          
>          
>     >     >                              data: d1,                    
>        
>     >     >                                                          
>          
>     >     >                              lines: { show: true, fill:
>     true }
>     >     >                                                          
>          
>     >     >                              },                          
>          
>     >     >                                                          
>          
>     >     >                              ]);                          
>        
>     >     >                                                          
>          
>     >     >
>     >     > With Amber, I am creating my data in this way:
>     >     >
>     >     > d1 := OrderedCollection new.
>     >     > (0 to: 14 by: 0.5) do:[:i| d1 add:{ i.  Math  sin:( i ) }
>     ].
>     >     >
>     >     > jQuery plot: '#placeholder' asJQuery with: {#{
>     >     >                 'data' -> d1. 'bars' -> #{'show' -> 'true'}
>     }}.
>     >     >
>     >     > Do you see any problem with my code?
>     >     >
>     >     > tx,
>     >     > Usman
>     >    
>     >     --
>     >     Nicolas Petton
>     >     http://nicolas-petton.fr 
>     >    
>    
>     --
>     Nicolas Petton
>     http://nicolas-petton.fr 
>    

--
Nicolas Petton
http://nicolas-petton.fr