Is there a way I can display 'No Data Found' message when chart has no data from the source?
Hi Jayesh,
We suggest you to include HTML DIV to show the custom message and load event to cancel chart rendering when series datasource is empty. In the sample, we have displayed DIV when data is empty and hidden the DIV when data is available. Please check with below snippet and sample.
let chart: Chart = new Chart({ var rectEle = document.getElementById("rect"); var chart = document.getElementById("element"); if(args.chart.series[0].dataSource["length"] == 0){ args.cancel = true; chart.style.display = 'none'; rectEle.style.display = 'block'; } else{ rectEle.style.display = 'none'; } } |
Please revert us if you have any concerns.
Regards,
Durga Gopalakrishnan.