SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

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.