Split series line by not connecting points greater than xx hours apart

Hi there,
I'm using SfCartesianChart to prototype a simple IoT dashboard. Sometimes my IoT devices go offline for a few hours and there is a long gap between the data points that I want to display on the chart. Currently, the chart continues to connect these points with the same line that connects the rest of that series of points.
Is there any way that I can stop this from happening, and only draw that line to connect data points that are less than 2 hours apart along the x-axis (datetime). If any data points are greater than 2 hours apart, I want to leave empty space on that part of the chart and not connect those points with a line.


1 Reply

YG Yuvaraj Gajaraj Syncfusion Team November 2, 2021 01:30 PM UTC

Hi Blake Edwards, 
 
Greetings from Syncfusion. We have analyzed your query, and we would like to let you know that you can add data points and assign the y-value as null to them when the device goes offline. So, that your expected requirement can be achieved. We have prepared a sample based on this, here we have achieved this in the _updateDataSource method by updating the data points with null values when the data point length is between the specified range. Here you can check whether the device goes offline or not and modify the code as per your scenario. We have also attached the sample for your reference. 
 
Code snippet:  
void _updateDataSource(Timer timer) { 
    // Here we have checked if the data point length is between this range we assigned 
    // a null value. So here you can modify it as your requirement. 
  } 
 
  
  
Regards, 
Yuvaraj. 


Loader.
Up arrow icon