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

No Data Message on charts

1 Answer 139 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 28 Oct 2014, 07:43 AM
Hi there,
I'm attempting to set a "No Data Message"  for various charts and I've been using the chart's databound event to check on the number of records returned and then add a "No Data" div to the chart object as per various online discussions. My Databound event is as follows:


<br>function ConsultantParetoBound(e)<br>        {   <br>  if (this.dataSource.data().length == 0)              {                    $('<div class="custom-overlay"><p class="errorMessage">No data available for the       selected range</p></div>').appendTo('#consultantPareto');                    alert();                             }        }




This *almost* works in that if I debug the code above, the message is shown, then the alert is shown....however, as soon as I click OK at the alert, the chart appears to be re-rendered, which then removes the newly added div, meaning I'm left with an empty chart with no message.



Is there a way around this?

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 28 Oct 2014, 01:26 PM
Hello,

I'm posting the reply to your support ticket for reference:

This is indeed so, the chart container will be cleaned up on redraw. 
We'll be changing this behavior with the new release so appended elements will remain inside the container.

For the moment you can position the chart and the overlay in a container div with absolute position.
This should allow you to overlay the chart without appending an element to its element.

See this snippet. 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
Richard
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or