|
Clear Data Accelerator |
Posted by Ben on Jul-16-2022 03:05 |
|
Hello!
I'm looking to use Chart Director in a live plotting situation and have come across the DataAccelerator for large datasets. This is perfect for my use case.
My question regards the best way to clear the data accelerator to plot different data? For example, we will we recording data using the data accelerator for a period of time. Once data recording is over I want to 'clear' the data in the data accelerator and plot other data. What is the best way to do this? I have noticed in the documentation that the data accelerator's length can only be extended. I like the data accelerator for its proposed speed benefits but am unsure if this is the best object for my use case.
In short, the data on the chart will constantly be changing from static data to live data.
Thanks! |
Re: Clear Data Accelerator |
Posted by Peter Kwan on Jul-18-2022 14:06 |
|
Hi Ben,
The data accelerator cannot be cleared. The best way to record new data is to create a new data accelerator and delete the old one.
When you use the data accelerator, you need to provide the data arrays to the data accelerator. The data accelerator does not copy the arrays. It just keeps references to them so there is negligible overhead. You can reuse your arrays if you like. You do not even need to clear your arrays. Just pass the same arrays to the data accelerator and tell the data accelerator that their lengths are 0. This avoids having to reallocate large arrays.
Best Regards
Peter Kwan |
|