Show message when chart has no data.

by evarzea » Wed May 24, 2017 6:24 pm

So there are times where a data source (list) will be empty.

At those times, I would like to display a message - something like, "No data available". I've looked high and low and have had no success...

can you point me in the right direction?
evarzea
 
Posts: 1
Joined: Wed May 24, 2017 6:20 pm

by Vladimir Batashev » Tue May 30, 2017 11:05 am

Hi,
Please, go to Dashboard -> Advanced and paste the following code into the code box:

Code: Select all
var handlers = {};
handlers.preRender = function(config, logger, processor, el) {
  if(!config.series || config.series.length === 0 || !config.series[0].data || config.series[0].data.length === 0) {
    config.render = function() {
    el.append(`
        <div style="
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        opacity: .2;
        filter: alpha(opacity=60);
        background-color: #999999 ;
        font-size: 34px;">

           <p style="display: flex; justify-content: center; align-items: center; height: 100%;">
                No data available
            </p>
        </div>`);
    }
  }
  return true;
}
User avatar
Vladimir Batashev
 
Posts: 2
Joined: Tue May 30, 2017 10:47 am


Return to Dashboard Designer for SharePoint 2013

cron