I have a performance issue in the sample Binding Real Time Data, when I change the random generated data.
I generate my random data as follows : min + (rng.NextDouble() * (max - min)) , where rng is the random object , min = 0 and max = 2* Math.PI.
The sample with these generated data is too slow. I already test other resolutions, but it still slow, and when I resize the window is realy lag.
I found this old post about xamDataChart performance http://www.infragistics.com/community/blogs/kiril_matev/archive/2011/04/07/tuning-the-xamdatachart-for-blazing-fast-charting.aspx with a sample, but this sample is slow too. Why is xamDataChart sample so slow with other Kind of data ?.
Thank you
Hello Hans,
Thank you for your post.
I have been looking into it and I could not managed to reproduce the behavior that you have described. Would you please provide me with sample application where I can reproduce the behavior. I can suggest you take a look at the following link from our online documentation:
http://help.infragistics.com/doc/WPF/2014.2/CLR4.0/?page=DataChart_Chart_Performance.html
I created a short sample application based on your scenario, where I used CategoryXAxis and NumericYAxis and some LineSeries. I attached my sample application. If you are not able to reproduce the issue with the attached sample application, would you please modify it with the functionality, that you are using, so it reproduces the issue. This way I would be able to further investigate this for you and provide you with more detailed information on this matter.
If you require any further assistance, please do not hesitate to ask.
Thank you for your answer Nikolov. In your sample project in the File MainWindow.xaml.cs file , in the LiveDataViewModel constructor, could you comment out or delete :
if (r.NextDouble() > .5){ dat.Value1 = Data.Last().Value1 + (Min + (r.NextDouble() * (Max - Min))); dat.Value2 = Data.Last().Value2 + (Min + (r.NextDouble() * (Max - Min))); dat.Value3 = Data.Last().Value3 + (Min + (r.NextDouble() * (Max - Min))); }else{ dat.Value1 = Data.Last().Value1 - (Min + (r.NextDouble() * (Max - Min))); dat.Value2 = Data.Last().Value2 - (Min + (r.NextDouble() * (Max - Min))); dat.Value3 = Data.Last().Value3 - (Min + (r.NextDouble() * (Max - Min))); }
and write :
dat.Value1 = r.NextDouble() * Math.PI; dat.Value2 = r.NextDouble() * Math.PI; dat.Value3 = r.NextDouble() * Math.PI;
Than compile your project and start it, wait until all the values from ChartData.GenerateData Methhod were overwritten. Than try to resize the window and you will see that it is slow / lag.
Thank you again.
PS: Change the value for ChartData.GenerateData(50000) to 1000, that will be quick enough to see the change
I have been looking into the modified sample application and the behavior that you have described is expected. The reason for the behavior is that the in the data that you are each data point is not related to the previous , which causes the Path, that is the visual representation of the LineSeries. When the animations begins the Path is being re-renderd, which causes the performance issue. the same performance issue will appear if you are not using a XamDataChart and just draws a Path, with the same structure.
What I can suggest is to create a custom series, in your scenario is better to use ScatterLine representation. I created a sample application, to draw a bitmap image, instead of a path, which increases the performance of the series. Using a bitmap image allows you to draw all your data points without having performance issues. The custom series is drawn a ScatterLine. I have used a ScatterLine representation, since the bitmap image is a raster image and drawing canted lines will result in not well appearance. Using ScatterLine allow drawing the series with only straight line which appear as vector images and the appearance of the custom series is improved. The sample application is showing a custom approach that can be used as a guideline for implementing the functionality that you are looking for.
Please let me know if you need any further assistance on the matter.
Hi Nikolov,
Thank you again for your answer. I have already managed to draw diagonal lines with help of the WriteableBitmapEx class.
But now I see that the CPU reach almost 80% usage when the application window is maximazed. When I scale the window down,
it is only 40% cpu usage. Do you have an idea how to get better performance for the WriteableBitmap?.
I think this is just an issue from WriteableBitmap.
Thnx.
Hi,
I tried using the HigPerformanceScatterLineSeries but I always get Viewport.IsEmpty as true and RootCanvas as null. Hence it doesn't seem to draw anything. Can someone help here?
Thanks.
Ganesh
OKay figured out the problem. But it didn't seem to work that well compared to the default scatteredlineseries. It was slower and was more of a stepped line rather than a smooth line.