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
Hi,
There's a different set of assumptions that we can make about line series because each point is gauranteed to have a greater x value than the previous point. This allows us to make many simplifications to the geometry and data processing that you can't see because of the resolution of the chart.
With a scatter series, some of these assumptions do no apply. There are still simplifications that we can make, but the data is less constrained in shape than the data for the line series. And so there is a markedly different set of techniques that we use to get good performance from the chart. In particular you can end up with more markers being displayed for a scatter line than for a line series. And if you don't need the markers, you may want to turn them off, as they are one of the more expensive parts of the display. The resolution property of the series can also be increased to make the graphics less faithful to the underlying data, but possibly better performing.
It all boils down to your data. If you have data that monotonically increases in x value, I would suggest using the line series, for greater performance, unless there is a specific reason why it doesn't work for your case.
We are always looking for ways to further improve the performance of the scatter series, also, but it seems to be a less good fit for retained mode rendering than the category series (line, area, etc) that we provide. You will see some similar performance disparity between the polar series (similar to scatter) and the radial series (similar to category). Again due to the differences in how the data is constrained.
If you provide more information about the data and updates you are trying to use (a sample?) with the Scatter Line series we can see if there is anything specific we can do to improve the performance of that scenario.
Hope this helps!
-Graham
Hi!
I've created a simple test application using BubbleSeries in the xamDataChart in SIlverLight.
If I am trying to draw 10000 points then it takes from 8 to 15 seconds
If I trying to draw 20000 points then it takes from 30-50 seconds
Is it the regular performance or I am doing something wrong?
Hi Graham,
Thanks a lot for your quick answer.
In my scenario I can use line series instead of scatter line series, so it's all good for now. I was just curious about the performance difference, but thanks a lot for your offer.
Kind regards,