KendoUI chart - how do I show animation while loading data?

前端 未结 1 521
无人及你
无人及你 2021-02-20 01:45

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 Data

相关标签:
1条回答
  • 2021-02-20 02:43

    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/

    0 讨论(0)
提交回复
热议问题