SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

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

  • magnusm
    Why is Annotations property read-only in the ISciChartSurface interface?
  • Andrew
    Probably an oversight. Try casting to SciChartSurface?
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.