Pre loader

XYDataSeries Update

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Is there a way to update the entire data series instead of a particular y value at an index ?

https://www.scichart.com/documentation/js/current/typedoc/classes/xydataseries.html#update

Version
1.4.1597
  • You must to post comments
0
0

Hi Vamsi

You can use this code to replace all values in a DataSeries:

dataSeries.removeRange(0, dataSeries.count());
dataSeries.appendRange(newXValues, newYValues);
// SciChart will automatically redraw

This should be fairly performant but does resize the buffer twice due to the remove & add. Alternatively you can simply create a new DataSeries and assign to your renderableSeries like this:

const xValues: number[] = []; // Given x,y values in an array 
const yValues: number[] = [];
const oldDataSeries = rs.dataSeries;
const newDataSeries = new XyDataSeries(wasmContext, { xValues, yValues} );
rs.dataSeries = newDataSeries;  // SciChart will automatically redraw
oldDataSeries.delete(); // Delete old series to release memory

Try those. If you need a specific dataSeries.replace() function to overwrite all data more efficiently we can add this as well.

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies