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
- You must login to post comments
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
- Andrew Burnett-Thompson answered 3 years ago
- You must login to post comments
Please login first to submit.