LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Superimposing an input onto an ongoing graph

Solved!
Go to solution

How does one add to a graph the instance of an enter key press event onto an ongoing graph?  A/D data is being plotted in real time and variables defining the experiment are changed in real time by numeric entry objects. I am trying to plot the time of the newly entered and changed number  onto the A/D data.

0 Kudos
Message 1 of 6
(2,584 Views)

You can:

Add a second plot to the graph (in an xy graph, and use Nan to separate the marks).

Use graph annotations.

Use cursors.

0 Kudos
Message 2 of 6
(2,529 Views)

Thanks for your consideration but being a struggling amateur, could you be a bit more expansive in your description  and consider it not for an x,y graph but an input(y),t chart?

0 Kudos
Message 3 of 6
(2,518 Views)

@BillMS wrote:

Thanks for your consideration but being a struggling amateur, could you be a bit more expansive in your description  and consider it not for an x,y graph but an input(y),t chart?


An input(y),t chart? You've made that up, but I get what you mean.

 

So you're adding data to the chart, sample by sample. Now if you don't wire a scalar to the chart, but an array, you should see two plots. See help for this. If the second element in the array is Nan, it won't show in the graph. Untill there's an event, then don't add a Nan, but a 1. This will show in the chart. You might want to change the second plot to bars for better looks.

 

I'm on a tablet, so can't make an example right now.

 

Cursors and annotations are probably a bit more tricky, because you'll have to manage their visibility.

0 Kudos
Message 4 of 6
(2,512 Views)
Solution
Accepted by topic author BillMS

If I understand what you are asking, you want to plot two channels -- an analog channel of data, and a "digital" channel that is 0 "almost always" but becomes 1 at the sample time that you push a key (or do something else).  To make it even simpler, let's say that the analog channel shows data in the range [-5, +5], and you'd like to have the "digital" signal appear just below the analog channel, say at -6.

 

OK, so to keep it simpler, we'll make a second Analog Channel to hold the "digital" data.  I'm assuming that the "normal" analog channel is an Array of Dbl (or a Waveform whose Array component is Dbl), and hence the "Key" analog channel also is of type Array of Dbl.  For every time point that represents "no key press" (i.e. for almost all of the points), use the value NaN (Not a Number), which has the interesting property that it does not show up or otherwise influence a Chart.  [To make a NaN constant, drop a Dbl constant and type "NaN" into the box].  Note that to see isolated points on this Key channel, you need to enable a "point plot" style for this channel.

 

This Snippet will plot every 10th point (I'm plotting 1, 2, 3, ... instead of, as I suggested above, -6, -6, -6 ..., but this is just to illustrate the idea).

Digital Points.png

Bob Schor

Message 5 of 6
(2,499 Views)

Bravo...thank you ever so much.

Bill

0 Kudos
Message 6 of 6
(2,479 Views)