Add points to line chart without refreshing the whole chart

Hi,

is It possible to update specific series and redraw the changes without calling refresh on chart object? Could be useful when building real-time charts.

King regards

3 Replies

DD Dharanidharan Dharmasivam Syncfusion Team October 18, 2018 08:23 AM UTC

Hi Goran, 
 
Greetings from Syncfusion. 
 
We have analyzed your query. We would like to let you know that if you need to change the data source, then you no need to call the refresh method of chart. Once the data source is bind as depicted below, the chart will be refreshed automatically. 
 
We have prepared a sample in which using the button click event we have updated the data source of chart. Find the code snippet below. 
 
[index.html] 
 
<input type="button" value="Update Series" id="update" /> 
 
[index.js] 
 
document.getElementById("update").onclick = function (){ 
     //Get the data source 
 
     //... 
        
     //Get the instance of chart 
     var chart = document.getElementById("line-container").ej2_instances[0];  
     //Bind the data soruce 
     chart.series[0].dataSource = updatedData; 
  } 
 
 
Screenshot: 
 
Before updating data source: 
 
 
 
After updating data source: 
 
 
 
Sample for reference can be find below. 
 
Thanks, 
Dharani. 



GS Goran Strok October 19, 2018 08:24 AM UTC

Thank you, 

my mistake. I was assigning the same instance of datasource to the table that I used to update data, so the chart instance did not detect the change.

Kind regards


DD Dharanidharan Dharmasivam Syncfusion Team October 19, 2018 09:51 AM UTC

Hi Goran, 
 
Most welcome. We have happy in assisting you, kindly revert us if you need further assistance. 
 
Thanks, 
Dharani. 
 


Loader.
Up arrow icon