Pre loader

Performance with lots of annotations….

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
3
0

…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?

  • You must to post comments
Best Answer
4
0

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

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies