From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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 do I either set the channel Name of a cluster graph or get a 1D waveform graph to have different start times (t0) for each row of waveform?

Solved!
Go to solution

I have a unique 2D array coming out of a conditional indexing output of a loop such that most the rows of the array do not have the same size. - Basically they have different starting and ending points as well as sizes. - Not so concerned about the ending points because once i get the starting points correctly, everything else show fall in place.

 

The challenge is that when i try to have variable t0 (start time) for each row, the build waveform vi would always keep each row at the same starting point.

 

I have used the cluster approach successfully (the cluster approach ensures that each waveform starts at different times as per my defined t0 for each row) but then I am not able to get in the channel names which i was able to do using the waveform graph (build waveform) approach.

 

In essence what i gain here, i loose there.

 

 

Since I dont want any of my mentors especially, Bob and Altenbach to get fed up with me i have attached a  vi this time 🙂 🙂

 

 

Attached VI shows a combination of the two attempts (first with the waveform graph and second with the cluster graph)

 

1. With the first (waveform graph) i get my channel names as desired, but the alignment of the waveform is not correct.

 

2. With the second (Cluster graph) alignment is right but i cant get the channel Names into the graph even though they are present in the cluster.

 

I have read up some write-ups which mentioned that attributes can only be displayed with waveform and dynamic data (not clsuters) so i guess thats why.

 

I have also seen another write-up that says the start time of a 1D waveform will always remain the same for the rest of the rows as defined for the first row even if changed for the subsequent rows in a loop.

 

So i guess my question is: what is the way around issues like this?

 

 

 

 

[BADGE NAME]

0 Kudos
Message 1 of 20
(5,228 Views)
Solution
Accepted by topic author blessedk

First of all, let me be the first to both congratulate and thank you for finally posting some code!  I'm not 100% certain I understand your question or your code, but I have an idea, maybe, of what you want to do, so I wrote a little VI that does something simple which might be relevant.

 

You mention Waveforms of different length, and starting at different times.  You also want each to have a unique Attribute (though I'm uncertain what you want to do with the Attribute).  So I did the following:

  1. Generated a 100-sample random array to represent 1 second of a waveform.
  2. Created 4 waveforms based on this 100-sample base.  The first Waveform (Channel 0) is just these 100 points.  The second, Channel 1, is the concatenation of Channel 0 with the 100-sample base, or a "double" waveform.  Channel 2 is Channel 1 concatenated with the base, and Channel 3 is Channel 2 concatenated with the base.
  3. In order to plot the four channels so they don't sit "on top of" each other, the Waveform has the Channel number added to it.  Thus Channel 3 is 3 + (4 copies of the base 100 points), a 400-point random waveform centered around an offset of 3.
  4. All Channels have dt set to 0.01 (though I suppose I could have varied this, as well).
  5. To make the channels start at different times, I started Channel N N seconds before Channel 0 (by subtracting the loop index, i, from t0).
  6. For each Channel, I created an Attribute called "Chan" equal to "Channel N" (where N = 0, 1, 2, or 3, as appropriate).

Here is the resulting Plot. The X Scale is set to Absolute Time (no Date) using the 24-hour HH:MM:SS format.  You can see that the plots are 1, 2, 3, and 4 seconds long, and are offset from each other by 1 second.  I used the Plot Attributes to change the Plot Names to the respective Attribute.

Multiple Waveform Plot FP.png

The code to do this is extremely straight-forward -- I almost don't need to show it, as I think it is completely described by the text above, but here it is:

Multiple Waveform Plot.png

Now, wasn't that much quicker than some of your previous posts, where you refused to post your code, we "guessed" at what you wanted (but didn't guess correctly), you tried to "nudge" us in the right direction (still refusing to post code), and noone seemed very happy?

 

Bob Schor

Message 2 of 20
(5,200 Views)
Bob you won't believe this: All I needed to know was that different active plots needed to be paired with each plot name (channel name) in the loop. Thank you so much. I had that property node running inside the loop with just the plot names alone without defining the corresponding active plot. Still have lots to know. 🙂

[BADGE NAME]

0 Kudos
Message 3 of 20
(5,187 Views)

Well, when you don't post code, we have no idea where the problem lies (and sometimes can't figure out what it is you are trying to describe).  "A Picture is Worth 1000 Words, and a VI is Worth 1000 Pictures".

 

Bob Schor

0 Kudos
Message 4 of 20
(5,161 Views)

Bob,

 

Use the attribute "NI_ChannelName" and toss your second For Loop.

Spoiler
We would not want such a nice example qualifying as a Rube.

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 20
(5,149 Views)
Thanks Bob, will keep improving on my VIs. I have a number of further related questions but this time not really having to do with codes but with more of graph customizations.

1. My X scroll bar is visible but the scroll( or slider) itself does not show up. - only the arrows at both ends which are greyed out. Looks like this happened after I stopped using "multiplier and offset property nodes" to calibrate my X-scale - but not sure. What else could be the reason?

