Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
xamDataChart performance poor?
posted

Hello,

I am evaluating charting controls for my company, and I put together a simple demo project.  When I ran the project with the xamDataChart, the performance was very very poor (> 20% CPU usage).

The chart has one line series bound to an ObservableCollection data source.  Data points are added at 10Hz, and after only 150-200 points are added, the performance has already deteriorated. 

Am I missing something?  The project is very simple.

Valerie

infratest.zip
Parents
  • 30692
    Suggested Answer
    Offline posted

    Valerie,
    There appears to be a performance issue currently if your data is overly randomly fluctuating in the y direction.
    Compare the performance you get if you use this update function instead which results in the line being more "line" like.

            private void Timer_Tick(object sender, EventArgs e)
            {
                timer.Stop();
    
                if (random.NextDouble() > .5)
                {
                    curr += random.NextDouble() * 3.0;
                }
                else
                {
                    curr -= random.NextDouble() * 3.0;
                }
    
                data.Add(new DateTimePoint(DateTime.Now, curr));
    
                timer.Start();
            }
    


    This seems like it could actually be an inefficiency in WPF's rendering engine as we don't see this problem in the Silverlight version of the chart.
    Is your actual data likely to actually look like this (each figure having absolutely no relation to the last)?
    Or was this just the fastest way to get a test up and running? I think the update function above produces a more real-world scenario, but maybe your case is different.

    We are currently investigating why WPF is performing aberrantly for this case. You can reference bug number 56921 if you want to check the status.

    If you do actually need to display a line as wildly fluctuating as in your sample, you have a few options you could use to improve the performance and readablity.
    1) you could perform a smoothing function on the data before providing it to the chart
    2) you could increase the Resolution property of the chart to a higher value. This has the effect of allowing the chart to coalesce increasingly large samples of points into a shape that just expresses their max and min, effectiving reducing the number of points WPF is asked to render.

    That being said, WPF normally has no trouble keeping up with rendering the line at Resolution = 1. But something is different about this kind of line shape, that we are currently looking into.

    Hope this helps!
    -Graham

Reply Children