No Data Message on charts

2 posts, 0 answers
  1. Richard
    Richard avatar
    1 posts
    Member since:
    Oct 2014

    Posted 28 Oct 2014 Link to this post

    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?
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 28 Oct 2014 Link to this post

    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!
     
Back to Top