- Home
- Forum
- JavaScript - EJ 2
- empty data chart error
empty data chart error
Attachment: ej2typescriptseed_997ed60a.zip
Attachment: Chart_7bfc9b76.zip
- Try to reproduce the reported scenario in the above sample
- Share the chart version used in the project.
- Share the details if you have done any other customization in your sample.
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.
- 9 Replies
- 7 Participants
-
JS Jose Simoes
- Mar 26, 2018 01:19 PM UTC
- Jul 15, 2022 02:21 PM UTC