LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing Graph Property or am I missing something?

I am trying to figure out which plot the user is right-clicking on in a XY Graph legend, where I have shown the plot scrollbar.

Using the Legend coordinates and the Mouse right-click coordinate and a user menu item, I can figure which region of the legend the user clicked in.

That, in principle should allow me to determine which plot the user selected, except in a case like this:

 

ScreenHunter_001.jpg

 

In this case, the user scrolled down the list and I will be off by one plot using simple algebra.

The problem is, as far as I can tell, that there is no way to figure out the position of the scrollbar (or since the legend is an array of clusters, the element in top visible position).

Am I correct or did I overlook some property that would get me there?

0 Kudos
Message 1 of 11
(4,272 Views)

There are several things to figure out.  First, how many plots do you have?  [Your example has two, though you can scroll down the selection list to a third "blank" entry].  The easiest way to do this is to take the 2-D array going into the plot and look at the size of the first dimension -- this is the number of plots.

 

I'm not sure what you want to do with the "Plot ID" box, but your example shows the Visibility boxes.  Suppose you want to know which plots are visible.

 

What you basically have to do is to make each plot "active" and check its "Visibility" property.  However, this can be done with a single Property node, taking advantage of the fact that node entries are processed in a "top-down" fashion.

Plot Properties.png

Here's how it looks as a snippet.  "MyPlot" is the plot, itself.  The Array Size and Index get the number of plots.  I actually had a property node for MyPlot inside the For loop, but it got "converted" when I made the snippet.  The point is you make each plot "Active", then ask if it is Visible.  You can similarly set it to be visible, or change its color, or anything else you want.  Hope this answers your question.

0 Kudos
Message 2 of 11
(4,242 Views)

OK, sorry my bad again...

I am in fact trying to handle a user shortcut menu which will delete the plot the user is right-clicking on IN THE LEGEND. So basically, the only thing I know is WHERE in the legend the click occured (using one of rhe VIs I posted here).

Since there could be many many plots, I have to show the scrollbar (or the plot index) to allow the user to first show the plot in the legend and THEN right-click on it.

My problem is that I can't find a property that will tell me which plot sitting at the top of the list visble in the legend (Plot 1 in my example). So my coordinate info can tell me: the user click in the region where the first, second, etc displayed plot is shown, but if I allow the user to scroll in this list, that's not enough info to deduce what the plot index is.

Hence my question (before I make a request if the answer is a confirmed NO): is there a property that wil tell me which plot is displayed at the top of the list in the legend?

 

PS: my temporary solution is to disable the scrollbar in the legend 😞

0 Kudos
Message 3 of 11
(4,232 Views)

Well, I strongly suspect that the answer to your particular question is, indeed, "No".  But if what you want to do is to allow the user to click in the legend and delete a plot (as opposed to simply make in "invisible"), why not detect which plots are not visible and then delete them?  Won't that accomplish the same thing?  [It will, of course, cause the plots to be renumbered, but if you've "named" them ... I was going to say, the names would "stick", but realize I have no idea if that is true!  However, you could certainly "rebuild" the plot, saving and restoring things like plot names, scales, colors, etc.].

0 Kudos
Message 4 of 11
(4,222 Views)

No, that won't work. Invisible needs to be a different attribute than deleted (you may want to hide a plot temporarily to better check others). Plus you'll notice that the check box is not a "close" box, so it would be very unnatural to use it as a "close" box...

Obviously, I modify the remaining plot attributes after the selected plot is deleted. And I also allow the user to delete the plot from the plot area. I just thought it was convenient to do it from the legend as well.

I guess I will post the suggestion in the Idea Exchange forum... I actually don't understand how NI forgot about this property, as it is basic for any array control/indicator, and that's what the legend is: an array of clusters, basically.

0 Kudos
Message 5 of 11
(4,217 Views)

X,

 

I seems like the only thing you would need for your other Vi's to work with a scroll bar was if the legend index was atleast readible. There is an idea exchange for that here. I will see if any other engineers have an idea or possibly if its hidden somewhere else. 

Kyle Hartley
Senior Embedded Software Engineer

Message 6 of 11
(4,198 Views)

Thanks for the link. I'll concur there and link back here so that you guys have one more illustration of the need for this functionality.

0 Kudos
Message 7 of 11
(4,193 Views)

Definitely seems like an important missing property. I think I can probably sneak this into 2013 for you guys 😉

Message 8 of 11
(4,074 Views)

Just don't forget to provide a description of it in the Help...

0 Kudos
Message 9 of 11
(4,007 Views)

It looks like you can "fudge" it if you really need to.  I was just testing pulling out colors from an image capture (pixmap).

It would be a combination of what row they clicked with grabbing the color on that row and comparing it to your waveform colors...

I did not code it up completely but I did enough to know it would work OK.

 

You can find the code to grab a pixmap pixel color here:

https://decibel.ni.com/content/docs/DOC-21900

 

New Bitmap Image.png

Message 10 of 11
(3,995 Views)