I’m creating a web application in which I have a little bit over a million data points. When toggling annotations (about 4000) on one of my charts I noticed the memory usage of Chrome was doubled. I did some tinkering and found out this behaviour only occurred when I had “strokeDashArray” set in my VerticalLineAnnotations.
for (let i = 0; i < 5000; i++) {
const line = new VerticalLineAnnotation({
x1: i,
strokeDashArray: [5, 5] //If this is removed then the memory usage drops
});
sciChartSurface.annotations.add(line);
}
Is there a known memory problem with dashed lines or anything I might do wrong?
- Niklas Ã…kerlind asked 7 months ago
- You must login to post comments
Hello. Currently, some amount of memory increase is expected in this case.
There are potential optimizations we can apply in the future. Or maybe some alternative solution using Renderable Series could be applied.
First of all we need to understand a bigger pciture of what you are trying to implement. Like: the reason why youn need 5000 annotations?; If all of those vertical lines should have the same style?; etc.
You can contact us via the Support Desk for assistance and deeper requirements analysis.
- Jim Risen answered 7 months ago
- You must login to post comments
I’m using SciChart to display ECG data. In the use case I experienced the memory problem I created a chart from a ~40 minutes ECG. Each vertical line annotation is used to indicate a beat. All lines look identical and the only thing differentiating them are the x1-values.
- Niklas Ã…kerlind answered 7 months ago
- last edited 6 months ago
-
Since you have the same style for all of them, I could suggest using a customized annotation that shares a Pen for drawing. Check out the example here and let us know if that makes a difference for you: https://codesandbox.io/p/sandbox/annotationswithsharedpen-one-to-draw-them-all-3qxghw?file=%2Fsrc%2FdrawExample.ts%3A60%2C6
- You must login to post comments
Please login first to submit.