From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display multi lines in XY graph?

Solved!
Go to solution

Hi all,

 

I hope to display and save multi lines at one time in XY graph, but with the sub-vi from the manufacture, I only can display and save one line one time. E.g, if the typed number in both area number to display and number of areas are 5, I hope to display all the 5 lines in XY graph once, rather than the number 5 line in XY graph.Or if the typed number in  number of areas is 5 and the typed number in area number to display is 3, I hope to display 3 lines in XY graph once, rather than the number 3 line in XY graph. The Pixel vi is just a unit conversion vi. The array, acquire, and reform area vi are the sub-vi used in the main vi (test.vi), the sub-vi is provided by the manufacture. I got data from the spectrometer by its sub-vi(acquire) directly, and the data is a 3D array, Accumulation, Number and Pixel. Accumulation means how many times to detect the spectra and the final result is the summation of these. Number (Number of Areas in test.vi) means how many area to divide the CCD and how many lines will get in one detection. Pixel is the CCD's pixel (corresponding to x value). Spectral Reformat CCD area is to divide the CCD in some areas(the number depending on the number in number of areas box). My labview version is 2014.

 

I post a same question before, but it seems I did not explain my question clearly. Now, I post it again with a more clear explanation. Can anyone help me? Thanks.

0 Kudos
Message 1 of 18
(5,302 Views)

Are you trying to add multiple plots to an XY graph?

 

To get a single plot, you can take a cluster of two arrays, x data and y data.

 

To get multiple plots, you build the single plots into an array. So you have array of cluster of 2 arrays. Every time you write to the XY graph, the previous data is removed and the new data is written.

0 Kudos
Message 2 of 18
(5,264 Views)

Displaying Multiple Plots on Waveform Graphs

right in the Help file---go figure


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 18
(5,259 Views)

Your problem is much deeper than just plotting. You really need to look at some tutorials and learn basic programming principles. Obvious race coditions, blatant overuse of local variables and blatant overuse of sequence structures and incorrect use of events stick out by just glancing at some of your VIs. I would also recommend to stick to typical connector panes for subVIs.

 

Test.vi:

  • Is this the toplevel VI?
  • How do you run it? Why doesn't it have a while loop? (are you using "continuous run"? 🐵
  • Does it matter which independent section runs first?

 

Pixelh.vi

  • Why is the diagram and front panel maximized to the screen? Very annoying!
  • How many times do you think you need to convert the same angle (-5.5, 21.26) to radians? Wouldn't once each be enough?

Spectral reformat CCD area:

  • What is the purpose of the sequence structure? delete it!
  • Eliminate all locals and wire from the controls.

Array reset dimension:

  • We already told you how to simplify that long ago.

 

MultiAccu-acquire spectral:

  • What a birds nest of code! Who wrote this?
0 Kudos
Message 4 of 18
(5,252 Views)

Hi, 

 

The Test.vi is the toplevel VI. I simplified the whole VI, this vi is used to control a spectrometer, and other parts in this vi are used to set the parameters of the spectrometer and have no effect on the detecting and displaying process, so I delete them in this version, otherwise this vi would be a little huge. In the upload version, the reform function should run first, and then the acquiring, displaying.

 

Pixelh.vi

  • Why is the diagram and front panel maximized to the screen?  I cannot understand this question, sorry...
  • This vi is used to convert x-label from pixel to wavelength, and based on some formula, we do not need to care about this. The acquisition x-value from the spectrometer is pixel,  so I need a conversion.

Spectral reformat CCD area, Array reset dimension and MultiAccu-acquire spectral are the sub-vi from the spectrometer manufacturer..

 

Thanks,

Mei

 

0 Kudos
Message 5 of 18
(5,226 Views)

I'm still not clear on what your question is, I don't think you've succeeded in explaining it more clearly this time. Can you be more specific about what you don't understand how to do? Is it creating the plot that you need help with, or separating out the data that will go into the plot from the rest of your data, or some other step?

0 Kudos
Message 6 of 18
(5,218 Views)

Hi, my detection process as follow,

First, I can divide the ccd into some areas by Spectral Reformat CCD area.vi, e.g we divided the ccd into 5 areas. This photo shows the divide areas on the ccd. The areas on the left one is 1, and the right one is 5. Each area gets one line.

Capture11.jpg

Second, I get the detection data by the MultiAccu - Acquire spectral.vi, every area of the ccd would generate one line. In the above photo, the left one would generate 1 line, and the right one would generate 5 lines originally.

Last, I can plot one certain line in the xy graph by using the Array reset dimension.vi no matter how many areas the ccd divided, e.g if the area number to display is 3, the number 3 line (corresponding area 3 on the ccd) displays in the xy graph; if the area number to display is 5, the number 5 line (corresponding area 5 on the ccd) displays in the xy graph.

 

My question is:

I hope to display and save all lines on the ccd at one time when the number of areas is not 1. E.g if the area number to display is 3,all the three lines  (number 1,2,3 line) (corresponding area 1,2,3 on the ccd) display in the xy graph; if the area number to display is 5, all the five lines  (number 1,2,3,4,5 line) (corresponding area 1,2,3,4,5 on the ccd) display in the xy graph.

Thanks,

Mei

 

0 Kudos
Message 7 of 18
(5,213 Views)

@M.Mei wrote:

 

Second, I get the detection data by the MultiAccu - Acquire spectral.vi, every area of the ccd would generate one line. In the above photo, the left one would generate 1 line, and the right one would generate 5 lines originally.

 

 


 

So what is x and what is y? What is a "line" (e.g. average intensity of all Y pixels for each area as a function of distance from the left edge?

In that case, all plots share an equally spaced x-axis and all you need is a waveform graph. Why would you need an xy graph?

0 Kudos
Message 8 of 18
(5,204 Views)

@altenbach wrote:

So what is x and what is y? What is a "line" (e.g. average intensity of all Y pixels for each area as a function of distance from the left edge?

In that case, all plots share an equally spaced x-axis and all you need is a waveform graph. Why would you need an xy graph?


X from the MultiAccu - Acquire spectral.vi is ccd pixel, it's equally spaced x-axis, and I used the pixel vi to convert the x-value from pixel to wavelength. Y is the signal intensity.   A "line" means summation intensity of all Y pixels for each area.

All plots share an equally spaced x-axis, I used xy graph because I want to convert x-value from pixel to wavelength.

I do not know how to take out all y-value of every areas to display and save them one time

 

Thanks,

Mei

 

0 Kudos
Message 9 of 18
(5,196 Views)

Here how multiple data sets are shown on XY graph (check out the attached vi). You can add more [XY] data sets and connect them to the array so that it will also be shown on the XY graph.

Senior Software Developer
0 Kudos
Message 10 of 18
(5,184 Views)