Load progress bar

2,122 views
Skip to first unread message

Schabagh

unread,
Apr 1, 2015, 9:14:56 AM4/1/15
to google-visua...@googlegroups.com
Hallo Forum,

is there a way to create a "Load progress bar or image" (to make it to notify my users that things are in progress) for charts and other google visualization components?

Thanks

Sergey Grabkovsky

unread,
Apr 1, 2015, 10:08:42 AM4/1/15
to google-visua...@googlegroups.com
Google Charts doesn't really report any sort of load progress. There is only the distinction of "not started", "loading", and "loaded". You would have to keep track of all that yourself. Charts can't be rendered in an invisible div, so you would probably have to layer another div on top of the chart, one that has a spinner animated image, and listen for the chart's "ready" event, upon which you would hide the spinner div.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Schabagh

unread,
Apr 1, 2015, 11:34:46 AM4/1/15
to google-visua...@googlegroups.com
Hello Sergey,

thanks. That is a very good idea. Do you mean something like this?

var chart = new google.visualization.Table(document.getElementById('chart_div'));
cahrt.draw(data, options);

google
.visualization.events.addListener(chart, 'ready', selectHandler);

function selectHandler(){
$("#myDivOnTop").hide();
}

Problem:
during my chart is loading, my animated .gif is not loaded and displayed. The chart and my animated gif are displayed at the same time.

Thanks



Sergey Grabkovsky

unread,
Apr 1, 2015, 11:38:24 AM4/1/15
to google-visua...@googlegroups.com
Yeah, that's what I meant. You probably don't want to make your spinner show in JavaScript. I think you'd want some sort of HTML/CSS combination so that the spinner is visible when the page first loads, and then goes away when the chart loads. If you show the spinners via JS, it is entirely possible that the chart will render quickly enough for the spinner to not have time to show anything significant.

Schabagh

unread,
Apr 2, 2015, 3:14:08 AM4/2/15
to google-visua...@googlegroups.com

Thank you Sergey. It works.


Alan Sparkes

unread,
Apr 2, 2015, 6:35:16 AM4/2/15
to google-visua...@googlegroups.com
Youcan always just add a spinning gif to the chart div as it will be replaced by google chart when loaded

Hisham Alkilani

unread,
May 1, 2015, 5:11:01 PM5/1/15
to google-visua...@googlegroups.com
HOW ? 
Could you show me an example ? 
Thanks 
Hisham
Reply all
Reply to author
Forward
0 new messages