x-axis autoscroll

Oct 12, 2011 at 10:19 PM

Hello,

First of all, thanks for the great job with this library.

I'm a beginner using it and I´m trying to generate a plot with an auto scrolled x-axis as the first step for generating a real time plot that automatically advance in the x-axis as the new data comes in.

I´ve tried setting the Viewport.Visible property of the ChartPlotter every time I need to move on the axis but, as I´m going to have 300 new points per second, it gets the CPU usage to 100% instantaneously and keep it up untill I stop the auto scrolling.

Can anybody help me with this?

Thanks

Oct 13, 2011 at 3:54 AM

Hi,

Seperate History points and current points, Make as two lines one for history and one for current values. DDD updates the lines and points seperately, use "RaiseDataChanged();"  this updated only the current points and this will not load CPU(This is not like treditional chart, this will update only the new points)

Draw x axis( viewport) with 1 or 2 minutes buffer. Every time when the buffer is over remove the lines from chartarea( do not try to clear and add data again to the same line, this will cause some perforamce degrade, this I observed).

Regards

Ravi.


Oct 13, 2011 at 2:01 PM

Ravi,

Thank you for your almost immediate help. I´m not sure if this will work for me because I need an x axis range of about 3 seconds so I wont be able to draw the axis with 1 or 2 min buffer, anyway I'm going to try it. Nevertheless I think I can use the separate history points and current points thing.

Thanks again

Regards

 

Oct 13, 2011 at 5:25 PM

Unfortunately, this library and WPF don't work well with real-time drawing updates. There are a couple of reasons you are seeing 100% CPU usage.

First, the collections used to update the data create Enumerators for the points each time you change the dataset, which in turn, cause a lot of garbage collection.

Secondly, WPF uses retained graphics to render. This means that when there is the slightest graphical change in the UI, it has to compsite the changes with the rest of the graphical area and then send it back to the GPU for rendering. This is the reason that it cannot handle rapid geometry updates, such as drawing thousands of polylines, very well.

Fortunately, I have done a lot of work to address this problem using a DirectX solution to merge immediate mode drawing of geometry with WPF. You can download the project here: http://d3commdev.codeplex.com/discussions.

It is not well documented, so let me know if you need any help with it.

Oct 13, 2011 at 6:58 PM

Jason,

Thanks for your advice. I've checked the project web site (http://d3commdev.codeplex.com/discussions.) and I'm going to try it but I'm not sure if it will work for me since my proyect involve desktop and web versions of the aplication and I would like to use the same plotter in both.

Thanks again

Regards

Oct 13, 2011 at 7:14 PM

It currently only works for WPF and I am not sure if it could be ported to Silverlight easily, but it might be worth looking at.