Google Visualizations Api Cakephp
Implement server/client data graph rendering with Google’s Visualization tool chain in CakePHP.
By: Chris Saylor | November 21, 2010 • 2 minute read
Note: This is an article restored from an archive and the project this refers to is no longer maintained. Google Visualizations Tools API has also changed significantly since this is written.
Often it is imperative to visualize data in applications. In my previous post, I showed how visualizing data can shape the outcome of a conversation (in this case a tech visit).
Here is an example of setting some data and displaying a line graph of that data using the visualization:
<?php $data = array( 'labels' => array( array('string' => 'Sample'), array('number' => 'Piston 1'), array('number' => 'Piston 2') ), 'data' => array( array('S1', 74.01, 74.03), array('S2', 74.05, 74.04), array('S3', 74.03, 74.01), array('S4', 74.00, 74.02), array('S5', 74.12, 74.05), array('S6', 74.04, 74.04), array('S7', 74.05, 74.06), array('S8', 74.03, 74.02), array('S9', 74.01, 74.03), array('S10', 74.04, 74.01), ), 'title' => 'Piston Ring Diameter', 'type' => 'line' ); echo $this->GChart->start('test'); echo $this->GChart->visualize('test', $data);
The helper is available free of charge for use in personal and commercial products under MIT.