…sucks. Likely a programming error.
Trying to show a larger chart which has 16000 annotations on it. Besides that being a programming error at this point – we do / will have zoom out charts with that many data points.
I spend minutes, literally, in
Annotations.Add – no way to add an enumeration of them.
SuspendUpdates
has been called around this – so updates SHOULD not happen, but it seems there is a lot of overhead here.
What is adviced?
Besides that slowness in creating the chart, it is also (very) slow to change sizes etc.
Any advice for a heavily annotated chart?
- NetTecture asked 11 years ago
- You must login to post comments
Hello there,
The Annotations feature in v1.5 uses UIElements. These are very flexible (as they are WPF elements) but are also very slow compared to the bitmap rendering that we employ in SciChart.
We did have a user once who added 50,000 annotations to a WPF SciChart. It did take a few seconds to redraw but it did perform. We got his performance down from minutes (like you) to a few seconds by using the following code:
using (sciChartSurface.SuspendUpdates()) { // Create temporary AnnotationCollection var myAnnotations = new AnnotationCollection(); double minx = double.MaxValue; double maxx = double.MinValue; foreach (var c in cmdList) { if (c.X < minx) minx = c.X; if (c.X > maxx) maxx = c.X; var a = new BoxAnnotation { // Assign X1,Y1, Background etc... }; myAnnotations.Add(a); } // Reassign annotation collection sciChartSurface.Annotations = myAnnotations; sciChartSurface.ZoomExtents(); }
Assigning the annotation collection in one go will prevent internal updates/redraws occurring on each add. Please try this and let me know if it helps.
Thanks!
Andrew
- Andrew Burnett-Thompson answered 11 years ago
-
Why is Annotations property read-only in the ISciChartSurface interface?
-
Probably an oversight. Try casting to SciChartSurface?
-
I am having a similar issue with Annotation performance even with the recommended “fix”. I have only tested on around 1000 annotations but it takes around 5-10 seconds and 3000 takes around 25 seconds. I am trying to create movable labels for my XY scatter plot. I was drawing the label before by extending the BasePointMarker and that was taking less than 1 second. Even just looping through the annotations and updating the font size takes several seconds. Any thoughts?
-
Only thoughts are don’t use Annotations for large numbers of objects. Instead you must use our RenderContext API to draw on the chart. If you want the points to be moveable, consider a custom ChartModifier, such as this: http://support.scichart.com/index.php?/Knowledgebase/Article/View/17239/32/custom-chartmodifiers—part-5—select-and-drag-a-data-point. Code for this modifier is found here: https://github.com/ABTSoftware/SciChart.WPF.Examples/tree/master/v5.x/Sandbox/UsefulExamples/Examples/CustomModifiersSandbox
- You must login to post comments
Please login first to submit.