Hi Guys,

Am building a dynamic dashboard using cakephp, mysql and google charts api.

Any sample code or demo which can help me will be appreciated.

Best,
Sumit

On Tuesday, May 29, 2012 9:21:46 AM UTC+5:30, Nikhil Agrawal wrote:
>
> Try making a google chart API helper which will make js code for chart 
> on-fly using js helper of  cake PHP.  I have a one written by me but works 
> only for pie charts with some restrictions . If you want e-mail me for it.
> Will be happy to help you.
> On Mar 30, 2012 8:28 PM, "phpMagpie" <[email protected] <javascript:>> 
> wrote:
>
>> I've outputted some charts (combocharts - near identical to column chart) 
>> using the visualization api and got the model to output an array like:
>>
>> Array
>> (
>>     [labels] => Array
>>         (
>>             [0] => Age
>>             [1] => Clients
>>             [2] => Not Offered
>>             [3] => Accepted Offer
>>             [4] => Declined Offer
>>         )
>>
>>     [16] => Array
>>         (
>>             [0] => 16
>>             [1] => 10
>>             [2] => 7
>>             [3] => 5
>>             [4] => 0
>>         )
>>
>>     [17] => Array
>>         (
>>             [0] => 17
>>             [1] => 27
>>             [2] => 22
>>             [3] => 13
>>             [4] => 4
>>         )
>>
>>     [18] => Array
>>         (
>>             [0] => 18
>>             [1] => 13
>>             [2] => 8
>>             [3] => 7
>>             [4] => 2
>>         )
>>
>>     [19] => Array
>>         (
>>             [0] => 19
>>             [1] => 12
>>             [2] => 6
>>             [3] => 6
>>             [4] => 1
>>         )
>>
>>     [20] => Array
>>         (
>>             [0] => 20
>>             [1] => 8
>>             [2] => 2
>>             [3] => 6
>>             [4] => 0
>>         )
>>
>>     [21] => Array
>>         (
>>             [0] => 21
>>             [1] => 7
>>             [2] => 4
>>             [3] => 3
>>             [4] => 0
>>         )
>>
>> )
>>
>> I then ran this through the following
>> foreach($arrayFromModel AS $row) {
>>   $chartData[] = json_encode($row);
>> }
>>
>> and ended up with:
>> Array
>> (
>>     [0] => ["Age","Clients","Not Offered","Accepted Offer","Declined 
>> Offer"]
>>     [1] => ["16",10,7,5,0]
>>     [2] => ["17",27,22,13,4]
>>     [3] => ["18",13,8,7,2]
>>     [4] => ["19",12,6,6,1]
>>     [5] => ["20",8,2,6,0]
>>     [6] => ["21",7,4,3,0]
>> )
>>
>> With an array of this type you use the following google function to get 
>> your data table:
>> var data = google.visualization.arrayToDataTable([".join(',', 
>> $chartData)."]);
>>
>> Hope this is of some help, phpMagpie
>>
>> -- 
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org 
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>  
>>  
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:> For more options, visit 
>> this group at http://groups.google.com/group/cake-php
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to