Showing results for 
Search instead for 
Did you mean: 

Trying to graph user enabled channels

Go to solution

Hi, I've been working on a graphing project, mostly to expand my knowledge of Labview. Ultimate goal is to accept up to 12 thermocouple channels, with user defined names, that is then sent to graph to show the user selected channel data displayed on y axis with time on x axis. Duplicate channels get error message.


What I've done is a mess and completely over complicated. I'll attach it though so you can see where I'm coming from. My knowledge of data flow is OK and I'm learning about property nodes and event structures. I am lacking in arrays and how to manipulate them. I've gone through lots of tutorials but just need to try to figure it out and learn from mistakes. It's the only way things stick for me.


So, check out the train wreck of a VI and please offer suggestions. I haven't even gotten channel names to transfer and I put some x boxes in in hopes that that would delete the channel details. Thanks!

0 Kudos
Message 1 of 11
When the user names a channel assign that name the the channel in the task.

Plot all 12 channels on your graph. SHOW the graphs plot legend (that niftily picks up the plot names from the tasks channel names.) In the plot legend SHOW the visibility checkboxes. That turns each plot on and off on the graph.

Don't roll you own code! LabVIEW and DAQmx work quietly under the hood to give you exactly what your user wants anyway.

"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 11

Thanks for the comment. Do you have a VI to demonstrate as an example (or two... or twenty) ?

0 Kudos
Message 3 of 11

Unfortunately, LabVIEW for Android doesn't exist. So, I have to use the 1000 words.

Unfortunately, there really aren't any really good shipping examples so let's play follow along .  Note: there are other ways to do this but I want you to get familiar with a few tools.


  • Create a simulated device

  • Create a temperature task using multiple channels with continuous sampling. 
  • Name your channels 
  • Save


  • Drop a DAQmx task constant on an empty Block Diagram and select your Task
  • Right-click the constant and Generate Code ( configuration and example)
  • Sip coffee and put your eyes back into your head 
  • Create a waveform graph on the array of wave forms out of DAQmx Read [n ch n sample 1D WFM]
  • From the graph show plot legend 
  • From the plot legend show plot visibility checkbox  and expand the legend to show all your tasks channels 
  • Run the vi

The plot names populate with the channel names from MAX and each channel has a simulated sine wave output.


You can even retarget the Task to Actual Hardware later. And even enable Data logging in DAQm xxv to write the signals to a TDMS file on the fly.


DAQmx and LabVIEW really play very nicely together.   It's like someone thought about how to make common use cases simple enough for a caveman.

"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 11

Ok, So I integrated DAQmx into the process and it works.


But, the original question still stands. What is best method to have user-enabled channels with duplicate checking before it gets to error handling? This code only has three channels, but represents the issue (I hope to scale to max 12 channels): If the user only enters two channels - fine, it graphs only two channels. If they duplicate the name of the two, it should alert them before going on. Suggestions?

0 Kudos
Message 5 of 11

DAQmx won't let you duplicate channel names.


Of course,  you COULD just steal the channel list editor that the DAQmx Wizard uses.  It should be written in LabVIEW and located in the LabVIEW installation\wizards folder.   I would hope it is not password protected.   

"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 11

I'm not using the DAQmx wizard as the program needs to be flexible enough to be used in different locations with anywhere from 1 to 12 thermocouples and allow the user to select which channels to make active and give it unique channel names. See VI.

0 Kudos
Message 7 of 11
Unfortunately, you did not add a snippet as an image inline with your post. There is no LabVIEW viewer for Android.

"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 11

Let's give this a try. Area that needs work is yellow highlighted. Currently uses controls, trying to figure out how to create a selection of empty fields; user selects which and how many channels to create and gives channels name. Program alerts for duplicates before error handling catches it.



0 Kudos
Message 9 of 11
Accepted by topic author Triplett

Make a table/listbox, populate with all the available channels. Have a column to enable/disable channel, and a name column. When user enters a name, check for duplicate names. Something like below:



The user can change the name from the standard to whatever they want.


You seem new to LabVIEW, so that may be a little advanced for a beginner. Instead of a table, you can make a cluster and modify it to look like a table.





0 Kudos
Message 10 of 11