1

I have a requirement where I get chunks of data asynchronously. When i get the first chunk, I create a new series but for all other chunks. I want to add the chunk of data to the existing series. I can see in Highcharts documentation, there is addpoint method, but it adds each point and this would take a long time. Is there a way to add a chunk of data to the series in one go. In my case each chunk of data is an array of 2500 data points.

Thanks in advance.

1 Answer 1

1

In the ajax callback just get the existing serial data, append whatever data you need to the series, and re-set the series data.

callback: 
function(msg) {
    var oldData = myChart.get('mySeriesName').data;
    var newData = formatMsgForHighCharts(msg);
    var combinedData= oldData.concat(newData);
    myChart.get('mySeriesName').setData(combinedData);
}

The line:

 var newData = formatMsgForHighCharts(msg); 

doesn't need to be there if the message is already formatted properly, just pass msg.d into the concat function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.