LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with XY Graph "forgetting" plot properties

Solved!
Go to solution

I am having trouble with an XT Graph in my loop.

The graph has 10 plots which at any time can have anything from 0 to ~1000 points, often some plots will have significantly less ploints than others. There is a user selectable option to display all points or just the most recent set.

My problem is that I want the graph to reflect the input data by plotting a single point at the time of an update, so I have a string of points rather than a line.

When I right click the graph and go into properties, I change the point style to solid circle and turn off line interpolation. I then click save these values as default, and save the vi.

However, once I run the vi, the graph always reverts plots 1 to 9 (not plot 0, this stays as I want it) to have no points displayed and line interpolation on.

Has anyone had this problem before? Ho did you fix it?

I know it can be fixed, as I had this probelm a few months ago on a similar vi and after weeks of struggle I solved it, however I just cannot remember how I did it.

Thank you for any help, at the moment I can't post any code. Note that the data the graph shows is all perfectly fine, just the plot properties are being forgotten.

 

 

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

Hi Darragh,

 

you can set the plot properties for each plot using property nodes...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(4,723 Views)

Hi GerdW,

I tried this using a node with active plot; plot.point_style; plot.line_interpolation, inside a for loop. The iteration count of the loop was wired to active plot and 10 iterations set.

However, when I tried to run it, after the first iteration of the loop I got an error saying that I was sending an invalid value to active plot.

I wonder does anybody know if I have ten plots going to an XY graph and this drops to one or two and then back to ten, will it reset the properties of the plots that were dropped?

I think there may be a point in my code where I reset the graph by sending an empty array to it, I have a feeling this may be the problem as it would cause the number of active plots to drop to 0, then on the next iteration it would go up to 10 again. At the moment I'm searching for anywhere where I might send less than ten plots to the graph.

 

Also, if its an any help, I'm sending the data as an array (1d, 10 elements) of cluster (1 element) of array (1d, approx 7 elements but can change) of cluster of two u32.

 

This data type seems clunky but its the only way I could get the xy graph to plot my data, which originates as a 2d array of cluster of two u32. The data is ten sets of co-ordinate arrays.

 

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

Hi Darragh,

 

"after the first iteration of the loop I got an error saying that I was sending an invalid value to active plot."

Yes, you're right: you can only set plot properties for active plots (plots that actually exist). Otherwise you get an error - which you could catch and check to avoid popup-messages...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(4,711 Views)

Say I set the properties for an active plot and it becomes inactive for a period and active again (for example if a shorter array gets sent to the graph on one loop iteration), does the period where it is inactive reset the properties to interpolate a line and not plot points? Is there a way to set default property settings which it will revert to?

I have tried setting the properties and clicking 'make these values default' in the right click -> Data operations tree, and this doesn't work, I feel it only sets the data values to be the new default settings, not the properties.

0 Kudos
Message 5 of 11
(4,706 Views)
Solution
Accepted by topic author DarraghCorrigan

HI DarraghCorrigan,

 

In relation to the problem expressed in your initial post:

 

"once I run the vi, the graph always reverts plots 1 to 9 (not plot 0, this stays as I want it) to have no points displayed and line interpolation on"

 

This is due to a bug in the LabVIEW software whereby any changes that are made to the plot properties (e.g. to change the colour of a plot) will not be retained, except in plot 0 which is unaffected. Our R&D department are currently investigating this problem so that it can be fixed in future version of the software. The recommended workaround for this problem is to pragmatically set the plot settings at the beginning of the code using property nodes.

 

As I understand it, this is not the main problem that you are experiencing. If you set up the properties for a plot (using some of the described property nodes) which is subsequently removed or rewritten on an XY Graph, my understanding is that there is no way that LabVIEW can remember and retain these properties.

 

As you rightly suggested, one way of conveniently overcoming this problem would be to set default plot properties so that when you remove/rewrite a plot and then add it again, it will always default to those properties. Unfortunately, it is not currently possible to do this though it has been recommended as a product suggestion so it is a feature that is under consideration for implementation in future releases of LabVIEW.

 

I think the issue you need to be addressing is the fact that you are at some point resetting the graph by sending an empty array to it such that all of your properties are lost. If you can find and remove this section in your code, you should be able to overcome your problem.

 

I hope this helps.

 

Best Regards,

 

Christian Hartshorne

NIUK

0 Kudos
Message 6 of 11
(4,665 Views)

@CJHartshorne wrote:

HI DarraghCorrigan,

... 

This is due to a bug in the LabVIEW software whereby any changes that are made to the plot properties (e.g. to change the colour of a plot) will not be retained, except in plot 0 which is unaffected. Our R&D department are currently investigating this problem so that it can be fixed in future version of the software. The recommended workaround for this problem is to pragmatically set the plot settings at the beginning of the code using property nodes.

 

... 

Christian Hartshorne

NIUK


Please share the CAR #.

 

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,658 Views)

CAR # 150106

 

Thanks,

 

Christian Hartshorne

NIUK

0 Kudos
Message 8 of 11
(4,651 Views)

Thanks Christian, you were right, I was sending an empty array during the very first iteration of the loop. If anyone has a similar problem, I just put a check on the array size just before it goes to the XY graph,  if it is the right size it is allowed through, if it is less than the right size I send an array initialized to the right number of elements, all 0, to the graph.

It would seem more efficient to append the array to the right number of elements, but when each element is a separate plot, you can't be sure where to put the 0's, so an array of 0's is less ambiguous.

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

I'm currently running version 10.0, and just wondering whether the property forgetting issue has been addressed in a patch?

 

Thanks,

Ian

0 Kudos
Message 10 of 11
(4,279 Views)