score:15

Accepted answer

you can use highcharts chart renderer

here's an example in jsfiddle

var chart = new highcharts.chart({

    chart: {
        renderto: 'container'
    },

    xaxis: {
        categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']
    },

    series: []

}, function(chart) { // on complete

    chart.renderer.text('no data available', 140, 120)
        .css({
            color: '#4572a7',
            fontsize: '16px'
        })
        .add();

});

score:0

<script src="https://code.highcharts.com/modules/no-data-to-display.js"></script>

highcharts.chart('container', {
    lang: {
        nodata: "no data found"
    },
    nodata: {
        style: {
            fontweight: 'bold',
            fontsize: '15px'
        }
    },
    .
    .
});

score:0

and then after series you should add:

 lang: {
    nodata: 'nessun dato presente'
 },
 nodata: {
    style: {
         fontweight: 'bold',
         fontsize: '15px',
         color: '#303030'
     }
},

and it will work just fine

score:2

with the current version (v7.1.2) and connected no-data-to-display module (v7.1.2) you can show your 'no data' message when you create a chart object as patrik said by setting lang.nodata option.

to be able to change this message after the chart is created you need to call method

yourchartobject.shownodata('you new message')

score:4

for me with latest version it works like this:

const highcharts = require('highcharts');

import nodatatodisplay from 'highcharts/modules/no-data-to-display';
nodatatodisplay(highcharts);

highcharts.setoptions({
  lang: {
    nodata: 'no data is available in the chart'
  }
});

score:8

based on your comment (if we have data still showing no data available message so,can we hide in highcharts if we have data).i think you are using fustaki's solution and don't want to use no-data-to-display.js module. yes there is problem as mentioned .you can still use the same code by modifying it i.e add condition inside continuing function to check if series is empty or not, based on this render message.

var chart = new highcharts.chart({

chart: {
    renderto: 'container'
  },

  xaxis: {
    categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']
  },

  series: []

}, function(chart) { // on complete
  if (chart.series.length < 1) { // check series is empty
    chart.renderer.text('no data available', 140, 120)
      .css({
        color: '#4572a7',
        fontsize: '16px'
      })
      .add();
  }
});

fiddle demo

score:11

some of these other answers seem kind of crazy... here's a super basic solution i wanted to share:

highcharts.setoptions({lang: {nodata: "your custom message"}})
var chart = highcharts.chart('container', {
    series: [{
        data: []
    }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/no-data-to-display.js"></script>

<div id="container" style="height: 250px"></div>

hope this helps someone

score:18

include no-data-to-display.js file in your page. it comes bundled with highcharts. you can get it here otherwise: https://code.highcharts.com/modules/no-data-to-display.js

default message is "no data to display". if you would like to modify it, you can do this:

highcharts.setoptions({
    lang: {
        nodata: 'personalized no data message'
    }
});

Related Query