scottharwell / GoogleCharts

CakePHP Plugin for Google Charts Javascript API
26 stars 30 forks source link

Support for callbacks #2

Closed PhantomWatson closed 11 years ago

PhantomWatson commented 11 years ago

I needed a set of charts to be initially rendered in a hidden container, but discovered that they don't render properly unless visible: http://stackoverflow.com/questions/8577366/using-hide-and-show-with-google-visualization

To get around this, I added support for optional chart callbacks to the plugin so I could implement a function that hides charts after the 'ready' event is fired.

Example:

$chart->type("LineChart)    
        //Options array holds all options for Chart API
        ->options($options) 
        ->columns($columns)
        ->callbacks(array(
            'ready' => "function(){\$('#chart_container_id').hide();}"
        );