KendoUI 图表 - 如何在加载数据时显示动画? [英] KendoUI chart - how do I show animation while loading data?

查看:17
本文介绍了KendoUI 图表 - 如何在加载数据时显示动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用 JavaScript 生成的 KendoUI 图表.有没有办法用命令清除 plotArea?用于在等待 DataSource 读取远程数据时显示正在加载..."图像.

I have a KendoUI chart generated with JavaScript. Is there a way to clear the plotArea with a command? For the purpose of showing a "Loading..." image while waiting for a DataSource to read remote data.

谢谢

推荐答案

显示和隐藏加载动画是:

Displaying and hiding the loading animation is:

// Display progress
kendo.ui.progress($("#loading"), true);

// Hide progress
kendo.ui.progress($("#loading"), false);

那么你应该在 DataSource 中使用 requestStartrequestEnd 事件来了解何时显示或隐藏进度动画.

Then you should use requestStart and requestEnd events in the DataSource for knowing when to show or hide the progress animation.

图表的数据源为:

dataSource    : {
    transport   : {
        read: {
            url:...
        }
    },
    sort        : {
        field: "year",
        dir  : "asc"
    },
    requestStart: function () {
        kendo.ui.progress($("#loading"), true);
    },
    requestEnd  : function () {
        kendo.ui.progress($("#loading"), false);

    }
},

示例:http://jsfiddle.net/OnaBai/kcptr/

这篇关于KendoUI 图表 - 如何在加载数据时显示动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