Slow to graph

Nov 9, 2011 at 7:11 PM
Edited Nov 9, 2011 at 8:38 PM

I'm attempting to graph live data. From everything I read, it seemed like D3 would be a good choice. I believe that I'm using the "recommended" version of D3.

However, it lags terribly when it graphs the data. So much so that it freezes up the application very quickly. I'm only receiving 10 bytes of data at 1200 baud over serial. The data is converted to Int32s, and only three of those are being graphed (against time, on three separate graphs).

Entirely possible that my code is really, really slow. But I've also seen discussion posts where people have mentioned slowness as an issue.

 

Thanks for any help.

 

Edit:

Second question, so I can use the nightly build. When I try to build the solution in the nightly, it gets errors:

The type 'System.Threading.Tasks.Task' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' and
 'c:\Users\Leah\Downloads\D3\Nightly\DynamicDataDisplay Sources v0.3.4703.0\lib\System.Threading\System.Threading.dll'
C:\Users\Leah\Downloads\D3\Nightly\DynamicDataDisplay Sources v0.3.4703.0\src\DynamicDataDisplay\Common\Auxiliary\TaskExtensions.cs 18 48 DynamicDataDisplay

I tried removing the reference in the nightly folder, but then a new error crops up (no definition for TaskContinuationKind). I have no idea what to do to fix this.

Nov 15, 2011 at 1:42 PM

Hi,

I've tried D3 for real time plotting in several ways and it always get laggy...after some research, I have found many posts in several forums saying it can be one

of the D3 weaknesses or even one from WPF...maybe you should try other plotting solutions like MSChart or ZedGraph (you can encapsulate it in a WPF aplication)...

in any case you shoud keep your graphing code as clean and optimised as posible and try to use different data sources for history and new points...good luck!

Nov 15, 2011 at 3:20 PM

Turns out the majority of my code was fine. It was mostly just how I was storing the data points to be displayed (the MSDN magazine article about D3 - not the way to do things for live data). For the most part, I only need to record/display live data for about ~1 minute at a time. In one of the D3 examples I found a way of storing the data points that allows me to get the performance I need. Or, well, most of the performance.

To my great pleasure, this code will only be needed for another 3 weeks or so, and then I can forget I ever wrote it. ;p

Nov 22, 2011 at 1:59 PM

lmworster,  could you please tell me which example did you use?  also, is there a link to MSDN article?

Nov 22, 2011 at 2:47 PM

Never mind about the link, i believe you you meant this one http://msdn.microsoft.com/en-us/magazine/ff714591.aspx

But if you could point to the example that would be great!

 

Thanks!

Nov 22, 2011 at 11:54 PM
Edited Nov 22, 2011 at 11:56 PM

Yeah, that's the article.

The example I mentioned is called "DynamicPointAddSample." Its location is: dynamicdatadisplay-31108\Nightly\DynamicDataDisplay Sources v0.3.4703.0\src\Samples\Simple\DynamicPointAddSample

http://pastebin.com/Tn9RHY2b - pastebin of the relevant lines from my own code.

 

Edit: Forgot to say, the pastebin code will be live for a month.