LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Graph Properties: Set Active Plot Colour in a Dynamic Range of Plots

Hello,

I am attempting to set a colour for a dynamic range of plots. The plots are created by opening a specific file containing a number of array elements. The plots are subdivided into rows. When the VI is run, usually but not always, the colours are set to the proper value. Once in awhile I will receive an error specifying the plot does not exist, which I'm sure is due to the dynamic loading of the array elements. When the previous array is smaller than the current loaded is probably the cause. I suppose I am having timing isues. I've added a time delay and it seems to work if the delay is set for a high value, but I believe there must be a better implementation. Because the number of plots vary I have to access the property nodes and set each plot's colour value via a for loop. Any suggestions as to a better implementation would be greatly appreciated.

NOTE: The value fed into the for loop is the row number of arrays. Also the "convert to dynamic data" vi is set to "2D array of scalars-rows are channels".
0 Kudos
Message 1 of 11
(4,808 Views)
Try splitting up your property nodes because the trouble I think you are having is due tot he fact that there is no dataflow as to say which one will get set first the active plot or the color. see attached picture try it and see if it helps, if it does not then post you vi.



Joe.
"NOTHING IS EVER EASY"
Message 2 of 11
(4,799 Views)
Thanks for the suggestion but it seemed it has not resolved my problem. The odd part about this is that when I run the simulation and I receive an error, I will try to run it a second time and everything works out fine. I've tried adding a flattened sequence structure between the properties, but still experiencing the same issues. I did not mention this earlier, but it may be important; my XY Graph is in a tab control. I noticed the errors would occur more often when I am in a different tab other than the one that holds the XY graph.

Thanks,

nilak
0 Kudos
Message 3 of 11
(4,781 Views)
I have tinkered around with it and have come to several conclusions. I have added a sequence structure between the file reads and the property value sets. I have also added a sequence structure between the active plot and set plot colour properties. It seemed to have fixed 2 of the 3 error I was getting. The only problem I have now, is when I am in a tab other than the one XY Graph is located, I will receive an error "invalid property value". Is there a way to indicate what tab the user is located in, since I only need to execute the loop whenever the user has selected the tab that contains the graph. I could not find such a property indicator.
0 Kudos
Message 4 of 11
(4,773 Views)

@nilak wrote:
Is there a way to indicate what tab the user is located in, since I only need to execute the loop whenever the user has selected the tab that contains the graph. I could not find such a property indicator.


Use the Tab control's terminal itself which is a enum. If you want to convert the current tab's name to a string, just wire it to a 'Format to string' function.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 5 of 11
(4,759 Views)
You should not have had to go to this great of lengths to get this to work. Could you post just the part of your code that is giving you the trouble. this should be real easy to figure out but if I do not know everything you are doing it will be hard.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 6 of 11
(4,755 Views)
Wonderful post Donald!

I did not know that the "format into string" would perform as you illustrated.

Since I can only give you 5-stars I have decided to add you as a member of the "Knight of NI"!!

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=79&jump=true

Thank for the lesson!

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 11
(4,744 Views)
Thank you all for the help. After taking in all the suggestions I have come to a conclusion (attached below). So far I have not received any errors when running the simulations. Though I cannot be certain it seems like this has fixed the problem. The screenshot below is what I've done, if anyone has any better suggestions, feel free to share. It was really odd that I would receive those errors only sometimes when executing.

nilak

EDIT: I have removed the smaller sequence structure and it seems to be yielding the same results. The attachment is updated.

Message Edited by nilak on 05-03-2005 01:39 PM

0 Kudos
Message 8 of 11
(4,737 Views)
I know this is an old thread, but I've been working on a similar problem.

It seems the plots on a graph only exist (and can only be set as "active") after they've been drawn.

If a graph has only 'n' plots, and new data is written to it with more than 'n' plots, the graph must redraw before the new plots can be set 'active' and their properties read or written.

This means that a graph on an unselected tab or on a front panel with 'defer panel updates' set TRUE will return an error when a setting a plot active, if that plot didn't exist at the latest redraw EVEN IF THE DATA HAS BEEN WRITTEN TO THE TERMINAL.  (It works the second time, because the plot was brought into existance on the first execution.)

I don't like this behavior, but there doesn't seem to be a way around it.
0 Kudos
Message 9 of 11
(4,565 Views)
"but there doesn't seem to be a way around it."
 
I do not have time to try this myself but...
 
In a similar situation, I was able to force an object's image to be updated by using an "invoke node>>> Get Image".
 
Let us know how this goes.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 11
(4,543 Views)