Worked almost a charm... Still, I ended up writing a this codeblock to
manually make-up the output the way I want it:
$i=0;
$output = "[";
foreach($data as $key=>$val){
if ($i != 0) {$output .= ", ";}
$output .= "[".$key.", ".$val."]";
$i++;
}
$output .= "]";
echo $output;
It makes the array look like the string [[x,y],[x,y]...[x,y]] whith
which I used Codeblock to generate the javaCode. Thanks all!
On 18 mei, 19:08, brian <[email protected]> wrote:
> You could use the JavascriptHelper to create the array, or any other
> block of JS code.
>
> On Mon, May 18, 2009 at 12:10 PM, Céryl <[email protected]> wrote:
>
> > Hej all!
>
> > I've been trying to find a solution for this, and maybe I'm
> > approaching it wrong. This is the case:
>
> > For my site I need make graphs out of data in a table. I have picked
> > JQuery FLOT for making the graphs. However, FLOT needs data in a
> > jQuery array build like:
>
> > [[xaxis, yaxis]
> > [xaxis, yaxis]
> > [xaxis, yaxis]];
>
> > and then calls the plot graph function in FLOT to build it. These
> > functions (With the array currently hardcoded) are in my project in a
> > seperate .js file I load in my view.
>
> > However, When I get into my controller and get the relevant data, and
> > pass it to the view using Cake's Set, how can I get that (PHP)array
> > converted and passed to the javascript (.js file) that builds the
> > graph?
>
> > Has anybody any expierience or idea's with this? And if there are
> > graphing libraries that allow for on-the-fly graphs from a database,
> > that work better with Cake, please tell me! Now it's not to late to
> > switch!
>
> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---