This is a migrated thread and some comments may be shown as answers.

Only Show Chart When It Has Data

1 Answer 82 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Kieren
Top achievements
Rank 1
Kieren asked on 26 Aug 2013, 06:57 AM
Hi

What is the recommended approach for showing a chart - only when it has data. 

By default, the chart draws without any data. This means there's a bit of a flicker when it redraws to show the data loaded from a remote source. All my chart initialization is currently in the jQuery.ready( event...

Is there any easy way to only show the chart when it has data? Ideally, this is a just a property rather than having to wire up this behaviour every time?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 26 Aug 2013, 11:31 AM
Hello,

There's no built-in functionality that can be used to achieve the desired effect directly.
Nonetheless we can use the dataBound event to show (the initially hidden) widget.

-- Live example --

<div id="chart" style="visibility: hidden;" />

$("#chart").kendoChart({
    // ...
    dataBound: function() {
        $(this.element).css("visibility", "visible");
    }
}


I hope this helps.

Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Kieren
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or