09-15-2017 11:19 AM
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.
Solved! Go to Solution.
09-16-2017 06:34 AM
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.
09-16-2017 09:20 AM
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?
09-16-2017 09:45 AM
@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.
09-17-2017 09:09 AM
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).
Bob Schor
09-18-2017 07:57 AM
Bravo...thank you ever so much.
Bill