LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to limit Chart History in XY graph

Hi there, I found this information in NI Support and it works propertly, but I don't know how to wire the "true" section of the chart history case.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P82GSAS 

 

I attach my subVI where I have completed the clear graph true case.

 

Thanks in advice

0 Kudos
Message 1 of 8
(2,673 Views)

A couple of notes:

In LabVIEW a "chart" and a "graph" are different things. As it seems like you know, the chart has a history, and adds data to it. The graph will only display what you most recently wrote to it. In your example VI, it is a functional global to make a graph behave more like a chart.

 

The connector pane for your SubVI is very weird. You should keep inputs on the left and outputs on the right.

 

When clear graph is set to True, it will load up the shift registers with empty arrays for next iteration. The value written to the graph still has all previous data until the next generation is run.

 

If you are calling this as a SubVI (as your file name implies), then please attach your top-level code.

 

 

0 Kudos
Message 2 of 8
(2,628 Views)

@Gregory wrote:

A couple of notes:

In LabVIEW a "chart" and a "graph" are different things. 

 


The "build xy graph" express vi does have an optional history, but it is fixed at infinite size. 😮

0 Kudos
Message 3 of 8
(2,622 Views)

 

I have attached an example of an XY graph with an option to clear (initialize) the graph. It is one of five XY graphs in a larger program to monitor a grid tie inverter system. My program resets the graph every night at midnight and it holds 24 hours of data.

 

Here is how they are used in my main program, after appending a timestamp a numeric array of measurements is fed to each graph sub-vi

s1Capture.PNG

I attached on of my sub-vi's for you too

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 8
(2,608 Views)

@epm12 wrote:

 

I attach my subVI where I have completed the clear graph true case.

 


Some generic comment on your coding:

  • You can use a single complex (CDB) array to hold the data, no need for building two different arrays or forming clusters. A xy graph terminal understands 1D complex arrays directly and will graph IM vs. RE.
  • You are clearing the shift register data in the second case, which will not clear the graph because you tapped into it before that.
  • There is no obvious reason why you would need to carry the pink wire across all cases of the two case structures unchanged. Only things that are different between cases belong inside.
  • A globally initialized feedback node might be a better choice to ensure initialization on first run. It would also eliminate the while loop.
  • How often does the size change during the run? If it is mostly constant, if would be better to do an "in-place" implementation instead of constantly growing and resizing arrays. You can use NaN for elements that don't have valid data and they won't show on the graph.
  • Please don't maximize the front panel and diagram to the entire screen! Annoying!
  • ...
0 Kudos
Message 5 of 8
(2,598 Views)

@altenbach wrote:
Some generic comment on your coding:
  • You can use a single complex (CDB) array to hold the data, 

 

Here's one possibility (simplfied to show the idea)

 

XYchart.png

 

0 Kudos
Message 6 of 8
(2,593 Views)

Thank you, I know that about the "clean graph", but it works, I don't know why, but it cleans all the graph area and when you add data it starts from clean.

 

I attach my VI.

0 Kudos
Message 7 of 8
(2,570 Views)

@epm12 wrote:

I don't know why, but it cleans all the graph area and when you add data it starts from clean.

 


Please be clear. Is that what you want or what you don't want? If you don't want that, what do you want instead?

 

You did not include the subVI, so we cannot test.

0 Kudos
Message 8 of 8
(2,549 Views)