Show a spinner while loading google treemap

27 views
Skip to first unread message

Sachin Bal

unread,
Dec 22, 2016, 6:17:25 AM12/22/16
to Google Visualization API
Hi,

I have a google treemap which takes considerable time to load. I would like to show a spinner while the data is loaded. I am trying it this way. I have a div class for loading 

 <div class="loading">Loading&#8230;</div>

and the spinner shows on the screen while the data is loaded. The challenge is that I have written the following in the javascript code

    google.visualization.events.addListener(tree, 'ready', onReady);
     function onReady(){
           $("#loading").hide();
        } 
    }

This does not work. When I do a debug of this code, the onReady() function shows 

onReady = onReady()

What am I missing here? Can someone please guide me?

Thanks

Sachin

Sachin Bal

unread,
Dec 27, 2016, 6:45:53 AM12/27/16
to Google Visualization API
Update: 

I resolved this by just having this line after the data is loaded

           $("#loading").hide();

Not sure whether it is the right way but this hides the spinner. Unfortunately, I am trying to show the google treemap for the "top xx number" of values. Which means that when I select the number, I would like that the treemap is drawn for that number of values and when it loads the data, it should again show a spinner. How can I achieve the same? Any suggestions?

Thanks

Sachin 
Reply all
Reply to author
Forward
0 new messages