I have XyDataSeries
with 50 data points and I’m trying to insert another 50 data points to index 5. The same values can be inserted as a range to the beginning of the data series or inserted one by one starting from index 5. But they fail with “RuntimeError: memory access out of bounds” whenever I try to insert them as a range from index 5.
Code snippet:
const { xValues, yValues } = generateData(50);
const dataSeries = new XyDataSeries(wasmContext, { xValues, yValues, isSorted: false });
sciChartSurface.renderableSeries.add(new FastLineRenderableSeries(wasmContext, { dataSeries }));
// this works
dataSeries.insertRange(0, xValues, yValues);
// this works
for (let i = 0; i < xValues.length; i++) {
dataSeries.insert(i + 5, xValues[i], yValues[i]);
}
// this fails
dataSeries.insertRange(5, xValues, yValues);
Codesandbox link: https://codesandbox.io/s/scichart-js-boilerplate-forked-hokfcn
I wonder if I’m doing something wrong or if this is an actual issue?
Side note: Index 5 is just an example, because it seems I can use the insertRange
method when inserting to index 0-2, but it fails when inserting to index 3+ (in case of a chart with 50 existing data points)
- Timo Betina asked 2 years ago
- You must login to post comments
Hi Timo,
Thank you for the bug report & info. The codesandbox is very useful. Top marks!
Good news, we’ve found & fixed an issue in the low-level memory buffers for XyDataSeries which was causing this memory access out of bounds
error.
This has been pushed to our production branch and will be fixed in the next release (version > 3.0.284). Timescale: probably about a week or two at the most.
In the meantime, if you add this workaround:
// WORKAROUND. NOT FOR PRODUCTION
// before xyDataSeries.insertRange(index), reserve extra memory
dataSeries
.getNativeXValues()
.reserve(dataSeries.count() + index + xValues.length);
dataSeries
.getNativeYValues()
.reserve(dataSeries.count() + index + yValues.length);
// Now do the last insert
dataSeries.insertRange(index, xValues, yValues);
This should work until the release. You want to remove that as soon as we publish!
Best regards,
Andrew
- Andrew Burnett-Thompson answered 2 years ago
- last edited 2 years ago
- You must login to post comments
Hey Andrew,
That’s great! Thank you for fixing it and for letting me know about the workaround!
Best,
Timo
- Timo Betina answered 2 years ago
-
Hi Timo, version 3.0.300 has been released which addresses this issue. Please try it out & remember to remove the workaround above https://www.npmjs.com/package/scichart/v/3.0.300
-
Perfect! Thanks for the update.
- You must login to post comments
Please login first to submit.