简体   繁体   English

使用谷歌图表加载 gif 和动画

[英]Loading gif and animation with google charts

I'm creating a dashboard using Google Charts and I need a way to include a loading gif or text that reads "Loading.." while my div or canvas loads with the chart.我正在使用 Google Charts 创建一个仪表板,我需要一种方法来包含一个加载 gif 或文本,在我的 div 或 canvas 加载图表时读取“正在加载..”。 Also, I'm having a hard time figuring out how to get the charts to animate on start up as well as when values are updated.此外,我很难弄清楚如何让图表在启动时以及值更新时进行动画处理。

A quick google search for 'loading gif' bought up a few results..在谷歌上快速搜索“加载 gif”得到了一些结果。

http://www.ajaxload.info/ http://www.ajaxload.info/

http://preloaders.net/ http://preloaders.net/

Ok I figured it out.好吧,我想通了。 It was literally 1 line of code.它实际上是 1 行代码。 I wanted to do it with raw javascript and css.我想用原始的 javascript 和 css 来做。 Its just a matter of grabbing the element and changing or 'setting' the class.它只是获取元素并更改或“设置”类的问题。

document.getElementById("myDiv").className = "stop_loading";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM