Pre loader

Line with Text ( No Annotation)

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
0
0

Hi :

I use annotation to write text on the Surface ,but there is a problem . If it have a large amount annotations ,it will cost many time and CPU. How to draw the graph like my expmple?
I hope that have a good performance at large amount points which have a number on each point.

Thanks for any help!

Images
  • You must to post comments
Best Answer
0
0

Hi there,

Please see our FAQ Performance with Lots of Annotations

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.

Another option for you to draw numeric values at points is to create a custom PointMarker. Take a look at Insane WPF Scatter Chart performance with Parallel Rendering which has an example how to create a custom BasePointMarker derived type.

Next, have a look at our documentation on CustomRenderableSeries / RenderContext2D. There is a method IRenderContext2D.DrawText which allows you to draw text using our (very fast) raster bitmap engine.

So putting it all together, try a Custom PointMarker which draws text, and apply the pointmarker to your chart. It should work, and should be very very fast.

Best regards,
Andrew

  • You must to post comments
0
0

Hi :
I follow the code in FAQ Performance with Lots of Annotations. I found that SuspendUpdates in my code is useless. It didn’t improve performance.
Do I have anything wrong in my code?
And there is another problem ,that UI have 5~10 second dely since my Debug.WriteLine done.

Have suspend :

using (sciChart.SuspendUpdates())
        {
            var myAnnotations = new AnnotationCollection();
            for (int i = 0; i < 100000; i++)
            {
                var a = new BoxAnnotation
                {
                    XAxisId = "XAxis1",
                    YAxisId = "YAxis1",
                    X1 = i,
                    X2 = i + 1,
                    Y1 = i,
                    Y2 = i + 1,
                    Background = Brushes.Yellow,
                    Foreground = Brushes.Black,
                };
                myAnnotations.Add(a);
            }
            sciChart.Annotations = myAnnotations;
        }

No suspend :

var myAnnotations = new AnnotationCollection();
        for (int i = 0; i < 100000; i++)
        {
            var a = new BoxAnnotation
            {
                XAxisId = "XAxis1",
                YAxisId = "YAxis1",
                X1 = i,
                X2 = i + 1,
                Y1 = i,
                Y2 = i + 1,
                Foreground = Brushes.Black,
                Background = Brushes.Brown,
            };
            myAnnotations.Add(a);
        }
        sciChart.Annotations = myAnnotations;

I use Stopwatch to measure time. Suspend’s time is similiar to No-Suspend.
There are two image to prove it.

Thank for any help.
Best Regards

Images
  • Andrew Burnett-Thompson
    Hi Xuan, maybe I wasn’t clear. What I was trying to say was that Annotations are going to be 10x – 100x slower than using our Bitmap engine to draw text. You can use our bitmap engine by creating a custom PointMarker. Please take a look at my answer again above and follow the links to the Custom PointMarker/ CustomRenderableSeries API. Best regards, Andrew
  • JiaRong Kang
    Hi Andrew, I got it. I will try custom PointMarker to draw text. Thanks for your answer!!!
  • You must to post comments
Showing 2 results
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