LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to plot large number of independent lines on 3D Line graph?

Solved!
Go to solution
Highlighted

How to plot large number of independent lines on 3D Line graph?

Hi LabVIEW Community,

I'm struggling with the proper way to plot a large number of independent lines on 3D.

 

  • My setup: LabVIEW 2017 64 bits (required by data and external libraries).
  • Objective: Plot a large number of lines (6000 for this example). Each line is described as an independent segment with the start-point and end-point coordinates. The lines are not continuous between them, but I have included an example with continuous lines to reproduce the problem and simplify the code.
  • Problem: Drawing 6.000 lines on the 3D line graph freezes the system (tested on LabVIEW 2016 64 bits, 2017 64 bits,2017 32 bits).

 

Please find attached a simple code to reproduce the problem. In this example, the 3D line graph is used to plot a single line described by 6000 points with excellent performance. However, my objective is to plot independent lines without connection between them, so the second 3D line graph is intended to plot the same line with this approach. In this context, 6000 line objects are stored in the graph array in short time (25 ms approx.), but the LabVIEW interface freezes for a few seconds (5 s approx.) when the indicator is fed with the data. The poor performance of the 3D line interface produces an unusable application.

 

As the same line is rendered for this example, both figures should have similar computational time. I'm wondering if there is some computational overhead when multiple objects are plotted.

 

How can I tackle this obstacle and achieve the goal?

 

Thanks to all in advance.

0 Kudos
Message 1 of 8
(882 Views)

Re: How to plot large number of independent lines on 3D Line graph?

Well, I can't look at your code, but I would expect plotting 6000 lines to take, as a first approximation, 6000 times as long as to plot one line.  In the 6000-line case, you provide two points and ask LabVIEW to "connect the (2) dots" 6000 times, giving new end-points each time.  In the 1-line-of-6000-points case, you provide the points and ask LabVIEW to plot 6000 points, interpolating between them.  Depending on the "inner workings" of the "connect-the-dots" algorithm, the timing should be longer with separate lines (maybe not 6000 times, but certainly longer ...).

 

Bob Schor

0 Kudos
Message 2 of 8
(853 Views)

Re: How to plot large number of independent lines on 3D Line graph?

Hi Bob, thanks for your reply.

That means that there is no way to plot a large number of independent lines (3D) on LabVIEW? Other platforms seem to be very competitive in this matter.

Do you need a copy of my code on another version? (I have included 2017, 2016, 2015)

Thanks and have a nice afternoon.

0 Kudos
Message 3 of 8
(812 Views)

Re: How to plot large number of independent lines on 3D Line graph?

Oops, didn't see the multiple versions -- I'll look at the 2016 one.

 

BS

0 Kudos
Message 4 of 8
(794 Views)

Re: How to plot large number of independent lines on 3D Line graph?

I modified your code a little bit (to get better timing accuracy).  I didn't realize you were talking about 3D line plots (which are much more complex than 2D graphs).  Plotting one line of 6000 points takes about 113 microseconds.  Plotting 6000 lines of two side-by-side points takes 24,829 microseconds, roughly 200 times slower, but still pretty darn quick!

 

Here's my (revised) code as a Snippet  (LV 2016).  I'm using the High Precision Elapsed Timer ...

3D Line Plots.png

Bob Schor

0 Kudos
Message 5 of 8
(787 Views)
Solution
Accepted by topic author MiguelE
10-08-2017 07:54 PM

Re: How to plot large number of independent lines on 3D Line graph?

Try inserting NaN between lines X0,X1,NaN,X2,X3, ... Y0,Y1,NaN,Y2,Y3,... Z0,Z1,NaN,Z2,Z3,...

 

This creates 9000 points, but is still faster then 6000 plots...

 

For me:

Points: 0.14ms

Line plots: 34ms

Line with NaN 3.9ms

 

3D Lines.png

Message 6 of 8
(776 Views)

Re: How to plot large number of independent lines on 3D Line graph?

Hi Bob,

I was surprised by the slow refresh of the graph indicator in this case. The "Loop Time" is very short, but the LabVIEW environment is frozen for multiple seconds when it reaches the "3D Graph (6k lines)" indicator.

Thanks for your help and interest.

0 Kudos
Message 7 of 8
(740 Views)

Re: How to plot large number of independent lines on 3D Line graph?

Many thanks Wiebe! Your approach seems to be working with excellent performance.

0 Kudos
Message 8 of 8
(738 Views)