2. When displaying multiple plots with different scales on the same graph is there a way to divide the graph into some kind of "sub panes" - one for each plot?

3. As with some other applications I have seen in the past long before " I fell in love" with Labview less than 3 months ago, the X and corresponding Y0 to Yn values/co-ordinates ( where n is the number of plots with channel names Yn) can be displayed right on the graph or in some cursor display just by placing the system cursor (or right clicking) at a given point on the graph. How can this be done in Labview?

Would be glad to have solutions to the three aforementioned questions.

[BADGE NAME]

0 Kudos
Message 6 of 20
(5,143 Views)
Something about the original question which I just observed:

If I check " ignore time stamp", the plot won't be right. That is the curves would all start from the same point irrespective of the fact that i had pre-defined different starting points in the loop. This is actually the problem I have been facing. Unfortunately my plot is not against time so I don't want to display time. I actually want to ignore time stamp so I can apply multiplier and offset property to "calibrate" my X scale.

This alignment only works if you do not ignore time stamp. The cluster graph works OK but also has a few Issues:

When run the first time, the active plot/ plot name properly do not update channel names the first time. They update when run a second time. You may not observe this if you run with the same channel names all the time.

[BADGE NAME]

0 Kudos
Message 7 of 20
(5,084 Views)

I'm a little confused.  You have a multi-channel plot, where the individual channels differ precisely in their Start time, t0, and you want the plots to reflect the different Start Times, but don't want to plot "time" on the X axis?  My initial reaction was to say "What a self-contradictory notion, how silly of you ...", but then I needed to do my Sunday grocery shopping, so stopped at the end of the previous sentence.  As we were cruising the aisles looking for fresh vegetables, a scheme came to me (which I'm now going to try out ...).

 

I started with my previous Demo posted on this thread, and turned on "Ignore waveform timestamp on x-axes".  The Plot looked the same, each plot origin being offset.  However, if I also turned off "Ignore Time Stamp" from the Front Panel properties of the Graph, I got the following:

Graph 1.png

This, of course, makes perfect sense, as the four Channels are constructed to have different lengths, and we turned off the "align according to the value of the X (time) Axis", hence they all start from the same X value and merely plot as many points as there are in the Channel, hence they end at different times.  So all we have to do is to align the Waveforms at their end points.

 

Here's a revised Demo (I used the earlier Snippet, changed the Graph to make the above plot, then added one extra sub-VI, as shown here):

Align at Ends Demo.png

and here is the resulting Graph (I added the Simple Error Handler to ensure there were no Errors, which returned "No Errors"):

Align at Ends Result.png

Don't worry that the plots look slightly different from the graph above -- these are, after all, Random Numbers ...

 

Bob Schor

 

 

 

0 Kudos
Message 8 of 20
(5,074 Views)
Hi Bob, good you didn't continue with that sentence 🙂 As you know all my candid intention is to learn and be like you 🙂 I am really not plotting against time though I mentioned that so that the terms are consistent with what Labview users are used to for a waveform graph. The data set I have don't all align at the ends too, so aligning them at the ends does not quite fix my problem.
The cluster graph does a good job but there are a few Issues I face with the active plot/plot name property . Unfortunately I am not able to Like I said the loop in which that property is placed needs to be re-run a second time to get the channel names to update.
Also I loose the scroll bar slider.
I don't know if I should revert to the cluster graph approach

[BADGE NAME]

0 Kudos
Message 9 of 20
(5,065 Views)

@blessedk wrote:
The data set I have don't all align at the ends too, so aligning them at the ends does not quite fix my problem.  it depends on what "my problem" is.  If you notice, the data (created in the left big For loop) are of different sizes, so they don't align at the ends, but if what you require is a version that plots to show the relative offsets at the beginning, you can create a version just for the purposes of making the plot.
The cluster graph does a good job but there are a few Issues I face with the active plot/plot name property . Unfortunately I am not able to.  Like I said the loop in which that property is placed needs to be re-run a second time to get the channel names to update.  Well, true to form, you didn't provide an example of code that "doesn't work" and invite us to either (a) show you how to make it work, or (b) confirm that this is a real (as opposed to a "I don't know how to do this") shortcoming.
Also I lose the scroll bar slider.  Again, we need your code that demonstrates the problem so that we can suggest fixes (if they exist).
I don't know if I should revert to the cluster graph approach.  Neither do we.  I guess you'll have to make this decision on your own, as only you know what you want to do.  It is, indeed, admirable that you are trying to figure out how to do these things by yourself, but when you come to the Forum and ask for (specific) help, you really need to show us what doesn't work in the code that you post (so we can verify it and see if we can suggest fixes).  Otherwise, everyone's time is wasted, and the LabVIEW Community that follows the Forums, many of whom have questions that might be very similar to yours, just gets frustrated.

Bob Schor

0 Kudos
Message 10 of 20
(5,058 Views)