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
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 chart2) 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
I am also investigating the XamDataChart and was surprised by the performance difference when using ScatterLineSeries versus LineSeries ( I am using the trial version 10.3). I made the following tests and could see the performance considerely dropping with ScatterLineSeries:
Case 1: 1 XamDataChart with 4 ScatterLineSeries with each 25000 points (double, double) that get updated every 5 seconds (NumericXAxis and NumericYAxis).
Case 2: 3 XamDataCharts with each 4 LineSeries with each 25000 points (DateTime, double) that get updated every 5 seconds (CategoryDateTimeXAxis and NumericYAxis).
In the 1st case, the UI thread is blocked a lot when rendering the chart which makes the UI almost unusable, while in the 2nd case, in spite of the number of charts and lineseries, it's faster and updates are barely visible.
Is this a known performance observation with a known explanation or what can I do wrong that create such a difference?
Thanks a lot
Carole