Jump to content
  • 0
TMeyer

Hide Charts when no data is present

Question

I have a chart that displays data based on a submission form to filter my data. When a person selects a combination that returns no data, is there a way to hide the charts and instead display text saying "There are no records for this search criteria" instead of just displaying blank charts? 

Thanks

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @TMeyer,

You can hide the chart when there are no records found, using JavaScript. You need to add a Header& Footer and you can use the following code:

For the Header:

<div class="chart-container">

For the Footer:

</div>

<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {

    if (document.getElementsByClassName("highcharts-no-data").length > 0) {
        document.getElementsByClassName("chart-container")[0].style.display = "none";
    }

});
</script>

 

-JolliBeng

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...