KendoUI chart - how do I show animation while load

2019-04-05 04:54发布

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.

Thanks

1条回答
够拽才男人
2楼-- · 2019-04-05 05:39

Displaying and hiding the loading animation is:

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

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

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

The DataSource of the Chart would be:

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

    }
},

Example here: http://jsfiddle.net/OnaBai/kcptr/

查看更多
登录 后发表回答