empty data chart error

Hi!

If the datasource of the chart is empty, the chart doesn't show and you get error on console.
Thanks

9 Replies

BP Baby Palanidurai Syncfusion Team March 27, 2018 07:25 AM UTC

Hi Jose Simoes, 

Thanks  for using syncfusion products, 

We have analyzed your query. While using empty data source to charts, we are showing only axis to charts, not showing default series for charts. This is the actual behavior. And we are not getting any console error for the same.  

Screenshot: 
 
If you face any other error, kindly revert us with more detail on this. 

Thanks, 
Baby. 



JS Jose Simoes March 27, 2018 09:50 AM UTC

Hi!

I've modified your typescript seed so that you can see the issue. Please see the attached sample.
I'm getting "Unable to get property 'replace' of undefined or null reference" on the console.
Thanks

Attachment: ej2typescriptseed_997ed60a.zip


BP Baby Palanidurai Syncfusion Team March 28, 2018 04:35 PM UTC

Hi Jose Simoes, 

Sorry for the inconvenience, we have installed packages for your typescript seed sample and checked, unfortunately the reported issue is not reproduced in our end, the chart is rendering properly. The previous plunker sample and this typescript seed sample both are same and we didn’t see any difference. Can you conform us the changes, which will be helpful for us to find the solution in our end. 

Kindly revert us, if you have any concerns. 

Thanks, 
Baby.


JS Jose Simoes March 29, 2018 08:23 AM UTC

Hi!

I can't figure this out. All I did was add a chart with datetime axis and set an empty datasource.
Please see the attached screenshot of your online demo. It is also crashing.

Thanks

Attachment: Chart_7bfc9b76.zip


AB Akbar Basha K M Syncfusion Team March 30, 2018 04:51 AM UTC

Hi Jose, 
Thanks for your reply. For better follow up, support incident has been created under your Direct Trac account. Please follow that for further assistance. 
Thanks, 
Akbar Basha. 



RC Roland Chie August 28, 2020 08:17 PM UTC

We are currently having this same error when the charts are empty.  Was there ever a solution?  We are using the latest chart components.

Thanks

Roland.


SM Srihari Muthukaruppan Syncfusion Team August 31, 2020 12:25 PM UTC

Hi Roland, 
 
We would like to let you know that the chart is working fine with empty data source which we checked with the latest version. We have also checked by changing the time zone to ( (UTC+00:00) Dublin, Edimburg, Lisbon, London - Daylight Saving Time). Unfortunately, we are unable to reproduce the reported scenario. We have also attached the sample used for testing for your reference. Please find the below screenshot, and sample.  
Screenshot: 
  
 
  
If you still face this issue. Kindly revert us with the following information which will be more helpful for further analysis and provide you the solution sooner.   
   
  1. Try to reproduce the reported scenario in the above sample
 
  1. Share the chart version used in the project.
 
  1. Share the details if you have done any other customization in your sample.
  
Regards, 
Srihari M 



JT Jayesh Tiwari July 14, 2022 04:03 AM UTC

Is there a way I can display 'No Data Found' message when chart has no data from the source?



DG Durga Gopalakrishnan Syncfusion Team July 15, 2022 02:21 PM UTC

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({     load: function(args){

        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';

       }

    }});chart.appendTo('#element');

 

Please revert us if you have any concerns.

 

Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon