Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Scattergraph plot line width problem.

Hello,

I have a program that is plotting 262,000 points for a plot.  The performance is fine except when I set the line width to "2" or greater.  Then my program comes to it's knees.  After about 45secs it comes back.

Try gen-ing up a quick program and check it out for yourself.  Put up a button to change line width to '2': scatterPlot1.LineWidth = 2;  Put up your performance monitor (Ctrl-Alt-Del) and minimize to watch CPU usage in systray.

        public Form1()
        {
            int _SizeArray = 262000;
            InitializeComponent();

            double[] x = new double[_SizeArray];
            double[] y = new double[_SizeArray];

            Random rand = new Random();

            for (int i = 0; i < _SizeArray; i++)
            {
                x[i] = (double)i/10.0;
                y[i] = rand.NextDouble();
            }

            xAxis1.Range = new NationalInstruments.UI.Range(0, _SizeArray);

            scatterPlot1.PlotXY(x,y);
        }

Also not that when it finally does come back, the visual y values for the plot are larger!

I am using XP, VS2005, MS8.01, Dual Zeon 3.0, 3 GB ram, high end nvidia graphics card.

Scott
0 Kudos
Message 1 of 6
(4,330 Views)
Hi Scott,

I just sent you an email with regards to the findings of R&D. For everyone else, the performance of the graph controls will be slowed down depending upon the amount of data being plotted. In this case, 262,000 points is a lot of data. To further increase performance, refer to the Measurement Studio Documentation on the topic "
Optimizing Measurement Studio Windows Forms Graph Controls in .NET"

Hope this helps!

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 2 of 6
(4,299 Views)
Hello again,

Why then does the LabView graph work much better?  It's the same company, you would think they would be running the same type of code.  What is the difference here.  We are trying to upgrade our user with a better system with .NET, C# and all and everything works great except for this NI Graph!

We can plot 10 plots of 262,000 points on LabView and it works pretty well, even with cursors.  With 10 curves on the Scattergraph ( with all optimizations set mind you) we move the cursor and the CPU maxes out immediately.  Then after 2-3 seconds the cursor moves!

What is the deal here anyway?  Why is LabView so much faster?

Hint:  Start your response with, "The LabView graph is faster because..."

Scott
0 Kudos
Message 3 of 6
(4,273 Views)
Howdy Scott,

It is a known fact that the LabVIEW graphs are faster and provide better performance than the Measurement Studio .NET graphs. LabVIEW graphs are all built from the ground-up by LabVIEW and thus we have full control over their speed and performance. The LabVIEW team has been greatly optimizing this graph over the past several years. 

Measurement Studio ActiveX graphs rely on GDI (Graphical Device Interface) which is a Microsft Windows standard for representing graphical objects. Measurement Studio .NET graphs rely on GDI+ which is an extension to GDI that adds new features and optimizing existing features.  Most graphics cards provide hardware acceleration of GDI primitives and do not provide hardware acceleration for GDI+. This is a general limitation of .NET and is not specific to Measurement Studio.

As you can see, LabVIEW uses its own technology while Measurement Studio relies on Microsoft's technology which means we have a harder time optimizing our graphs.

We do know that our ActiveX graphs are relativley faster than our .NET graphs so you could try using those graphs instead. 

Here is a link to using our ActiveX components in .NET.

Hope this helps!

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 4 of 6
(4,260 Views)
Thanks Jonathan for the explanation.  I tried the ActiveX control and it is even faster than the LabView.  I plotted 14 curves at 262,100 points each and used a cursor and it was really smooth.  A little slow on the resize but at 1-2 sec I'm not complaining.  We will go with it.  It's a little awkward to use programming wise than the .NET control but I can live with that.  As of 2 hours ago our project was dead in the water with very few options.  So I think we are good to go.

I would have thought that graphics cards would have provided support for hardware acceleration for GDI+ by now.  When do you guys think graphic card manufacturers will begin supporting this?

Thanks again for the help.

Scott
0 Kudos
Message 5 of 6
(4,248 Views)
Hi Scott,

I would suspect that manufactures would be integrating their support for GDI+ soon. Visual Studio 2005 came out sometime late last year (around December I think) so I would assume people want to keep up to date with Microsoft.

Anyway, I am glad everything is up and running.

Good luck with future projects!

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 6 of 6
(4,239 Views)