Draw annotation with 3600*10 datapoints

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

sharethl wrote at 2013-05-22 20:08:

I learnt that this library's performance is good, but when I try to use it draw an annotation, it reacts slowly when data points exceed about 600. For a 10 hour * 3600 dp/hour plot, it is impossible to draw an annotation smoothly.
What I did is :
  1. mouse down creates an arrow annotation,
  2. mouse move updates end point of arrow, and invalidateplot(false).
  3. mouse up releases arrow.
    All this is in PlotModel class, not wpf plot.
Is there any way to improve performance? And may be this library is not suitable for plot drawing?
Each plot contains 600 datapoints.
Image
Thanks.

sharethl wrote at 2013-05-29 20:08:

Modified Performance Example in sample examples, found it is hard to handle random data.
Instead of drawing sin cos data, I tested with Random data.

In Example_Browser->PerformanceExamples.cs
Plot freeze.

I believe it is WPF's limit.
private static void AddPoints(IList<IDataPoint> points, int n)
        {
            //for (int i = 0; i < n; i++)
            //{
            //    double x = Math.PI * 10 * i / (n - 1);
            //    points.Add(new DataPoint(x * Math.Cos(x), x * Math.Sin(x)));
            //}

            int dataCounts=n;
            var rnd = new Random();
            for (int i = 0; i < dataCounts; i++) {
                var dp = new DataPoint(i, rnd.Next(0, 65000));
                points.Add(dp);
            }

        }

objo wrote at 2013-06-08 11:26:

This is a worst-case graph you are showing, it not easy to optimize drawing of that green LineSeries :-)
Ideally only the annotation should be updated.
This is also discussed in https://oxyplot.codeplex.com/discussions/444229

Modifying annotations is easier than modifying series, because no other objects of the visible model will be affected. It could be a solution to add an Invalidate method on the Annotation class. I added https://oxyplot.codeplex.com/workitem/10052